desmost 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/compiler/compile.d.ts +32 -0
- package/dist/compiler/compile.d.ts.map +1 -0
- package/dist/compiler/compile.js +101 -0
- package/dist/compiler/compile.js.map +1 -0
- package/dist/compiler/evaluate.d.ts +18 -0
- package/dist/compiler/evaluate.d.ts.map +1 -0
- package/dist/compiler/evaluate.js +83 -0
- package/dist/compiler/evaluate.js.map +1 -0
- package/dist/compiler/index.d.ts +3 -0
- package/dist/compiler/index.d.ts.map +1 -0
- package/dist/compiler/index.js +2 -0
- package/dist/compiler/index.js.map +1 -0
- package/dist/compiler/options.d.ts +54 -0
- package/dist/compiler/options.d.ts.map +1 -0
- package/dist/compiler/options.js +15 -0
- package/dist/compiler/options.js.map +1 -0
- package/dist/desmos.d.ts +12 -0
- package/dist/desmos.d.ts.map +1 -0
- package/dist/desmos.js +13 -0
- package/dist/desmos.js.map +1 -0
- package/dist/errors.d.ts +45 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +38 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/magic/expr/index.d.ts +3 -0
- package/dist/magic/expr/index.d.ts.map +1 -0
- package/dist/magic/expr/index.js +8 -0
- package/dist/magic/expr/index.js.map +1 -0
- package/dist/magic/expr/latex.d.ts +10 -0
- package/dist/magic/expr/latex.d.ts.map +1 -0
- package/dist/magic/expr/latex.js +16 -0
- package/dist/magic/expr/latex.js.map +1 -0
- package/dist/magic/expr/text.d.ts +9 -0
- package/dist/magic/expr/text.d.ts.map +1 -0
- package/dist/magic/expr/text.js +13 -0
- package/dist/magic/expr/text.js.map +1 -0
- package/dist/magic/global/dark-mode.d.ts +7 -0
- package/dist/magic/global/dark-mode.d.ts.map +1 -0
- package/dist/magic/global/dark-mode.js +11 -0
- package/dist/magic/global/dark-mode.js.map +1 -0
- package/dist/magic/global/desmos.d.ts +9 -0
- package/dist/magic/global/desmos.d.ts.map +1 -0
- package/dist/magic/global/desmos.js +11 -0
- package/dist/magic/global/desmos.js.map +1 -0
- package/dist/magic/global/index.d.ts +3 -0
- package/dist/magic/global/index.d.ts.map +1 -0
- package/dist/magic/global/index.js +10 -0
- package/dist/magic/global/index.js.map +1 -0
- package/dist/magic/global/viewport.d.ts +16 -0
- package/dist/magic/global/viewport.d.ts.map +1 -0
- package/dist/magic/global/viewport.js +12 -0
- package/dist/magic/global/viewport.js.map +1 -0
- package/dist/magic/incantation.d.ts +74 -0
- package/dist/magic/incantation.d.ts.map +1 -0
- package/dist/magic/incantation.js +81 -0
- package/dist/magic/incantation.js.map +1 -0
- package/dist/magic/index.d.ts +6 -0
- package/dist/magic/index.d.ts.map +1 -0
- package/dist/magic/index.js +5 -0
- package/dist/magic/index.js.map +1 -0
- package/dist/magic/local/anim.d.ts +7 -0
- package/dist/magic/local/anim.d.ts.map +1 -0
- package/dist/magic/local/anim.js +11 -0
- package/dist/magic/local/anim.js.map +1 -0
- package/dist/magic/local/colour.d.ts +12 -0
- package/dist/magic/local/colour.d.ts.map +1 -0
- package/dist/magic/local/colour.js +27 -0
- package/dist/magic/local/colour.js.map +1 -0
- package/dist/magic/local/dashed.d.ts +7 -0
- package/dist/magic/local/dashed.d.ts.map +1 -0
- package/dist/magic/local/dashed.js +10 -0
- package/dist/magic/local/dashed.js.map +1 -0
- package/dist/magic/local/fill.d.ts +13 -0
- package/dist/magic/local/fill.d.ts.map +1 -0
- package/dist/magic/local/fill.js +12 -0
- package/dist/magic/local/fill.js.map +1 -0
- package/dist/magic/local/hide.d.ts +7 -0
- package/dist/magic/local/hide.d.ts.map +1 -0
- package/dist/magic/local/hide.js +10 -0
- package/dist/magic/local/hide.js.map +1 -0
- package/dist/magic/local/index.d.ts +3 -0
- package/dist/magic/local/index.d.ts.map +1 -0
- package/dist/magic/local/index.js +24 -0
- package/dist/magic/local/index.js.map +1 -0
- package/dist/magic/local/line.d.ts +15 -0
- package/dist/magic/local/line.d.ts.map +1 -0
- package/dist/magic/local/line.js +17 -0
- package/dist/magic/local/line.js.map +1 -0
- package/dist/magic/local/no-line.d.ts +7 -0
- package/dist/magic/local/no-line.d.ts.map +1 -0
- package/dist/magic/local/no-line.js +10 -0
- package/dist/magic/local/no-line.js.map +1 -0
- package/dist/magic/local/point.d.ts +15 -0
- package/dist/magic/local/point.d.ts.map +1 -0
- package/dist/magic/local/point.js +17 -0
- package/dist/magic/local/point.js.map +1 -0
- package/dist/magic/local/secret.d.ts +7 -0
- package/dist/magic/local/secret.d.ts.map +1 -0
- package/dist/magic/local/secret.js +10 -0
- package/dist/magic/local/secret.js.map +1 -0
- package/dist/magic/local/slider.d.ts +15 -0
- package/dist/magic/local/slider.d.ts.map +1 -0
- package/dist/magic/local/slider.js +13 -0
- package/dist/magic/local/slider.js.map +1 -0
- package/dist/parser/ast.d.ts +40 -0
- package/dist/parser/ast.d.ts.map +1 -0
- package/dist/parser/ast.js +13 -0
- package/dist/parser/ast.js.map +1 -0
- package/dist/parser/desmost-parser.d.ts +105 -0
- package/dist/parser/desmost-parser.d.ts.map +1 -0
- package/dist/parser/desmost-parser.js +379 -0
- package/dist/parser/desmost-parser.js.map +1 -0
- package/dist/parser/generic-parser.d.ts +62 -0
- package/dist/parser/generic-parser.d.ts.map +1 -0
- package/dist/parser/generic-parser.js +143 -0
- package/dist/parser/generic-parser.js.map +1 -0
- package/dist/parser/index.d.ts +8 -0
- package/dist/parser/index.d.ts.map +1 -0
- package/dist/parser/index.js +8 -0
- package/dist/parser/index.js.map +1 -0
- package/dist/src/compiler/compile.d.ts +32 -0
- package/dist/src/compiler/compile.d.ts.map +1 -0
- package/dist/src/compiler/compile.js +101 -0
- package/dist/src/compiler/compile.js.map +1 -0
- package/dist/src/compiler/evaluate.d.ts +18 -0
- package/dist/src/compiler/evaluate.d.ts.map +1 -0
- package/dist/src/compiler/evaluate.js +83 -0
- package/dist/src/compiler/evaluate.js.map +1 -0
- package/dist/src/compiler/index.d.ts +3 -0
- package/dist/src/compiler/index.d.ts.map +1 -0
- package/dist/src/compiler/index.js +2 -0
- package/dist/src/compiler/index.js.map +1 -0
- package/dist/src/compiler/options.d.ts +54 -0
- package/dist/src/compiler/options.d.ts.map +1 -0
- package/dist/src/compiler/options.js +15 -0
- package/dist/src/compiler/options.js.map +1 -0
- package/dist/src/desmos.d.ts +12 -0
- package/dist/src/desmos.d.ts.map +1 -0
- package/dist/src/desmos.js +13 -0
- package/dist/src/desmos.js.map +1 -0
- package/dist/src/errors.d.ts +45 -0
- package/dist/src/errors.d.ts.map +1 -0
- package/dist/src/errors.js +38 -0
- package/dist/src/errors.js.map +1 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +2 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/magic/expr/index.d.ts +3 -0
- package/dist/src/magic/expr/index.d.ts.map +1 -0
- package/dist/src/magic/expr/index.js +8 -0
- package/dist/src/magic/expr/index.js.map +1 -0
- package/dist/src/magic/expr/latex.d.ts +10 -0
- package/dist/src/magic/expr/latex.d.ts.map +1 -0
- package/dist/src/magic/expr/latex.js +16 -0
- package/dist/src/magic/expr/latex.js.map +1 -0
- package/dist/src/magic/expr/text.d.ts +9 -0
- package/dist/src/magic/expr/text.d.ts.map +1 -0
- package/dist/src/magic/expr/text.js +13 -0
- package/dist/src/magic/expr/text.js.map +1 -0
- package/dist/src/magic/global/dark-mode.d.ts +7 -0
- package/dist/src/magic/global/dark-mode.d.ts.map +1 -0
- package/dist/src/magic/global/dark-mode.js +11 -0
- package/dist/src/magic/global/dark-mode.js.map +1 -0
- package/dist/src/magic/global/desmos.d.ts +9 -0
- package/dist/src/magic/global/desmos.d.ts.map +1 -0
- package/dist/src/magic/global/desmos.js +11 -0
- package/dist/src/magic/global/desmos.js.map +1 -0
- package/dist/src/magic/global/index.d.ts +3 -0
- package/dist/src/magic/global/index.d.ts.map +1 -0
- package/dist/src/magic/global/index.js +10 -0
- package/dist/src/magic/global/index.js.map +1 -0
- package/dist/src/magic/global/viewport.d.ts +16 -0
- package/dist/src/magic/global/viewport.d.ts.map +1 -0
- package/dist/src/magic/global/viewport.js +12 -0
- package/dist/src/magic/global/viewport.js.map +1 -0
- package/dist/src/magic/incantation.d.ts +74 -0
- package/dist/src/magic/incantation.d.ts.map +1 -0
- package/dist/src/magic/incantation.js +81 -0
- package/dist/src/magic/incantation.js.map +1 -0
- package/dist/src/magic/index.d.ts +6 -0
- package/dist/src/magic/index.d.ts.map +1 -0
- package/dist/src/magic/index.js +5 -0
- package/dist/src/magic/index.js.map +1 -0
- package/dist/src/magic/local/anim.d.ts +7 -0
- package/dist/src/magic/local/anim.d.ts.map +1 -0
- package/dist/src/magic/local/anim.js +11 -0
- package/dist/src/magic/local/anim.js.map +1 -0
- package/dist/src/magic/local/colour.d.ts +12 -0
- package/dist/src/magic/local/colour.d.ts.map +1 -0
- package/dist/src/magic/local/colour.js +27 -0
- package/dist/src/magic/local/colour.js.map +1 -0
- package/dist/src/magic/local/dashed.d.ts +7 -0
- package/dist/src/magic/local/dashed.d.ts.map +1 -0
- package/dist/src/magic/local/dashed.js +10 -0
- package/dist/src/magic/local/dashed.js.map +1 -0
- package/dist/src/magic/local/fill.d.ts +13 -0
- package/dist/src/magic/local/fill.d.ts.map +1 -0
- package/dist/src/magic/local/fill.js +12 -0
- package/dist/src/magic/local/fill.js.map +1 -0
- package/dist/src/magic/local/hide.d.ts +7 -0
- package/dist/src/magic/local/hide.d.ts.map +1 -0
- package/dist/src/magic/local/hide.js +10 -0
- package/dist/src/magic/local/hide.js.map +1 -0
- package/dist/src/magic/local/index.d.ts +3 -0
- package/dist/src/magic/local/index.d.ts.map +1 -0
- package/dist/src/magic/local/index.js +24 -0
- package/dist/src/magic/local/index.js.map +1 -0
- package/dist/src/magic/local/line.d.ts +15 -0
- package/dist/src/magic/local/line.d.ts.map +1 -0
- package/dist/src/magic/local/line.js +17 -0
- package/dist/src/magic/local/line.js.map +1 -0
- package/dist/src/magic/local/no-line.d.ts +7 -0
- package/dist/src/magic/local/no-line.d.ts.map +1 -0
- package/dist/src/magic/local/no-line.js +10 -0
- package/dist/src/magic/local/no-line.js.map +1 -0
- package/dist/src/magic/local/point.d.ts +15 -0
- package/dist/src/magic/local/point.d.ts.map +1 -0
- package/dist/src/magic/local/point.js +17 -0
- package/dist/src/magic/local/point.js.map +1 -0
- package/dist/src/magic/local/secret.d.ts +7 -0
- package/dist/src/magic/local/secret.d.ts.map +1 -0
- package/dist/src/magic/local/secret.js +10 -0
- package/dist/src/magic/local/secret.js.map +1 -0
- package/dist/src/magic/local/slider.d.ts +15 -0
- package/dist/src/magic/local/slider.d.ts.map +1 -0
- package/dist/src/magic/local/slider.js +13 -0
- package/dist/src/magic/local/slider.js.map +1 -0
- package/dist/src/parser/ast.d.ts +40 -0
- package/dist/src/parser/ast.d.ts.map +1 -0
- package/dist/src/parser/ast.js +13 -0
- package/dist/src/parser/ast.js.map +1 -0
- package/dist/src/parser/desmost-parser.d.ts +105 -0
- package/dist/src/parser/desmost-parser.d.ts.map +1 -0
- package/dist/src/parser/desmost-parser.js +379 -0
- package/dist/src/parser/desmost-parser.js.map +1 -0
- package/dist/src/parser/generic-parser.d.ts +62 -0
- package/dist/src/parser/generic-parser.d.ts.map +1 -0
- package/dist/src/parser/generic-parser.js +143 -0
- package/dist/src/parser/generic-parser.js.map +1 -0
- package/dist/src/parser/index.d.ts +8 -0
- package/dist/src/parser/index.d.ts.map +1 -0
- package/dist/src/parser/index.js +8 -0
- package/dist/src/parser/index.js.map +1 -0
- package/package.json +58 -0
- package/src/compiler/compile.ts +127 -0
- package/src/compiler/evaluate.ts +121 -0
- package/src/compiler/index.ts +2 -0
- package/src/compiler/options.ts +77 -0
- package/src/desmos.ts +13 -0
- package/src/errors.ts +46 -0
- package/src/index.ts +1 -0
- package/src/magic/.template.ts +22 -0
- package/src/magic/expr/index.ts +11 -0
- package/src/magic/expr/latex.ts +24 -0
- package/src/magic/expr/text.ts +19 -0
- package/src/magic/global/dark-mode.ts +17 -0
- package/src/magic/global/desmos.ts +20 -0
- package/src/magic/global/index.ts +13 -0
- package/src/magic/global/viewport.ts +25 -0
- package/src/magic/incantation.ts +142 -0
- package/src/magic/index.ts +6 -0
- package/src/magic/local/anim.ts +17 -0
- package/src/magic/local/colour.ts +38 -0
- package/src/magic/local/dashed.ts +16 -0
- package/src/magic/local/fill.ts +24 -0
- package/src/magic/local/hide.ts +16 -0
- package/src/magic/local/index.ts +27 -0
- package/src/magic/local/line.ts +29 -0
- package/src/magic/local/no-line.ts +16 -0
- package/src/magic/local/point.ts +29 -0
- package/src/magic/local/secret.ts +16 -0
- package/src/magic/local/slider.ts +27 -0
- package/src/parser/ast.ts +60 -0
- package/src/parser/desmost-parser.ts +486 -0
- package/src/parser/generic-parser.ts +191 -0
- package/src/parser/index.ts +8 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type DesmostOptions } from "./options";
|
|
2
|
+
import { Ast } from "../parser";
|
|
3
|
+
/**
|
|
4
|
+
* Compile Desmost into Desmos.
|
|
5
|
+
*
|
|
6
|
+
* This calls the Desmost compiler: parsing and evaluating `source`, then injecting the results into an existing `desmos` instance. Pass in `options` to customise compilation.
|
|
7
|
+
*
|
|
8
|
+
* ## Example
|
|
9
|
+
*
|
|
10
|
+
* ```ts
|
|
11
|
+
* let calc = Desmos.GraphingCalculator();
|
|
12
|
+
*
|
|
13
|
+
* compile(calc, `/text{ sup world! }`);
|
|
14
|
+
*
|
|
15
|
+
* compile(calc, `/slider{ error! } :: t = 0`, {
|
|
16
|
+
* errors: "crash",
|
|
17
|
+
* });
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare function compile(
|
|
21
|
+
/** The Desmos calculator instance to compile into. */
|
|
22
|
+
desmos: Desmos.Calculator,
|
|
23
|
+
/** The Desmost source code to compile. */
|
|
24
|
+
source: string,
|
|
25
|
+
/** Compilation options. */
|
|
26
|
+
options?: DesmostOptions): void | DesmostDebug;
|
|
27
|
+
interface DesmostDebug {
|
|
28
|
+
duration: number;
|
|
29
|
+
ast: Ast[];
|
|
30
|
+
}
|
|
31
|
+
export {};
|
|
32
|
+
//# sourceMappingURL=compile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../src/compiler/compile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAuB,MAAM,WAAW,CAAC;AAGrE,OAAO,EAAiB,GAAG,EAAE,MAAM,WAAW,CAAC;AAI/C;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,OAAO;AACrB,sDAAsD;AACtD,MAAM,EAAE,MAAM,CAAC,UAAU;AAEzB,0CAA0C;AAC1C,MAAM,EAAE,MAAM;AAEd,2BAA2B;AAC3B,OAAO,CAAC,EAAE,cAAc,GACvB,IAAI,GAAG,YAAY,CAsFrB;AAGD,UAAU,YAAY;IAEpB,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,GAAG,EAAE,CAAC;CACZ"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { set_default_options } from "./options";
|
|
2
|
+
import { evaluate_global_incantation, evaluate_expr, evaluate_error } from "./evaluate";
|
|
3
|
+
import { DesmostParser, Ast } from "../parser";
|
|
4
|
+
import { UnrecoverableError } from "../errors";
|
|
5
|
+
/**
|
|
6
|
+
* Compile Desmost into Desmos.
|
|
7
|
+
*
|
|
8
|
+
* This calls the Desmost compiler: parsing and evaluating `source`, then injecting the results into an existing `desmos` instance. Pass in `options` to customise compilation.
|
|
9
|
+
*
|
|
10
|
+
* ## Example
|
|
11
|
+
*
|
|
12
|
+
* ```ts
|
|
13
|
+
* let calc = Desmos.GraphingCalculator();
|
|
14
|
+
*
|
|
15
|
+
* compile(calc, `/text{ sup world! }`);
|
|
16
|
+
*
|
|
17
|
+
* compile(calc, `/slider{ error! } :: t = 0`, {
|
|
18
|
+
* errors: "crash",
|
|
19
|
+
* });
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export function compile(
|
|
23
|
+
/** The Desmos calculator instance to compile into. */
|
|
24
|
+
desmos,
|
|
25
|
+
/** The Desmost source code to compile. */
|
|
26
|
+
source,
|
|
27
|
+
/** Compilation options. */
|
|
28
|
+
options) {
|
|
29
|
+
if (desmos == undefined) {
|
|
30
|
+
console.error(`Desmost: No \`Desmos.Calculator\` instance provided, aborting compilation!`);
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
if (source == undefined) {
|
|
34
|
+
console.error(`Desmost: No source code provided, aborting compilation!`);
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
let t_init = performance.now();
|
|
38
|
+
let ast = [];
|
|
39
|
+
let opts = set_default_options(options);
|
|
40
|
+
let parser = new DesmostParser(source, opts);
|
|
41
|
+
/* To aggregate errors at the start, we need a target to retroactively inject errors into */
|
|
42
|
+
if (opts.place_errors === "start") {
|
|
43
|
+
desmos.setExpression({ id: "deferred-start", latex: "" });
|
|
44
|
+
}
|
|
45
|
+
let errors = [];
|
|
46
|
+
try {
|
|
47
|
+
while (true) {
|
|
48
|
+
let r = parser.parse_next();
|
|
49
|
+
if (r === null)
|
|
50
|
+
break;
|
|
51
|
+
if (opts.debug) {
|
|
52
|
+
ast.push(r);
|
|
53
|
+
}
|
|
54
|
+
let defer;
|
|
55
|
+
switch (r.kind) {
|
|
56
|
+
case Ast.Kind.INCANTATION_INVOCATION:
|
|
57
|
+
defer = evaluate_global_incantation(r, desmos, opts);
|
|
58
|
+
break;
|
|
59
|
+
case Ast.Kind.EXPRESSION:
|
|
60
|
+
defer = evaluate_expr(r, desmos, opts);
|
|
61
|
+
break;
|
|
62
|
+
case Ast.Kind.INVALID_INCANTATION:
|
|
63
|
+
defer = evaluate_error(r.error, desmos, opts);
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
if (defer !== undefined) {
|
|
67
|
+
errors.push(defer);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
catch (e) {
|
|
72
|
+
if (e instanceof UnrecoverableError) {
|
|
73
|
+
errors = [e.message];
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
throw e;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
if (errors.length > 0) {
|
|
80
|
+
let expr = {
|
|
81
|
+
type: "text",
|
|
82
|
+
text: errors.join("\n\n"),
|
|
83
|
+
};
|
|
84
|
+
switch (opts.place_errors) {
|
|
85
|
+
case "start":
|
|
86
|
+
desmos.setExpression({ ...expr, id: "deferred-start" });
|
|
87
|
+
break;
|
|
88
|
+
case "end":
|
|
89
|
+
case "inline":
|
|
90
|
+
desmos.setExpression(expr);
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
if (opts.debug) {
|
|
95
|
+
return {
|
|
96
|
+
duration: performance.now() - t_init,
|
|
97
|
+
ast,
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=compile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compile.js","sourceRoot":"","sources":["../../src/compiler/compile.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { DesmostOptions } from "./options";
|
|
2
|
+
import { Ast } from "../parser";
|
|
3
|
+
import { UnrecoverableError, type Unrecoverable } from "../errors";
|
|
4
|
+
/**
|
|
5
|
+
* Evaluate arguments (if any) to a global incantation `invocation`, then apply the incantation to `desmos`.
|
|
6
|
+
*/
|
|
7
|
+
export declare function evaluate_global_incantation(invocation: Ast.IncantationInvocation, desmos: Desmos.Calculator, options: Required<DesmostOptions>): Unrecoverable<void | string>;
|
|
8
|
+
/**
|
|
9
|
+
* Evaluate arguments (if any) to local incantation invocations on `expr`, then add `expr` to `desmos`.
|
|
10
|
+
*/
|
|
11
|
+
export declare function evaluate_expr(expr: Ast.Expression, desmos: Desmos.Calculator, options: Required<DesmostOptions>): Unrecoverable<void | string>;
|
|
12
|
+
/**
|
|
13
|
+
* Handle an `InvalidInvocation`, respecting the user's preferences in `options`.
|
|
14
|
+
*
|
|
15
|
+
* If the user set `place_errors: start` or `place_errors: end`, this returns the formatted error message for deferred aggregation.
|
|
16
|
+
*/
|
|
17
|
+
export declare function evaluate_error(error: UnrecoverableError, desmos: Desmos.Calculator, options: Required<DesmostOptions>): Unrecoverable<void | string>;
|
|
18
|
+
//# sourceMappingURL=evaluate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evaluate.d.ts","sourceRoot":"","sources":["../../src/compiler/evaluate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAEhD,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAChC,OAAO,EAAE,kBAAkB,EAAE,KAAK,aAAa,EAAE,MAAM,WAAW,CAAC;AAGnE;;GAEG;AACH,wBAAgB,2BAA2B,CACzC,UAAU,EAAE,GAAG,CAAC,qBAAqB,EACrC,MAAM,EAAE,MAAM,CAAC,UAAU,EACzB,OAAO,EAAE,QAAQ,CAAC,cAAc,CAAC,GAChC,aAAa,CAAC,IAAI,GAAG,MAAM,CAAC,CAiB9B;AAGD;;GAEG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,GAAG,CAAC,UAAU,EACpB,MAAM,EAAE,MAAM,CAAC,UAAU,EACzB,OAAO,EAAE,QAAQ,CAAC,cAAc,CAAC,GAChC,aAAa,CAAC,IAAI,GAAG,MAAM,CAAC,CAgC9B;AAGD;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,kBAAkB,EACzB,MAAM,EAAE,MAAM,CAAC,UAAU,EACzB,OAAO,EAAE,QAAQ,CAAC,cAAc,CAAC,GAChC,aAAa,CAAC,IAAI,GAAG,MAAM,CAAC,CAuB9B"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { Ast } from "../parser";
|
|
2
|
+
import { UnrecoverableError } from "../errors";
|
|
3
|
+
/**
|
|
4
|
+
* Evaluate arguments (if any) to a global incantation `invocation`, then apply the incantation to `desmos`.
|
|
5
|
+
*/
|
|
6
|
+
export function evaluate_global_incantation(invocation, desmos, options) {
|
|
7
|
+
let data = undefined;
|
|
8
|
+
if ("arg_raw" in invocation && invocation.arg_raw != undefined) {
|
|
9
|
+
try {
|
|
10
|
+
data = invocation.incantation.evaluate_arg(invocation.arg_raw);
|
|
11
|
+
}
|
|
12
|
+
catch (e) {
|
|
13
|
+
let msg = evaluate_error(e, desmos, options);
|
|
14
|
+
if (msg != undefined) {
|
|
15
|
+
return msg;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
invocation.incantation.apply(desmos, data);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Evaluate arguments (if any) to local incantation invocations on `expr`, then add `expr` to `desmos`.
|
|
23
|
+
*/
|
|
24
|
+
export function evaluate_expr(expr, desmos, options) {
|
|
25
|
+
let errors = [];
|
|
26
|
+
for (let invocation of expr.incantations) {
|
|
27
|
+
if (invocation.kind === Ast.Kind.INVALID_INCANTATION) {
|
|
28
|
+
let msg = evaluate_error(invocation.error, desmos, { ...options, place_errors: "start" });
|
|
29
|
+
if (msg != undefined) {
|
|
30
|
+
errors.push(msg);
|
|
31
|
+
}
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
let data = undefined;
|
|
35
|
+
if ("arg_raw" in invocation && invocation.arg_raw != undefined) {
|
|
36
|
+
try {
|
|
37
|
+
data = invocation.incantation.evaluate_arg(invocation.arg_raw);
|
|
38
|
+
}
|
|
39
|
+
catch (e) {
|
|
40
|
+
errors.push(format_error(e, options));
|
|
41
|
+
if (invocation.incantation.requires_arg)
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
invocation.incantation.apply(expr.data, data);
|
|
46
|
+
}
|
|
47
|
+
if (errors.length > 0) {
|
|
48
|
+
desmos.setExpression({ type: "text", text: errors.join("\n\n") });
|
|
49
|
+
}
|
|
50
|
+
desmos.setExpression(expr.data);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Handle an `InvalidInvocation`, respecting the user's preferences in `options`.
|
|
54
|
+
*
|
|
55
|
+
* If the user set `place_errors: start` or `place_errors: end`, this returns the formatted error message for deferred aggregation.
|
|
56
|
+
*/
|
|
57
|
+
export function evaluate_error(error, desmos, options) {
|
|
58
|
+
switch (options.errors) {
|
|
59
|
+
case "crash":
|
|
60
|
+
throw error;
|
|
61
|
+
case "suppress":
|
|
62
|
+
console.error(error);
|
|
63
|
+
break;
|
|
64
|
+
default: switch (options.place_errors) {
|
|
65
|
+
case "end":
|
|
66
|
+
case "start":
|
|
67
|
+
return format_error(error, options);
|
|
68
|
+
default:
|
|
69
|
+
desmos.setExpression({
|
|
70
|
+
type: "text",
|
|
71
|
+
text: format_error(error, options),
|
|
72
|
+
});
|
|
73
|
+
break;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
function format_error(e, options) {
|
|
78
|
+
let prefix = options.error_prefix;
|
|
79
|
+
let sep = (prefix === "" || prefix.endsWith("\n")) ? "" : " ";
|
|
80
|
+
return `${prefix}${sep}${e.name}: ${e.message}`;
|
|
81
|
+
// TODO maybe include stack? (configurable?)
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=evaluate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evaluate.js","sourceRoot":"","sources":["../../src/compiler/evaluate.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/compiler/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,YAAY,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/compiler/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/** Options to customise Desmost compilation. */
|
|
2
|
+
export interface DesmostOptions {
|
|
3
|
+
/**
|
|
4
|
+
* How should errors be *surfaced*?
|
|
5
|
+
*
|
|
6
|
+
* Errors will always be logged to console for the developer; this setting affects how they visually reach the end user.
|
|
7
|
+
*
|
|
8
|
+
* - `surface` (default): Blocks that result in errors will become Desmos text expressions containing the error message, leaving other expressions unaffected.
|
|
9
|
+
* - `crash`: The entire compilation to Desmos will terminate with a single error message. This means you don't get any output at all, but errors are also immediately obvious.
|
|
10
|
+
* - `suppress`: Silently fail on the frontend (if you wish to give the illusion that everything is fine).
|
|
11
|
+
*/
|
|
12
|
+
errors?: "surface" | "crash" | "suppress";
|
|
13
|
+
/**
|
|
14
|
+
* Where should errors be placed?
|
|
15
|
+
*
|
|
16
|
+
* - `inline` (default): Alongside or in place of the expression that produced it.
|
|
17
|
+
* - `end`: All aggregated at the end of the Desmos expressions list.
|
|
18
|
+
* - `start`: All aggregated at the start of the Desmos expressions list.
|
|
19
|
+
*/
|
|
20
|
+
place_errors?: "inline" | "end" | "start";
|
|
21
|
+
/**
|
|
22
|
+
* The prefix to prepend to error blocks. Defaults to `[DESMOST ERROR]\n`. Provide a blank string if you wish for no prefix to be added.
|
|
23
|
+
*/
|
|
24
|
+
error_prefix?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Should comments be ignored, instead of turned into text expressions?
|
|
27
|
+
*
|
|
28
|
+
* Defaults to `false`, meaning comments are kept.
|
|
29
|
+
*/
|
|
30
|
+
ignore_comments?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Should all line breaks be ignored, instead of kept as blank expressions.
|
|
33
|
+
*
|
|
34
|
+
* Defaults to `false`, meaning all blank lines are kept.
|
|
35
|
+
*/
|
|
36
|
+
ignore_line_breaks?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Should trailing blank lines at the end of the source be ignored, instead of kept as blank expressions?
|
|
39
|
+
*
|
|
40
|
+
* Defaults to `false`, meaning trailing blank lines are kept.
|
|
41
|
+
*/
|
|
42
|
+
ignore_trailing_blanks?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Return debug diagnostics? This includes the unevaluated AST, and performance diagnostics.
|
|
45
|
+
*
|
|
46
|
+
* Defaults to `false`.
|
|
47
|
+
*/
|
|
48
|
+
debug?: boolean;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Fill in `options` with Desmost's defaults to produce a complete `DesmostOptions` config.
|
|
52
|
+
*/
|
|
53
|
+
export declare function set_default_options(options: Partial<DesmostOptions> | undefined): Required<DesmostOptions>;
|
|
54
|
+
//# sourceMappingURL=options.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/compiler/options.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,MAAM,WAAW,cAAc;IAE7B;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAE,SAAS,GAAG,OAAO,GAAG,UAAU,CAAA;IAEzC;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,QAAQ,GAAG,KAAK,GAAG,OAAO,CAAA;IAEzC;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;IAErB;;;;OAIG;IACH,eAAe,CAAC,EAAE,OAAO,CAAA;IAEzB;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAE5B;;;;OAIG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAA;IAEhC;;;;OAIG;IACH,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB;AAGD;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,cAAc,CAAC,GAAG,SAAS,GAAG,QAAQ,CAAC,cAAc,CAAC,CAe1G"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fill in `options` with Desmost's defaults to produce a complete `DesmostOptions` config.
|
|
3
|
+
*/
|
|
4
|
+
export function set_default_options(options) {
|
|
5
|
+
options ??= {};
|
|
6
|
+
options.errors ??= "surface";
|
|
7
|
+
options.place_errors ??= "inline";
|
|
8
|
+
options.error_prefix ??= "[DESMOST ERROR]\n";
|
|
9
|
+
options.ignore_comments ??= false;
|
|
10
|
+
options.ignore_line_breaks ??= false;
|
|
11
|
+
options.ignore_trailing_blanks ??= false;
|
|
12
|
+
options.debug ??= false;
|
|
13
|
+
return options;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"options.js","sourceRoot":"","sources":["../../src/compiler/options.ts"],"names":[],"mappings":"AA0DA;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,OAA4C;IAE9E,OAAO,KAAK,EAAE,CAAC;IAEf,OAAO,CAAC,MAAM,KAAK,SAAS,CAAC;IAC7B,OAAO,CAAC,YAAY,KAAK,QAAQ,CAAC;IAClC,OAAO,CAAC,YAAY,KAAK,mBAAmB,CAAC;IAE7C,OAAO,CAAC,eAAe,KAAK,KAAK,CAAC;IAClC,OAAO,CAAC,kBAAkB,KAAK,KAAK,CAAC;IACrC,OAAO,CAAC,sBAAsB,KAAK,KAAK,CAAC;IAEzC,OAAO,CAAC,KAAK,KAAK,KAAK,CAAC;IAExB,OAAO,OAAmC,CAAC;AAC7C,CAAC"}
|
package/dist/desmos.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Desmos API (currently) is browser-only, so we polyfill the API objects we need here for the server-side.
|
|
3
|
+
*/
|
|
4
|
+
export declare enum DesmosColour {
|
|
5
|
+
RED = "#c74440",
|
|
6
|
+
BLUE = "#2d70b3",
|
|
7
|
+
GREEN = "#388c46",
|
|
8
|
+
PURPLE = "#6042a6",
|
|
9
|
+
ORANGE = "#fa7e19",
|
|
10
|
+
BLACK = "#000000"
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=desmos.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"desmos.d.ts","sourceRoot":"","sources":["../src/desmos.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,oBAAY,YAAY;IAEtB,GAAG,YAAe;IAClB,IAAI,YAAc;IAClB,KAAK,YAAa;IAClB,MAAM,YAAY;IAClB,MAAM,YAAY;IAClB,KAAK,YAAa;CACnB"}
|
package/dist/desmos.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Desmos API (currently) is browser-only, so we polyfill the API objects we need here for the server-side.
|
|
3
|
+
*/
|
|
4
|
+
export var DesmosColour;
|
|
5
|
+
(function (DesmosColour) {
|
|
6
|
+
DesmosColour["RED"] = "#c74440";
|
|
7
|
+
DesmosColour["BLUE"] = "#2d70b3";
|
|
8
|
+
DesmosColour["GREEN"] = "#388c46";
|
|
9
|
+
DesmosColour["PURPLE"] = "#6042a6";
|
|
10
|
+
DesmosColour["ORANGE"] = "#fa7e19";
|
|
11
|
+
DesmosColour["BLACK"] = "#000000";
|
|
12
|
+
})(DesmosColour || (DesmosColour = {}));
|
|
13
|
+
//# sourceMappingURL=desmos.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"desmos.js","sourceRoot":"","sources":["../src/desmos.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,CAAN,IAAY,YAQX;AARD,WAAY,YAAY;IAEtB,+BAAkB,CAAA;IAClB,gCAAkB,CAAA;IAClB,iCAAkB,CAAA;IAClB,kCAAkB,CAAA;IAClB,kCAAkB,CAAA;IAClB,iCAAkB,CAAA;AACpB,CAAC,EARW,YAAY,KAAZ,YAAY,QAQvB"}
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The compiler encountered a fatal unrecoverable error, which will reach the end user.
|
|
3
|
+
*
|
|
4
|
+
* It's not *literally* unrecoverable in the sense that it will crash the compiler completely, but it means there are no further fallbacks to try.
|
|
5
|
+
*/
|
|
6
|
+
export declare class UnrecoverableError extends Error {
|
|
7
|
+
}
|
|
8
|
+
export declare namespace UnrecoverableError {
|
|
9
|
+
/** The parser unexpectedly reached the end of its entire input source code. */
|
|
10
|
+
class UnexpectedEnd extends UnrecoverableError {
|
|
11
|
+
}
|
|
12
|
+
/** The parser did not receive input that it expected. */
|
|
13
|
+
class MissingInput extends UnrecoverableError {
|
|
14
|
+
}
|
|
15
|
+
/** The parser received input that did not match what it expected. */
|
|
16
|
+
class UnexpectedInput extends UnrecoverableError {
|
|
17
|
+
}
|
|
18
|
+
/** The parser received excess input that it did not expect. */
|
|
19
|
+
class ExcessInput extends UnrecoverableError {
|
|
20
|
+
}
|
|
21
|
+
/** An incantation can't be applied here. */
|
|
22
|
+
class IllegalIncantation extends UnrecoverableError {
|
|
23
|
+
}
|
|
24
|
+
/** An incantation's argument couldn't be parsed. */
|
|
25
|
+
class InvalidArgument extends UnrecoverableError {
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
/** The compiler encountered a non-fatal recoverable failure (usually during speculative parsing), which only results in internal backtracking. */
|
|
29
|
+
export declare class RecoverableFail {
|
|
30
|
+
}
|
|
31
|
+
/** Indicates that a function may throw a `RecoverableFail`. */
|
|
32
|
+
export type Recoverable<Result> = Result | (Result & {
|
|
33
|
+
readonly __brand?: unique symbol;
|
|
34
|
+
});
|
|
35
|
+
/** Indicates that a function may throw an `UnrecoverableError`. */
|
|
36
|
+
export type Unrecoverable<Result> = Result | (Result & {
|
|
37
|
+
readonly __brand?: unique symbol;
|
|
38
|
+
});
|
|
39
|
+
/**
|
|
40
|
+
* Indicates that a function may throw either a `RecoverableFail` *or* an `UnrecoverableError`.
|
|
41
|
+
*
|
|
42
|
+
* This is used in potentially ambiguous cases. For instance, the user might have invoked an unknown incantation, in which case we might want to `RecoverableFail` and fallback to parsing it as LaTeX; on the other hand, if they invoked a valid incantation, but did not supply the required argument, that's a definite `UnrecoverableError`.
|
|
43
|
+
*/
|
|
44
|
+
export type MaybeRecoverable<Result> = Recoverable<Result> | Unrecoverable<Result>;
|
|
45
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,qBAAa,kBAAmB,SAAQ,KAAK;CAAG;AAEhD,yBAAiB,kBAAkB,CACnC;IACE,+EAA+E;IAC/E,MAAa,aAAc,SAAQ,kBAAkB;KAAG;IAExD,yDAAyD;IACzD,MAAa,YAAa,SAAQ,kBAAkB;KAAG;IAEvD,qEAAqE;IACrE,MAAa,eAAgB,SAAQ,kBAAkB;KAAG;IAE1D,+DAA+D;IAC/D,MAAa,WAAY,SAAQ,kBAAkB;KAAG;IAGtD,4CAA4C;IAC5C,MAAa,kBAAmB,SAAQ,kBAAkB;KAAG;IAE7D,oDAAoD;IACpD,MAAa,eAAgB,SAAQ,kBAAkB;KAAG;CAC3D;AAGD,kJAAkJ;AAClJ,qBAAa,eAAe;CAAG;AAG/B,+DAA+D;AAC/D,MAAM,MAAM,WAAW,CAAC,MAAM,IAAI,MAAM,IAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,MAAM,CAAA;CAAE,CAAA,CAAC;AAEzF,mEAAmE;AACnE,MAAM,MAAM,aAAa,CAAC,MAAM,IAAI,MAAM,IAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,MAAM,CAAA;CAAE,CAAA,CAAC;AAE3F;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,CAAC,MAAM,IAAI,WAAW,CAAC,MAAM,CAAC,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC"}
|
package/dist/errors.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The compiler encountered a fatal unrecoverable error, which will reach the end user.
|
|
3
|
+
*
|
|
4
|
+
* It's not *literally* unrecoverable in the sense that it will crash the compiler completely, but it means there are no further fallbacks to try.
|
|
5
|
+
*/
|
|
6
|
+
export class UnrecoverableError extends Error {
|
|
7
|
+
}
|
|
8
|
+
(function (UnrecoverableError) {
|
|
9
|
+
/** The parser unexpectedly reached the end of its entire input source code. */
|
|
10
|
+
class UnexpectedEnd extends UnrecoverableError {
|
|
11
|
+
}
|
|
12
|
+
UnrecoverableError.UnexpectedEnd = UnexpectedEnd;
|
|
13
|
+
/** The parser did not receive input that it expected. */
|
|
14
|
+
class MissingInput extends UnrecoverableError {
|
|
15
|
+
}
|
|
16
|
+
UnrecoverableError.MissingInput = MissingInput;
|
|
17
|
+
/** The parser received input that did not match what it expected. */
|
|
18
|
+
class UnexpectedInput extends UnrecoverableError {
|
|
19
|
+
}
|
|
20
|
+
UnrecoverableError.UnexpectedInput = UnexpectedInput;
|
|
21
|
+
/** The parser received excess input that it did not expect. */
|
|
22
|
+
class ExcessInput extends UnrecoverableError {
|
|
23
|
+
}
|
|
24
|
+
UnrecoverableError.ExcessInput = ExcessInput;
|
|
25
|
+
/** An incantation can't be applied here. */
|
|
26
|
+
class IllegalIncantation extends UnrecoverableError {
|
|
27
|
+
}
|
|
28
|
+
UnrecoverableError.IllegalIncantation = IllegalIncantation;
|
|
29
|
+
/** An incantation's argument couldn't be parsed. */
|
|
30
|
+
class InvalidArgument extends UnrecoverableError {
|
|
31
|
+
}
|
|
32
|
+
UnrecoverableError.InvalidArgument = InvalidArgument;
|
|
33
|
+
})(UnrecoverableError || (UnrecoverableError = {}));
|
|
34
|
+
/** The compiler encountered a non-fatal recoverable failure (usually during speculative parsing), which only results in internal backtracking. */
|
|
35
|
+
export class RecoverableFail {
|
|
36
|
+
}
|
|
37
|
+
;
|
|
38
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,OAAO,kBAAmB,SAAQ,KAAK;CAAG;AAEhD,WAAiB,kBAAkB;IAEjC,+EAA+E;IAC/E,MAAa,aAAc,SAAQ,kBAAkB;KAAG;IAA3C,mBAAA,aAAa,gBAA8B,CAAA;IAExD,yDAAyD;IACzD,MAAa,YAAa,SAAQ,kBAAkB;KAAG;IAA1C,mBAAA,YAAY,eAA8B,CAAA;IAEvD,qEAAqE;IACrE,MAAa,eAAgB,SAAQ,kBAAkB;KAAG;IAA7C,mBAAA,eAAe,kBAA8B,CAAA;IAE1D,+DAA+D;IAC/D,MAAa,WAAY,SAAQ,kBAAkB;KAAG;IAAzC,mBAAA,WAAW,cAA8B,CAAA;IAGtD,4CAA4C;IAC5C,MAAa,kBAAmB,SAAQ,kBAAkB;KAAG;IAAhD,mBAAA,kBAAkB,qBAA8B,CAAA;IAE7D,oDAAoD;IACpD,MAAa,eAAgB,SAAQ,kBAAkB;KAAG;IAA7C,mBAAA,eAAe,kBAA8B,CAAA;AAC5D,CAAC,EApBgB,kBAAkB,KAAlB,kBAAkB,QAoBlC;AAGD,kJAAkJ;AAClJ,MAAM,OAAO,eAAe;CAAG;AAO4D,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAuB,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/magic/expr/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,KAAK,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAM3D,eAAO,MAAM,iBAAiB,EAAE,cAAc,CAAC,IAAI,CAAC,EAInD,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ArgIncantation } from "../incantation";
|
|
2
|
+
import { LatexIncantation } from "./latex";
|
|
3
|
+
import { TextIncantation } from "./text";
|
|
4
|
+
export const EXPR_INCANTATIONS = [
|
|
5
|
+
new LatexIncantation(),
|
|
6
|
+
new TextIncantation(),
|
|
7
|
+
];
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/magic/expr/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAa,MAAM,gBAAgB,CAAC;AAE3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAGzC,MAAM,CAAC,MAAM,iBAAiB,GAC9B;IACE,IAAI,gBAAgB,EAAE;IACtB,IAAI,eAAe,EAAE;CACtB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Incantation, ArgIncantation, type EXPR } from "../incantation";
|
|
2
|
+
export declare class LatexIncantation extends ArgIncantation<EXPR> {
|
|
3
|
+
readonly description = "Produce a LaTeX expression. This allows the input to span multiple lines.";
|
|
4
|
+
readonly identifier = "latex";
|
|
5
|
+
readonly requires_arg = true;
|
|
6
|
+
readonly arg_type = Incantation.ArgType.LATEX;
|
|
7
|
+
apply(target: Desmos.ExpressionState, data: string): void;
|
|
8
|
+
evaluate_arg(data: string): string;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=latex.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"latex.d.ts","sourceRoot":"","sources":["../../../src/magic/expr/latex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,KAAK,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAGxE,qBAAa,gBAAiB,SAAQ,cAAc,CAAC,IAAI,CAAC;IAExD,SAAkB,WAAW,+EACkD;IAE/E,SAAkB,UAAU,WAAY;IACxC,SAAkB,YAAY,QAAO;IACrC,SAAkB,QAAQ,6BAAgC;IAE1D,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,eAAe,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAKxD;IAEQ,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAG1C;CACF"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Incantation, ArgIncantation } from "../incantation";
|
|
2
|
+
export class LatexIncantation extends ArgIncantation {
|
|
3
|
+
description = "Produce a LaTeX expression. This allows the input to span multiple lines.";
|
|
4
|
+
identifier = "latex";
|
|
5
|
+
requires_arg = true;
|
|
6
|
+
arg_type = Incantation.ArgType.LATEX;
|
|
7
|
+
apply(target, data) {
|
|
8
|
+
target.type = "expression";
|
|
9
|
+
// @ts-expect-error: outdated types
|
|
10
|
+
target.latex = data;
|
|
11
|
+
}
|
|
12
|
+
evaluate_arg(data) {
|
|
13
|
+
return data;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=latex.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"latex.js","sourceRoot":"","sources":["../../../src/magic/expr/latex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAa,MAAM,gBAAgB,CAAC;AAGxE,MAAM,OAAO,gBAAiB,SAAQ,cAAoB;IAEtC,WAAW,GACzB,2EAA2E,CAAA;IAE7D,UAAU,GAAK,OAAO,CAAA;IACtB,YAAY,GAAG,IAAI,CAAA;IACnB,QAAQ,GAAO,WAAW,CAAC,OAAO,CAAC,KAAK,CAAA;IAE1D,KAAK,CAAC,MAA8B,EAAE,IAAY;QAEhD,MAAM,CAAC,IAAI,GAAG,YAAY,CAAC;QAC3B,mCAAmC;QACnC,MAAM,CAAC,KAAK,GAAG,IAAI,CAAC;IACtB,CAAC;IAEQ,YAAY,CAAC,IAAY;QAEhC,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Incantation, ArgIncantation, type EXPR } from "../incantation";
|
|
2
|
+
export declare class TextIncantation extends ArgIncantation<EXPR> {
|
|
3
|
+
readonly description = "Produce a text expression (\u201CAdd Note\u201D in the Desmos GUI).";
|
|
4
|
+
readonly identifier = "text";
|
|
5
|
+
readonly requires_arg = true;
|
|
6
|
+
readonly arg_type = Incantation.ArgType.STRING;
|
|
7
|
+
apply(target: Desmos.ExpressionState, data: string): void;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=text.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../../src/magic/expr/text.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,KAAK,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAGxE,qBAAa,eAAgB,SAAQ,cAAc,CAAC,IAAI,CAAC;IAEvD,SAAkB,WAAW,yEACkC;IAE/D,SAAkB,UAAU,UAAW;IACvC,SAAkB,YAAY,QAAO;IACrC,SAAkB,QAAQ,8BAAiC;IAElD,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,eAAe,EAAE,IAAI,EAAE,MAAM,QAK1D;CACF"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Incantation, ArgIncantation } from "../incantation";
|
|
2
|
+
export class TextIncantation extends ArgIncantation {
|
|
3
|
+
description = "Produce a text expression (“Add Note” in the Desmos GUI).";
|
|
4
|
+
identifier = "text";
|
|
5
|
+
requires_arg = true;
|
|
6
|
+
arg_type = Incantation.ArgType.STRING;
|
|
7
|
+
apply(target, data) {
|
|
8
|
+
target.type = "text";
|
|
9
|
+
// @ts-expect-error: outdated types
|
|
10
|
+
target.text = data;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=text.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text.js","sourceRoot":"","sources":["../../../src/magic/expr/text.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAa,MAAM,gBAAgB,CAAC;AAGxE,MAAM,OAAO,eAAgB,SAAQ,cAAoB;IAErC,WAAW,GACzB,2DAA2D,CAAA;IAE7C,UAAU,GAAK,MAAM,CAAA;IACrB,YAAY,GAAG,IAAI,CAAA;IACnB,QAAQ,GAAO,WAAW,CAAC,OAAO,CAAC,MAAM,CAAA;IAElD,KAAK,CAAC,MAA8B,EAAE,IAAY;QAEzD,MAAM,CAAC,IAAI,GAAG,MAAM,CAAC;QACrB,mCAAmC;QACnC,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC;IACrB,CAAC;CACF"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Incantation, type GLOBAL } from "../incantation";
|
|
2
|
+
export declare class DarkModeIncantation extends Incantation<GLOBAL> {
|
|
3
|
+
readonly description = "Enable dark mode for the calculator, which inverts all colours.";
|
|
4
|
+
readonly identifier = "dark";
|
|
5
|
+
apply(target: Desmos.Calculator): void;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=dark-mode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dark-mode.d.ts","sourceRoot":"","sources":["../../../src/magic/global/dark-mode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,KAAK,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAG1D,qBAAa,mBAAoB,SAAQ,WAAW,CAAC,MAAM,CAAC;IAE1D,SAAkB,WAAW,qEACwC;IAErE,SAAkB,UAAU,UAAS;IAErC,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,UAAU,QAK9B;CACF"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Incantation } from "../incantation";
|
|
2
|
+
export class DarkModeIncantation extends Incantation {
|
|
3
|
+
description = "Enable dark mode for the calculator, which inverts all colours.";
|
|
4
|
+
identifier = "dark";
|
|
5
|
+
apply(target) {
|
|
6
|
+
target.updateSettings({
|
|
7
|
+
invertedColors: true,
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=dark-mode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dark-mode.js","sourceRoot":"","sources":["../../../src/magic/global/dark-mode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAe,MAAM,gBAAgB,CAAC;AAG1D,MAAM,OAAO,mBAAoB,SAAQ,WAAmB;IAExC,WAAW,GACzB,iEAAiE,CAAA;IAEnD,UAAU,GAAG,MAAM,CAAA;IAErC,KAAK,CAAC,MAAyB;QAE7B,MAAM,CAAC,cAAc,CAAC;YACpB,cAAc,EAAE,IAAI;SACrB,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Incantation, ArgIncantation, type GLOBAL } from "../incantation";
|
|
2
|
+
export declare class DesmosIncantation extends ArgIncantation<GLOBAL> {
|
|
3
|
+
readonly description = "Set the configuration of the calculator via `Calculator.updateSettings()`.";
|
|
4
|
+
readonly identifier = "desmos";
|
|
5
|
+
readonly requires_arg = false;
|
|
6
|
+
readonly arg_type = Incantation.ArgType.OBJECT;
|
|
7
|
+
apply(target: Desmos.Calculator, data: Desmos.GraphConfiguration & Desmos.GraphSettings): void;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=desmos.d.ts.map
|