@mark1russell7/vex-compiler 0.10.0 → 0.11.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/build/index.d.ts.map +1 -1
- package/build/index.js +14 -6
- package/build/index.js.map +1 -1
- package/package.json +4 -4
- package/src/facts.ts +10 -5
- package/src/lower.ts +1 -0
- package/src/module.ts +3 -3
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/facts.ts","../src/loop.ts","../src/tiers.ts","../src/module.ts","../src/runtime.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/facts.ts","../src/loop.ts","../src/tiers.ts","../src/module.ts","../src/runtime.ts"],"mappings":";;;KAqCY,aAAa;;;;;KAMb,OAAO;;;;;UAYF;WACN,SAAS,SAAS,eAAe;WACjC,OAAO,SAAS,eAAe;;;UAIzB;WACN,mBAAmB;WACnB,MAAM,SAAS,eAAe;WAC9B,aAAa,SAAS,eAAe;WACrC,SAAS;;;;;KC9CR;;KAeA;;KA2BA;WACG;WAAqB;;WACrB;WAAqB;;WACrB;WAAmB;;WACnB;WAAoB;;WACpB;;WACA;WAAqB,gBAAgB;;WACrC;WAAoB,IAAI;WAAiB,eAAe;;WACxD;WAAoB,IAAI;WAAoB,eAAe;;WAK3D;WAAkB;WAAuB,eAAe;WAAkB,iBAAiB;;WAE3F;WAAoB;;WAEpB;WAAuB;WAAuB,gBAAgB,OAAO,OAAO;;;;;;;;;;;KAW/E;WACG;;WACA;WAAwB;WAAwB;aAAoB,MAAM;aAAgB,MAAM;;;WAChG;WAAqB;;;KAGxB;WAEG;WAAmB;WAAoB,OAAO;;WAE9C;WAAmB;WAAoB,OAAO;;WAE9C;WAAqB,IAAI;WAAgB;WAAyB,MAAM;;WAExE;WAAoB,MAAM;;WAC1B;WAAkB,MAAM;WAAgB,cAAc;WAAkB,aAAa;;WAK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cAAc,gBAAgB;;EAEnC,QAAQ;;EAER,OAAO,gBAAgB;;EAEvB,MAAM,kBAAkB;EACxB,KAAK,cAAc,cAAc;EACjC,OAAO;EACP,KAAK;EACL,IAAI,0BAA0B;EAC9B,KAAK,yBAAyB;EAC9B,OAAO;EACP,IAAI,cAAc,eAAe,GAAG,OAAO,gBAAgB,eAAe;EAC1E,IAAI,MAAM,SAAS,sCAAsC;;;wBAI3C,cAAc,SAAS,iBAAiB"}
|
package/build/index.js
CHANGED
|
@@ -10,7 +10,10 @@ import { MAX_NESTING, addrExprs, axisTargets, children, compile, findMethod, fix
|
|
|
10
10
|
* twice doubles its body, so a chain of such functions grows fast. A module prints each function once.
|
|
11
11
|
*/
|
|
12
12
|
const MAX_CALLS = 1e4;
|
|
13
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* The list ops that give a list, or read a position or a key of a list (LIST.SORT, LIST.TAKE, LIST.NTH, LIST.BUILD,
|
|
15
|
+
* LIST.GET).
|
|
16
|
+
*/
|
|
14
17
|
const ORDER_OPS = /* @__PURE__ */ new Set([
|
|
15
18
|
"sortBy",
|
|
16
19
|
"take",
|
|
@@ -18,17 +21,20 @@ const ORDER_OPS = /* @__PURE__ */ new Set([
|
|
|
18
21
|
"drop",
|
|
19
22
|
"append",
|
|
20
23
|
"flat",
|
|
21
|
-
"without"
|
|
24
|
+
"without",
|
|
25
|
+
"get"
|
|
22
26
|
]);
|
|
23
27
|
/**
|
|
24
|
-
* This function gives the reason that tier 2 cannot take a program with lists as values. The reason is the axis `list
|
|
25
|
-
*
|
|
28
|
+
* This function gives the reason that tier 2 cannot take a program with lists as values. The reason is the axis `list`,
|
|
29
|
+
* an op on the order or the keys of a list, or a list literal. Tier 1 evaluates such a program. It uses a stack, not
|
|
30
|
+
* recursion.
|
|
26
31
|
*/
|
|
27
32
|
function listReason(expr) {
|
|
28
33
|
const todo = [expr];
|
|
29
34
|
for (let x = todo.pop(); x !== void 0; x = todo.pop()) {
|
|
30
35
|
if ((x.tag === "each" || x.tag === "fold") && listOf(x.axis) !== void 0) return "the program has the axis \"list\", and tier 2 does not have lists as values yet";
|
|
31
36
|
if (x.tag === "app" && ORDER_OPS.has(x.op)) return `the program has the list op "${x.op}", and tier 2 does not have lists as values yet`;
|
|
37
|
+
if (x.tag === "lit" && isVexList(x.value)) return "the program has a list literal, and tier 2 does not have lists as values yet";
|
|
32
38
|
todo.push(...children(x));
|
|
33
39
|
}
|
|
34
40
|
}
|
|
@@ -1332,6 +1338,7 @@ var Lowerer = class {
|
|
|
1332
1338
|
case "append":
|
|
1333
1339
|
case "flat":
|
|
1334
1340
|
case "without":
|
|
1341
|
+
case "get":
|
|
1335
1342
|
/* v8 ignore next -- @preserve */
|
|
1336
1343
|
throw new Unsupported(`the list op "${op}"`);
|
|
1337
1344
|
}
|
|
@@ -2058,12 +2065,13 @@ const BOOLEAN_LIST_OPS = /* @__PURE__ */ new Set([
|
|
|
2058
2065
|
"all",
|
|
2059
2066
|
"none"
|
|
2060
2067
|
]);
|
|
2061
|
-
/** The list ops that build a list from lists (LIST.BUILD). A module gives a reason for them. */
|
|
2068
|
+
/** The list ops that build a list from lists (LIST.BUILD), and `get` (LIST.GET). A module gives a reason for them. */
|
|
2062
2069
|
const BUILD_OPS = /* @__PURE__ */ new Set([
|
|
2063
2070
|
"drop",
|
|
2064
2071
|
"append",
|
|
2065
2072
|
"flat",
|
|
2066
|
-
"without"
|
|
2073
|
+
"without",
|
|
2074
|
+
"get"
|
|
2067
2075
|
]);
|
|
2068
2076
|
/** This function gives the kind of the result of a list op: first gives the kind of its items. */
|
|
2069
2077
|
const listKind = (op, item) => NUMBER_LIST_OPS.has(op) ? "number" : BOOLEAN_LIST_OPS.has(op) ? "boolean" : item;
|