@jbrowse/jexl 3.3.0 → 4.0.1
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/Expression.js +1 -2
- package/dist/Expression.js.map +1 -1
- package/dist/Jexl.d.ts +2 -2
- package/dist/Lexer.d.ts +10 -8
- package/dist/Lexer.js +46 -35
- package/dist/Lexer.js.map +1 -1
- package/dist/evaluator/compile.d.ts +6 -4
- package/dist/evaluator/compile.js +91 -55
- package/dist/evaluator/compile.js.map +1 -1
- package/dist/grammar.js +1 -1
- package/dist/parser/Parser.d.ts +2 -9
- package/dist/parser/Parser.js +2 -12
- package/dist/parser/Parser.js.map +1 -1
- package/dist/parser/handlers.d.ts +6 -3
- package/dist/parser/handlers.js +45 -28
- package/dist/parser/handlers.js.map +1 -1
- package/dist/parser/states.js +3 -5
- package/dist/parser/states.js.map +1 -1
- package/dist/types.d.ts +0 -3
- package/esm/Expression.js +1 -2
- package/esm/Expression.js.map +1 -1
- package/esm/Jexl.d.ts +2 -2
- package/esm/Lexer.d.ts +10 -8
- package/esm/Lexer.js +46 -35
- package/esm/Lexer.js.map +1 -1
- package/esm/evaluator/compile.d.ts +6 -4
- package/esm/evaluator/compile.js +91 -55
- package/esm/evaluator/compile.js.map +1 -1
- package/esm/grammar.js +1 -1
- package/esm/parser/Parser.d.ts +2 -9
- package/esm/parser/Parser.js +2 -12
- package/esm/parser/Parser.js.map +1 -1
- package/esm/parser/handlers.d.ts +6 -3
- package/esm/parser/handlers.js +45 -28
- package/esm/parser/handlers.js.map +1 -1
- package/esm/parser/states.js +3 -5
- package/esm/parser/states.js.map +1 -1
- package/esm/types.d.ts +0 -3
- package/package.json +2 -1
- package/src/Expression.ts +1 -2
- package/src/Jexl.ts +2 -2
- package/src/Lexer.ts +47 -36
- package/src/evaluator/compile.ts +108 -71
- package/src/grammar.ts +1 -1
- package/src/parser/Parser.ts +2 -13
- package/src/parser/handlers.ts +48 -31
- package/src/parser/states.ts +3 -5
- package/src/types.ts +0 -3
- package/dist/evaluator/Evaluator.d.ts +0 -37
- package/dist/evaluator/Evaluator.js +0 -49
- package/dist/evaluator/Evaluator.js.map +0 -1
- package/esm/evaluator/Evaluator.d.ts +0 -37
- package/esm/evaluator/Evaluator.js +0 -47
- package/esm/evaluator/Evaluator.js.map +0 -1
- package/src/evaluator/Evaluator.ts +0 -58
package/dist/Expression.js
CHANGED
|
@@ -8,7 +8,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
8
8
|
};
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
const Lexer_ts_1 = __importDefault(require("./Lexer.js"));
|
|
11
|
-
const Evaluator_ts_1 = __importDefault(require("./evaluator/Evaluator.js"));
|
|
12
11
|
const compile_ts_1 = require("./evaluator/compile.js");
|
|
13
12
|
const Parser_ts_1 = __importDefault(require("./parser/Parser.js"));
|
|
14
13
|
class Expression {
|
|
@@ -67,7 +66,7 @@ class Expression {
|
|
|
67
66
|
if (!this._fn) {
|
|
68
67
|
return undefined;
|
|
69
68
|
}
|
|
70
|
-
return this._fn(
|
|
69
|
+
return this._fn(context);
|
|
71
70
|
}
|
|
72
71
|
}
|
|
73
72
|
exports.default = Expression;
|
package/dist/Expression.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Expression.js","sourceRoot":"","sources":["../src/Expression.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;AAEH,0DAA8B;AAC9B,
|
|
1
|
+
{"version":3,"file":"Expression.js","sourceRoot":"","sources":["../src/Expression.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;AAEH,0DAA8B;AAC9B,uDAAmD;AACnD,mEAAuC;AAMvC,MAAM,UAAU;IACd,QAAQ,CAAS;IACjB,QAAQ,CAAQ;IAChB;;oDAEgD;IAChD,IAAI,CAAgB;IACpB,MAAM,CAAO;IACb,SAAS,GAAG,KAAK,CAAA;IACjB,2EAA2E;IAC3E,GA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|
package/dist/Jexl.d.ts
CHANGED
|
@@ -16,9 +16,9 @@ declare class Jexl {
|
|
|
16
16
|
* Adds a binary operator to Jexl at the specified precedence. The higher the
|
|
17
17
|
* precedence, the earlier the operator is applied in the order of operations.
|
|
18
18
|
* For example, * has a higher precedence than +, because multiplication comes
|
|
19
|
-
* before
|
|
19
|
+
* before addition.
|
|
20
20
|
*
|
|
21
|
-
* Please see grammar.
|
|
21
|
+
* Please see grammar.ts for a listing of all default operators and their
|
|
22
22
|
* precedence values in order to choose the appropriate precedence for the
|
|
23
23
|
* new operator.
|
|
24
24
|
* @param {string} operator The operator string to be added
|
package/dist/Lexer.d.ts
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import type { Grammar } from './grammar.ts';
|
|
2
2
|
import type { TemplatePart, Token } from './types.ts';
|
|
3
3
|
/**
|
|
4
|
-
* Lexer
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
4
|
+
* Lexer handles the lexical parsing of a Jexl string. Its responsibility is to
|
|
5
|
+
* identify the "parts of speech" of a Jexl expression, and tokenize and label
|
|
6
|
+
* each, but to do only the most minimal syntax checking; the only errors the
|
|
7
|
+
* Lexer should be concerned with are if it's unable to identify the utility of
|
|
8
|
+
* any of its tokens. Errors stemming from these tokens not being in a sensible
|
|
9
|
+
* configuration should be left for the Parser to handle.
|
|
10
|
+
*
|
|
11
|
+
* An instance is bound to one grammar and memoizes the regex that splits an
|
|
12
|
+
* expression into elements, which is expensive to build; {@link #_clearCache}
|
|
13
|
+
* discards it when the grammar's elements change.
|
|
12
14
|
*/
|
|
13
15
|
declare class Lexer {
|
|
14
16
|
_grammar: Grammar;
|
package/dist/Lexer.js
CHANGED
|
@@ -4,12 +4,25 @@
|
|
|
4
4
|
* Copyright 2020 Tom Shawver
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
// what an identifier and a number look like, written once: the split regex
|
|
8
|
+
// below carves elements out of the expression with these, and _createToken
|
|
9
|
+
// then re-tests the elements it produced. Two spellings of either would
|
|
10
|
+
// disagree on some input, and each disagreement is an "Invalid expression
|
|
11
|
+
// token" for something the splitter was happy to produce.
|
|
12
|
+
const identChars = String.raw `a-zA-Zа-яА-Я_\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF$`;
|
|
13
|
+
const identPattern = `[${identChars}][${identChars}0-9]*`;
|
|
14
|
+
// unsigned: whether a leading '-' negates is decided separately, in getTokens
|
|
15
|
+
const numberPattern = String.raw `(?:(?:[0-9]*\.[0-9]+)|[0-9]+)`;
|
|
16
|
+
const numericRegex = new RegExp(`^-?${numberPattern}$`);
|
|
17
|
+
const identRegex = new RegExp(`^${identPattern}$`);
|
|
9
18
|
const escEscRegex = /\\\\/g;
|
|
10
19
|
// a string literal opens with one of exactly two quote characters, so the two
|
|
11
20
|
// unescaping regexes can just be named rather than built and cached per quote
|
|
12
21
|
const escQuoteRegex = { "'": /\\'/g, '"': /\\"/g };
|
|
22
|
+
// the escapes a template string's static text recognizes. One pass, so the
|
|
23
|
+
// backslash an escaped backslash yields can't be re-read as the start of the
|
|
24
|
+
// escape that follows it
|
|
25
|
+
const templateEscRegex = /\\([`$\\])/g;
|
|
13
26
|
const whitespaceRegex = /^\s*$/;
|
|
14
27
|
const preOpRegexElems = [
|
|
15
28
|
// Template strings
|
|
@@ -23,12 +36,7 @@ const preOpRegexElems = [
|
|
|
23
36
|
String.raw `\btrue\b`,
|
|
24
37
|
String.raw `\bfalse\b`
|
|
25
38
|
];
|
|
26
|
-
const postOpRegexElems = [
|
|
27
|
-
// Identifiers
|
|
28
|
-
'[a-zA-Zа-яА-Я_\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF\\$][a-zA-Z0-9а-яА-Я_\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF\\$]*',
|
|
29
|
-
// Numerics (without negative symbol)
|
|
30
|
-
String.raw `(?:(?:[0-9]*\.[0-9]+)|[0-9]+)`
|
|
31
|
-
];
|
|
39
|
+
const postOpRegexElems = [identPattern, numberPattern];
|
|
32
40
|
const unaryMinusToken = () => ({
|
|
33
41
|
type: 'unaryOp',
|
|
34
42
|
value: '-',
|
|
@@ -45,14 +53,16 @@ const minusNegatesAfter = new Set([
|
|
|
45
53
|
'semicolon'
|
|
46
54
|
]);
|
|
47
55
|
/**
|
|
48
|
-
* Lexer
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
+
* Lexer handles the lexical parsing of a Jexl string. Its responsibility is to
|
|
57
|
+
* identify the "parts of speech" of a Jexl expression, and tokenize and label
|
|
58
|
+
* each, but to do only the most minimal syntax checking; the only errors the
|
|
59
|
+
* Lexer should be concerned with are if it's unable to identify the utility of
|
|
60
|
+
* any of its tokens. Errors stemming from these tokens not being in a sensible
|
|
61
|
+
* configuration should be left for the Parser to handle.
|
|
62
|
+
*
|
|
63
|
+
* An instance is bound to one grammar and memoizes the regex that splits an
|
|
64
|
+
* expression into elements, which is expensive to build; {@link #_clearCache}
|
|
65
|
+
* discards it when the grammar's elements change.
|
|
56
66
|
*/
|
|
57
67
|
class Lexer {
|
|
58
68
|
_grammar;
|
|
@@ -90,10 +100,14 @@ class Lexer {
|
|
|
90
100
|
*/
|
|
91
101
|
getTokens(elements) {
|
|
92
102
|
const tokens = [];
|
|
93
|
-
|
|
103
|
+
// a prefix minus, held back until the element it applies to is known. It
|
|
104
|
+
// carries its own raw so that whitespace arriving before that element ("-
|
|
105
|
+
// 1") accumulates on the minus rather than on the token before it, which
|
|
106
|
+
// is what lets the parser's error messages quote the expression verbatim.
|
|
107
|
+
let pendingMinus;
|
|
94
108
|
for (const element of elements) {
|
|
95
109
|
if (this._isWhitespace(element)) {
|
|
96
|
-
const last = tokens.at(-1);
|
|
110
|
+
const last = pendingMinus ?? tokens.at(-1);
|
|
97
111
|
if (last) {
|
|
98
112
|
last.raw += element;
|
|
99
113
|
}
|
|
@@ -101,30 +115,32 @@ class Lexer {
|
|
|
101
115
|
else if (element === '-' && this._isNegative(tokens)) {
|
|
102
116
|
// a second prefix minus in a row ("- -x"): emit the pending one as a
|
|
103
117
|
// unary operator so this one can negate whatever comes next
|
|
104
|
-
if (
|
|
105
|
-
tokens.push(
|
|
118
|
+
if (pendingMinus) {
|
|
119
|
+
tokens.push(pendingMinus);
|
|
106
120
|
}
|
|
107
|
-
|
|
121
|
+
pendingMinus = unaryMinusToken();
|
|
108
122
|
}
|
|
109
|
-
else if (
|
|
110
|
-
negate = false;
|
|
123
|
+
else if (pendingMinus) {
|
|
111
124
|
if (numericRegex.exec(element)) {
|
|
112
125
|
// fold the sign into the number, so "-1" stays a single literal
|
|
113
|
-
|
|
126
|
+
const token = this._createToken('-' + element);
|
|
127
|
+
token.raw = pendingMinus.raw + element;
|
|
128
|
+
tokens.push(token);
|
|
114
129
|
}
|
|
115
130
|
else {
|
|
116
131
|
// anything else gets a standalone prefix operator, letting "-x",
|
|
117
132
|
// "-(a + b)" and "-foo.bar" negate a computed value
|
|
118
|
-
tokens.push(
|
|
133
|
+
tokens.push(pendingMinus, this._createToken(element));
|
|
119
134
|
}
|
|
135
|
+
pendingMinus = undefined;
|
|
120
136
|
}
|
|
121
137
|
else {
|
|
122
138
|
tokens.push(this._createToken(element));
|
|
123
139
|
}
|
|
124
140
|
}
|
|
125
141
|
// Catch a - at the end of the string. Let the parser handle that issue.
|
|
126
|
-
if (
|
|
127
|
-
tokens.push(
|
|
142
|
+
if (pendingMinus) {
|
|
143
|
+
tokens.push(pendingMinus);
|
|
128
144
|
}
|
|
129
145
|
return tokens;
|
|
130
146
|
}
|
|
@@ -251,10 +267,8 @@ class Lexer {
|
|
|
251
267
|
* @private
|
|
252
268
|
*/
|
|
253
269
|
_isNegative(tokens) {
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
}
|
|
257
|
-
return minusNegatesAfter.has(tokens[tokens.length - 1].type);
|
|
270
|
+
const last = tokens.at(-1);
|
|
271
|
+
return !last || minusNegatesAfter.has(last.type);
|
|
258
272
|
}
|
|
259
273
|
/**
|
|
260
274
|
* A utility function to determine if a string consists of only space
|
|
@@ -350,10 +364,7 @@ class Lexer {
|
|
|
350
364
|
return parts;
|
|
351
365
|
}
|
|
352
366
|
_unescapeTemplateString(str) {
|
|
353
|
-
return str
|
|
354
|
-
.replaceAll('\\`', '`')
|
|
355
|
-
.replaceAll(String.raw `\$`, '$')
|
|
356
|
-
.replaceAll('\\\\', '\\');
|
|
367
|
+
return str.replaceAll(templateEscRegex, '$1');
|
|
357
368
|
}
|
|
358
369
|
}
|
|
359
370
|
exports.default = Lexer;
|
package/dist/Lexer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Lexer.js","sourceRoot":"","sources":["../src/Lexer.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAKH,MAAM,YAAY,GAAG,
|
|
1
|
+
{"version":3,"file":"Lexer.js","sourceRoot":"","sources":["../src/Lexer.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAKH,2EAA2E;AAC3E,2EAA2E;AAC3E,wEAAwE;AACxE,0EAA0E;AAC1E,0DAA0D;AAC1D,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAA,uDAAuD,CAAA;AACpF,MAAM,YAAY,GAAG,IAAI,UAAU,KAAK,UAAU,OAAO,CAAA;AACzD,8EAA8E;AAC9E,MAAM,aAAa,GAAG,MAAM,CAAC,GAAG,CAAA,+BAA+B,CAAA;AAE/D,MAAM,YAAY,GAAG,IAAI,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAA;AACvD,MAAM,UAAU,GAAG,IAAI,MAAM,CAAC,IAAI,YAAY,GAAG,CAAC,CAAA;AAClD,MAAM,WAAW,GAAG,OAAO,CAAA;AAC3B,8EAA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,IAAI,IAAI,KAAK,GAAG,EAAE,CAAC;wBACjB,UAAU,EAAE,CAAA;oBACd,CAAC;yBAAM,IAAI,IAAI,KAAK,GAAG,EAAE,CAAC;wBACxB,UAAU,EAAE,CAAA;oBACd,CAAC;oBACD,OAAO,EAAE,CAAA;gBACX,CAAC;gBAED,IAAI,UAAU,KAAK,CAAC,EAAE,CAAC;oBACrB,MAAM,IAAI,KAAK,CAAC,8CAA8C,GAAG,EAAE,CAAC,CAAA;gBACtE,CAAC;gBAED,KAAK,CAAC,IAAI,CAAC;oBACT,IAAI,EAAE,eAAe;oBACrB,KAAK,EAAE,GAAG,CAAC,KAAK,CAAC,WAAW,EAAE,OAAO,GAAG,CAAC,CAAC;iBAC3C,CAAC,CAAA;gBAEF,WAAW,GAAG,OAAO,CAAA;YACvB,CAAC;iBAAM,CAAC;gBACN,OAAO,EAAE,CAAA;YACX,CAAC;QACH,CAAC;QAED,IAAI,OAAO,GAAG,WAAW,EAAE,CAAC;YAC1B,KAAK,CAAC,IAAI,CAAC;gBACT,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE,GAAG,CAAC,KAAK,CAAC,WAAW,EAAE,OAAO,CAAC;aACvC,CAAC,CAAA;QACJ,CAAC;QAED,OAAO,KAAK,CAAA;IACd,CAAC;IAED,uBAAuB,CAAC,GAAW;QACjC,OAAO,GAAG,CAAC,UAAU,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAA;IAC/C,CAAC;CACF;AAED,kBAAe,KAAK,CAAA"}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import type { Grammar } from '../grammar.ts';
|
|
2
2
|
import type { AstNode, JexlValue } from '../types.ts';
|
|
3
|
-
|
|
3
|
+
/** The variables an expression is evaluated against. */
|
|
4
|
+
export type Context = Record<string, JexlValue>;
|
|
4
5
|
/**
|
|
5
|
-
* An AST node lowered to a closure. Calling it with
|
|
6
|
-
*
|
|
6
|
+
* An AST node lowered to a closure. Calling it with a context produces the
|
|
7
|
+
* node's value. The grammar is captured when the closure is built, so it is not
|
|
8
|
+
* a parameter.
|
|
7
9
|
*/
|
|
8
|
-
export type CompiledNode = (
|
|
10
|
+
export type CompiledNode = (context: Context) => JexlValue;
|
|
9
11
|
/**
|
|
10
12
|
* Lowers an expression tree into a tree of closures, resolving each node's type
|
|
11
13
|
* and its operator's implementation once, at compile time, rather than
|
|
@@ -23,6 +23,30 @@ function defineOwn(target, key, value) {
|
|
|
23
23
|
function assignOwn(target, key, value) {
|
|
24
24
|
target[key] = value;
|
|
25
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* The key a bracket index that is neither a string nor a number reads under:
|
|
28
|
+
* its string form, when it has one worth using.
|
|
29
|
+
*
|
|
30
|
+
* A boolean and an array of primitives do — `['a']` is the key `'a'`, exactly
|
|
31
|
+
* as JS would index by it. A plain object does not, since '[object Object]' is
|
|
32
|
+
* not a key anything is stored under, so it and an array holding one answer
|
|
33
|
+
* `undefined` instead; indexing by either reached that lookup and missed
|
|
34
|
+
* anyway. null and undefined are the same case.
|
|
35
|
+
*/
|
|
36
|
+
function indexKey(value) {
|
|
37
|
+
if (typeof value === 'boolean') {
|
|
38
|
+
return String(value);
|
|
39
|
+
}
|
|
40
|
+
return Array.isArray(value) && value.every(isKeyPart)
|
|
41
|
+
? value.join(',')
|
|
42
|
+
: undefined;
|
|
43
|
+
}
|
|
44
|
+
function isKeyPart(value) {
|
|
45
|
+
return (value == null ||
|
|
46
|
+
typeof value === 'string' ||
|
|
47
|
+
typeof value === 'number' ||
|
|
48
|
+
typeof value === 'boolean');
|
|
49
|
+
}
|
|
26
50
|
/** Renders an interpolated value for a template literal. */
|
|
27
51
|
function stringify(value) {
|
|
28
52
|
if (value == null) {
|
|
@@ -66,21 +90,17 @@ function compileAst(ast, grammar) {
|
|
|
66
90
|
case 'Identifier': {
|
|
67
91
|
const name = node.value;
|
|
68
92
|
if (!node.from) {
|
|
69
|
-
return
|
|
70
|
-
? (ev) => ev._relContext[name]
|
|
71
|
-
: (ev) => ev._context[name];
|
|
93
|
+
return (ctx) => ctx[name];
|
|
72
94
|
}
|
|
73
95
|
const from = compileAst(node.from, grammar);
|
|
74
|
-
return (
|
|
75
|
-
const
|
|
76
|
-
if (
|
|
96
|
+
return (ctx) => {
|
|
97
|
+
const subject = from(ctx);
|
|
98
|
+
if (subject == null) {
|
|
77
99
|
return undefined;
|
|
78
100
|
}
|
|
79
101
|
// an identifier chained off an array reads through its first element
|
|
80
|
-
const
|
|
81
|
-
return
|
|
82
|
-
? undefined
|
|
83
|
-
: ctx[name];
|
|
102
|
+
const target = Array.isArray(subject) ? subject[0] : subject;
|
|
103
|
+
return target == null ? undefined : target[name];
|
|
84
104
|
};
|
|
85
105
|
}
|
|
86
106
|
case 'BinaryExpression': {
|
|
@@ -96,17 +116,17 @@ function compileAst(ast, grammar) {
|
|
|
96
116
|
if (evalOnDemand) {
|
|
97
117
|
// operands stay unevaluated behind an `eval` thunk, so operators such
|
|
98
118
|
// as && and || can short-circuit
|
|
99
|
-
return (
|
|
119
|
+
return (ctx) => evalOnDemand({ eval: () => left(ctx) }, { eval: () => right(ctx) });
|
|
100
120
|
}
|
|
101
121
|
const fn = op.eval;
|
|
102
122
|
if (!fn) {
|
|
103
|
-
return (
|
|
104
|
-
left(
|
|
105
|
-
right(
|
|
123
|
+
return (ctx) => {
|
|
124
|
+
left(ctx);
|
|
125
|
+
right(ctx);
|
|
106
126
|
return undefined;
|
|
107
127
|
};
|
|
108
128
|
}
|
|
109
|
-
return (
|
|
129
|
+
return (ctx) => fn(left(ctx), right(ctx));
|
|
110
130
|
}
|
|
111
131
|
case 'UnaryExpression': {
|
|
112
132
|
const right = compileAst(node.right, grammar);
|
|
@@ -118,12 +138,12 @@ function compileAst(ast, grammar) {
|
|
|
118
138
|
: undefined;
|
|
119
139
|
if (!fn) {
|
|
120
140
|
// the operand is still evaluated for an unknown operator, as before
|
|
121
|
-
return (
|
|
122
|
-
right(
|
|
141
|
+
return (ctx) => {
|
|
142
|
+
right(ctx);
|
|
123
143
|
return undefined;
|
|
124
144
|
};
|
|
125
145
|
}
|
|
126
|
-
return (
|
|
146
|
+
return (ctx) => fn(right(ctx));
|
|
127
147
|
}
|
|
128
148
|
case 'ConditionalExpression': {
|
|
129
149
|
const test = compileAst(node.test, grammar);
|
|
@@ -133,42 +153,58 @@ function compileAst(ast, grammar) {
|
|
|
133
153
|
const alternate = node.alternate
|
|
134
154
|
? compileAst(node.alternate, grammar)
|
|
135
155
|
: undefined;
|
|
136
|
-
return (
|
|
137
|
-
const res = test(
|
|
156
|
+
return (ctx) => {
|
|
157
|
+
const res = test(ctx);
|
|
138
158
|
if (res) {
|
|
139
159
|
// an omitted consequent ("a ?: b") yields the test result
|
|
140
|
-
return consequent ? consequent(
|
|
160
|
+
return consequent ? consequent(ctx) : res;
|
|
141
161
|
}
|
|
142
|
-
return alternate ? alternate(
|
|
162
|
+
return alternate ? alternate(ctx) : undefined;
|
|
143
163
|
};
|
|
144
164
|
}
|
|
145
165
|
case 'FilterExpression': {
|
|
146
|
-
if (node.relative) {
|
|
147
|
-
// thrown on evaluation rather than compilation, as before
|
|
148
|
-
return () => {
|
|
149
|
-
throw new Error('Relative filter expressions are not supported');
|
|
150
|
-
};
|
|
151
|
-
}
|
|
152
166
|
const subject = compileAst(node.subject, grammar);
|
|
153
167
|
const index = compileAst(node.expr, grammar);
|
|
154
|
-
return (
|
|
155
|
-
const subjectVal = subject(
|
|
156
|
-
const indexVal = index(
|
|
168
|
+
return (ctx) => {
|
|
169
|
+
const subjectVal = subject(ctx);
|
|
170
|
+
const indexVal = index(ctx);
|
|
157
171
|
if (subjectVal == null) {
|
|
158
172
|
return undefined;
|
|
159
173
|
}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
174
|
+
if (typeof indexVal === 'string' || typeof indexVal === 'number') {
|
|
175
|
+
return subjectVal[indexVal];
|
|
176
|
+
}
|
|
177
|
+
// A value with a meaningful string form is indexed by it, which is what
|
|
178
|
+
// JS does and what this did until the evaluator was lowered to closures
|
|
179
|
+
// — the tree-walking version was a bare `subject?.[index]`. Answering
|
|
180
|
+
// `undefined` for everything else reads as a deliberate strictness and
|
|
181
|
+
// is not: nothing wanted it, and the shape it rejects is common.
|
|
182
|
+
//
|
|
183
|
+
// That shape is a one-element array. Every `@gmod/vcf` INFO value is a
|
|
184
|
+
// list — `Number=1` included, so `CLNSIG=Pathogenic` parses to
|
|
185
|
+
// `['Pathogenic']` — and the natural way to colour by one is a lookup
|
|
186
|
+
// table indexed by it. The miss is silent, because such an expression
|
|
187
|
+
// always carries a `|| fallback` for the values it has no entry for,
|
|
188
|
+
// and that fallback then answers for every record.
|
|
189
|
+
//
|
|
190
|
+
// A multi-valued list still misses — `['a','b']` is the key 'a,b' —
|
|
191
|
+
// which is the honest answer rather than a lucky one: reading through
|
|
192
|
+
// to the first element would be the index guessing which value was
|
|
193
|
+
// meant. `Identifier` above does read through a one-element array, but
|
|
194
|
+
// it is navigating rather than selecting, so it has nothing to guess.
|
|
195
|
+
const key = indexKey(indexVal);
|
|
196
|
+
return key === undefined
|
|
197
|
+
? undefined
|
|
198
|
+
: subjectVal[key];
|
|
163
199
|
};
|
|
164
200
|
}
|
|
165
201
|
case 'ArrayLiteral': {
|
|
166
202
|
const items = node.value.map((item) => compileAst(item, grammar));
|
|
167
203
|
const len = items.length;
|
|
168
|
-
return (
|
|
204
|
+
return (ctx) => {
|
|
169
205
|
const out = new Array(len);
|
|
170
206
|
for (let i = 0; i < len; i++) {
|
|
171
|
-
out[i] = items[i](
|
|
207
|
+
out[i] = items[i](ctx);
|
|
172
208
|
}
|
|
173
209
|
return out;
|
|
174
210
|
};
|
|
@@ -180,10 +216,10 @@ function compileAst(ast, grammar) {
|
|
|
180
216
|
const len = keys.length;
|
|
181
217
|
// resolved once, here, so the common case keeps its plain store
|
|
182
218
|
const store = keys.includes('__proto__') ? defineOwn : assignOwn;
|
|
183
|
-
return (
|
|
219
|
+
return (ctx) => {
|
|
184
220
|
const out = {};
|
|
185
221
|
for (let i = 0; i < len; i++) {
|
|
186
|
-
store(out, keys[i], values[i](
|
|
222
|
+
store(out, keys[i], values[i](ctx));
|
|
187
223
|
}
|
|
188
224
|
return out;
|
|
189
225
|
};
|
|
@@ -196,12 +232,12 @@ function compileAst(ast, grammar) {
|
|
|
196
232
|
return () => value;
|
|
197
233
|
}
|
|
198
234
|
const expr = compileAst(part.value, grammar);
|
|
199
|
-
return (
|
|
235
|
+
return (ctx) => stringify(expr(ctx));
|
|
200
236
|
});
|
|
201
|
-
return (
|
|
237
|
+
return (ctx) => {
|
|
202
238
|
let out = '';
|
|
203
239
|
for (const part of parts) {
|
|
204
|
-
out += part(
|
|
240
|
+
out += part(ctx);
|
|
205
241
|
}
|
|
206
242
|
return out;
|
|
207
243
|
};
|
|
@@ -213,8 +249,8 @@ function compileAst(ast, grammar) {
|
|
|
213
249
|
// and `constructor` aren't callable as Jexl functions. Resolved per call
|
|
214
250
|
// rather than baked in, since functions are routinely registered after
|
|
215
251
|
// an expression has been compiled.
|
|
216
|
-
const lookup = (
|
|
217
|
-
const { functions } =
|
|
252
|
+
const lookup = () => {
|
|
253
|
+
const { functions } = grammar;
|
|
218
254
|
if (!Object.hasOwn(functions, name)) {
|
|
219
255
|
throw new Error(`Jexl Function ${name} is not defined.`);
|
|
220
256
|
}
|
|
@@ -224,28 +260,28 @@ function compileAst(ast, grammar) {
|
|
|
224
260
|
// argument array and needs no spread
|
|
225
261
|
switch (args.length) {
|
|
226
262
|
case 0: {
|
|
227
|
-
return (
|
|
263
|
+
return () => lookup()();
|
|
228
264
|
}
|
|
229
265
|
case 1: {
|
|
230
266
|
const [a0] = args;
|
|
231
|
-
return (
|
|
267
|
+
return (ctx) => lookup()(a0(ctx));
|
|
232
268
|
}
|
|
233
269
|
case 2: {
|
|
234
270
|
const [a0, a1] = args;
|
|
235
|
-
return (
|
|
271
|
+
return (ctx) => lookup()(a0(ctx), a1(ctx));
|
|
236
272
|
}
|
|
237
273
|
case 3: {
|
|
238
274
|
const [a0, a1, a2] = args;
|
|
239
|
-
return (
|
|
275
|
+
return (ctx) => lookup()(a0(ctx), a1(ctx), a2(ctx));
|
|
240
276
|
}
|
|
241
277
|
default: {
|
|
242
278
|
const len = args.length;
|
|
243
|
-
return (
|
|
279
|
+
return (ctx) => {
|
|
244
280
|
const vals = new Array(len);
|
|
245
281
|
for (let i = 0; i < len; i++) {
|
|
246
|
-
vals[i] = args[i](
|
|
282
|
+
vals[i] = args[i](ctx);
|
|
247
283
|
}
|
|
248
|
-
return lookup(
|
|
284
|
+
return lookup()(...vals);
|
|
249
285
|
};
|
|
250
286
|
}
|
|
251
287
|
}
|
|
@@ -253,10 +289,10 @@ function compileAst(ast, grammar) {
|
|
|
253
289
|
case 'SequenceExpression': {
|
|
254
290
|
const exprs = node.expressions.map((expr) => compileAst(expr, grammar));
|
|
255
291
|
const len = exprs.length;
|
|
256
|
-
return (
|
|
292
|
+
return (ctx) => {
|
|
257
293
|
let last;
|
|
258
294
|
for (let i = 0; i < len; i++) {
|
|
259
|
-
last = exprs[i](
|
|
295
|
+
last = exprs[i](ctx);
|
|
260
296
|
}
|
|
261
297
|
return last;
|
|
262
298
|
};
|
|
@@ -265,9 +301,9 @@ function compileAst(ast, grammar) {
|
|
|
265
301
|
const name = node.left.value;
|
|
266
302
|
const right = compileAst(node.right, grammar);
|
|
267
303
|
const store = name === '__proto__' ? defineOwn : assignOwn;
|
|
268
|
-
return (
|
|
269
|
-
const value = right(
|
|
270
|
-
store(
|
|
304
|
+
return (ctx) => {
|
|
305
|
+
const value = right(ctx);
|
|
306
|
+
store(ctx, name, value);
|
|
271
307
|
return value;
|
|
272
308
|
};
|
|
273
309
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compile.js","sourceRoot":"","sources":["../../src/evaluator/compile.ts"],"names":[],"mappings":";AAAA;;;GAGG;;
|
|
1
|
+
{"version":3,"file":"compile.js","sourceRoot":"","sources":["../../src/evaluator/compile.ts"],"names":[],"mappings":";AA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QAED,OAAO,CAAC,CAAC,CAAC;YACR,MAAM,IAAI,KAAK,CAAC,mCAAmC,GAAG,CAAC,IAAI,GAAG,CAAC,CAAA;QACjE,CAAC;IACH,CAAC;AACH,CAAC"}
|
package/dist/grammar.js
CHANGED
|
@@ -154,7 +154,7 @@ const getGrammar = () => ({
|
|
|
154
154
|
},
|
|
155
155
|
/**
|
|
156
156
|
* A map of function names to javascript functions. A Jexl function
|
|
157
|
-
* takes zero
|
|
157
|
+
* takes zero or more arguments:
|
|
158
158
|
*
|
|
159
159
|
* - {*} ...args: A variable number of arguments passed to this function.
|
|
160
160
|
* All of these are pre-evaluated to their actual values before calling
|