feelin 4.3.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.
- checksums.yaml +7 -0
- data/.gitignore +6 -0
- data/.rspec +2 -0
- data/CHANGELOG.md +10 -0
- data/Gemfile +3 -0
- data/LICENSE.txt +21 -0
- data/README.md +43 -0
- data/feelin.gemspec +22 -0
- data/lib/feelin/js/node_modules/.package-lock.json +67 -0
- data/lib/feelin/js/node_modules/@lezer/common/LICENSE +21 -0
- data/lib/feelin/js/node_modules/@lezer/common/README.md +14 -0
- data/lib/feelin/js/node_modules/@lezer/common/dist/index.cjs +2181 -0
- data/lib/feelin/js/node_modules/@lezer/common/dist/index.d.cts +1137 -0
- data/lib/feelin/js/node_modules/@lezer/common/dist/index.d.ts +1137 -0
- data/lib/feelin/js/node_modules/@lezer/common/dist/index.js +2168 -0
- data/lib/feelin/js/node_modules/@lezer/common/package.json +32 -0
- data/lib/feelin/js/node_modules/@lezer/highlight/LICENSE +21 -0
- data/lib/feelin/js/node_modules/@lezer/highlight/README.md +14 -0
- data/lib/feelin/js/node_modules/@lezer/highlight/dist/index.cjs +915 -0
- data/lib/feelin/js/node_modules/@lezer/highlight/dist/index.d.cts +621 -0
- data/lib/feelin/js/node_modules/@lezer/highlight/dist/index.d.ts +623 -0
- data/lib/feelin/js/node_modules/@lezer/highlight/dist/index.js +904 -0
- data/lib/feelin/js/node_modules/@lezer/highlight/package.json +31 -0
- data/lib/feelin/js/node_modules/@lezer/lr/LICENSE +21 -0
- data/lib/feelin/js/node_modules/@lezer/lr/README.md +25 -0
- data/lib/feelin/js/node_modules/@lezer/lr/dist/constants.d.ts +45 -0
- data/lib/feelin/js/node_modules/@lezer/lr/dist/constants.js +5 -0
- data/lib/feelin/js/node_modules/@lezer/lr/dist/index.cjs +1890 -0
- data/lib/feelin/js/node_modules/@lezer/lr/dist/index.d.cts +303 -0
- data/lib/feelin/js/node_modules/@lezer/lr/dist/index.d.ts +303 -0
- data/lib/feelin/js/node_modules/@lezer/lr/dist/index.js +1883 -0
- data/lib/feelin/js/node_modules/@lezer/lr/package.json +32 -0
- data/lib/feelin/js/node_modules/feelin/LICENSE +21 -0
- data/lib/feelin/js/node_modules/feelin/README.md +65 -0
- data/lib/feelin/js/node_modules/feelin/dist/builtins.d.ts +355 -0
- data/lib/feelin/js/node_modules/feelin/dist/index.cjs +2072 -0
- data/lib/feelin/js/node_modules/feelin/dist/index.cjs.map +1 -0
- data/lib/feelin/js/node_modules/feelin/dist/index.d.ts +3 -0
- data/lib/feelin/js/node_modules/feelin/dist/index.esm.js +2063 -0
- data/lib/feelin/js/node_modules/feelin/dist/index.esm.js.map +1 -0
- data/lib/feelin/js/node_modules/feelin/dist/interpreter.d.ts +26 -0
- data/lib/feelin/js/node_modules/feelin/dist/parser.d.ts +4 -0
- data/lib/feelin/js/node_modules/feelin/dist/temporal.d.ts +6 -0
- data/lib/feelin/js/node_modules/feelin/dist/types.d.ts +35 -0
- data/lib/feelin/js/node_modules/feelin/dist/utils.d.ts +12 -0
- data/lib/feelin/js/node_modules/feelin/package.json +63 -0
- data/lib/feelin/js/node_modules/lezer-feel/LICENSE +21 -0
- data/lib/feelin/js/node_modules/lezer-feel/README.md +94 -0
- data/lib/feelin/js/node_modules/lezer-feel/dist/index.cjs +1328 -0
- data/lib/feelin/js/node_modules/lezer-feel/dist/index.cjs.map +1 -0
- data/lib/feelin/js/node_modules/lezer-feel/dist/index.d.ts +32 -0
- data/lib/feelin/js/node_modules/lezer-feel/dist/index.js +1323 -0
- data/lib/feelin/js/node_modules/lezer-feel/dist/index.js.map +1 -0
- data/lib/feelin/js/node_modules/lezer-feel/package.json +61 -0
- data/lib/feelin/js/node_modules/luxon/LICENSE.md +7 -0
- data/lib/feelin/js/node_modules/luxon/README.md +55 -0
- data/lib/feelin/js/node_modules/luxon/build/amd/luxon.js +8623 -0
- data/lib/feelin/js/node_modules/luxon/build/amd/luxon.js.map +1 -0
- data/lib/feelin/js/node_modules/luxon/build/cjs-browser/luxon.js +8621 -0
- data/lib/feelin/js/node_modules/luxon/build/cjs-browser/luxon.js.map +1 -0
- data/lib/feelin/js/node_modules/luxon/build/es6/luxon.js +8011 -0
- data/lib/feelin/js/node_modules/luxon/build/es6/luxon.js.map +1 -0
- data/lib/feelin/js/node_modules/luxon/build/global/luxon.js +8626 -0
- data/lib/feelin/js/node_modules/luxon/build/global/luxon.js.map +1 -0
- data/lib/feelin/js/node_modules/luxon/build/global/luxon.min.js +1 -0
- data/lib/feelin/js/node_modules/luxon/build/global/luxon.min.js.map +1 -0
- data/lib/feelin/js/node_modules/luxon/build/node/luxon.js +7679 -0
- data/lib/feelin/js/node_modules/luxon/build/node/luxon.js.map +1 -0
- data/lib/feelin/js/node_modules/luxon/package.json +87 -0
- data/lib/feelin/js/node_modules/luxon/src/datetime.js +2566 -0
- data/lib/feelin/js/node_modules/luxon/src/duration.js +990 -0
- data/lib/feelin/js/node_modules/luxon/src/errors.js +61 -0
- data/lib/feelin/js/node_modules/luxon/src/impl/conversions.js +206 -0
- data/lib/feelin/js/node_modules/luxon/src/impl/diff.js +95 -0
- data/lib/feelin/js/node_modules/luxon/src/impl/digits.js +90 -0
- data/lib/feelin/js/node_modules/luxon/src/impl/english.js +233 -0
- data/lib/feelin/js/node_modules/luxon/src/impl/formats.js +176 -0
- data/lib/feelin/js/node_modules/luxon/src/impl/formatter.js +409 -0
- data/lib/feelin/js/node_modules/luxon/src/impl/invalid.js +14 -0
- data/lib/feelin/js/node_modules/luxon/src/impl/locale.js +554 -0
- data/lib/feelin/js/node_modules/luxon/src/impl/regexParser.js +335 -0
- data/lib/feelin/js/node_modules/luxon/src/impl/tokenParser.js +505 -0
- data/lib/feelin/js/node_modules/luxon/src/impl/util.js +316 -0
- data/lib/feelin/js/node_modules/luxon/src/impl/zoneUtil.js +34 -0
- data/lib/feelin/js/node_modules/luxon/src/info.js +205 -0
- data/lib/feelin/js/node_modules/luxon/src/interval.js +665 -0
- data/lib/feelin/js/node_modules/luxon/src/luxon.js +26 -0
- data/lib/feelin/js/node_modules/luxon/src/package.json +4 -0
- data/lib/feelin/js/node_modules/luxon/src/settings.js +180 -0
- data/lib/feelin/js/node_modules/luxon/src/zone.js +97 -0
- data/lib/feelin/js/node_modules/luxon/src/zones/IANAZone.js +231 -0
- data/lib/feelin/js/node_modules/luxon/src/zones/fixedOffsetZone.js +150 -0
- data/lib/feelin/js/node_modules/luxon/src/zones/invalidZone.js +53 -0
- data/lib/feelin/js/node_modules/luxon/src/zones/systemZone.js +61 -0
- data/lib/feelin/js/node_modules/min-dash/LICENSE +21 -0
- data/lib/feelin/js/node_modules/min-dash/README.md +38 -0
- data/lib/feelin/js/node_modules/min-dash/dist/array.d.ts +12 -0
- data/lib/feelin/js/node_modules/min-dash/dist/collection.d.ts +174 -0
- data/lib/feelin/js/node_modules/min-dash/dist/fn.d.ts +37 -0
- data/lib/feelin/js/node_modules/min-dash/dist/index.cjs +910 -0
- data/lib/feelin/js/node_modules/min-dash/dist/index.d.ts +5 -0
- data/lib/feelin/js/node_modules/min-dash/dist/index.esm.js +872 -0
- data/lib/feelin/js/node_modules/min-dash/dist/lang.d.ts +29 -0
- data/lib/feelin/js/node_modules/min-dash/dist/min-dash.js +916 -0
- data/lib/feelin/js/node_modules/min-dash/dist/min-dash.min.js +1 -0
- data/lib/feelin/js/node_modules/min-dash/dist/object.d.ts +112 -0
- data/lib/feelin/js/node_modules/min-dash/package.json +72 -0
- data/lib/feelin/js/package-lock.json +72 -0
- data/lib/feelin/js/package.json +5 -0
- data/lib/feelin/version.rb +3 -0
- data/lib/feelin.rb +63 -0
- data/spec/feelin/feelin_spec.rb +38 -0
- data/spec/spec_helper.rb +2 -0
- metadata +198 -0
@@ -0,0 +1,1323 @@
|
|
1
|
+
import { ExternalTokenizer, ContextTracker, LRParser } from '@lezer/lr';
|
2
|
+
import { reduce, has } from 'min-dash';
|
3
|
+
import { styleTags, tags } from '@lezer/highlight';
|
4
|
+
|
5
|
+
// This file was generated by lezer-generator. You probably shouldn't edit it.
|
6
|
+
const propertyIdentifier = 121,
|
7
|
+
identifier = 122,
|
8
|
+
nameIdentifier = 123,
|
9
|
+
insertSemi = 124,
|
10
|
+
expression0 = 128,
|
11
|
+
ForExpression = 4,
|
12
|
+
forExpressionStart = 131,
|
13
|
+
ForInExpression = 7,
|
14
|
+
Name = 8,
|
15
|
+
Identifier = 9,
|
16
|
+
AdditionalIdentifier = 10,
|
17
|
+
forExpressionBodyStart = 139,
|
18
|
+
IfExpression = 19,
|
19
|
+
ifExpressionStart = 140,
|
20
|
+
QuantifiedExpression = 23,
|
21
|
+
quantifiedExpressionStart = 141,
|
22
|
+
QuantifiedInExpression = 27,
|
23
|
+
PositiveUnaryTest = 37,
|
24
|
+
ArithmeticExpression = 41,
|
25
|
+
arithmeticPlusStart = 145,
|
26
|
+
arithmeticTimesStart = 146,
|
27
|
+
arithmeticExpStart = 147,
|
28
|
+
arithmeticUnaryStart = 148,
|
29
|
+
VariableName = 47,
|
30
|
+
PathExpression = 68,
|
31
|
+
pathExpressionStart = 154,
|
32
|
+
FilterExpression = 70,
|
33
|
+
filterExpressionStart = 155,
|
34
|
+
FunctionInvocation = 72,
|
35
|
+
functionInvocationStart = 156,
|
36
|
+
ParameterName = 76,
|
37
|
+
nil = 161,
|
38
|
+
NumericLiteral = 79,
|
39
|
+
StringLiteral = 80,
|
40
|
+
BooleanLiteral = 81,
|
41
|
+
listStart = 167,
|
42
|
+
List = 89,
|
43
|
+
FunctionDefinition = 90,
|
44
|
+
functionDefinitionStart = 169,
|
45
|
+
Context = 97,
|
46
|
+
contextStart = 171,
|
47
|
+
ContextEntry = 98,
|
48
|
+
PropertyName = 100,
|
49
|
+
PropertyIdentifier = 101;
|
50
|
+
|
51
|
+
/* global console,process */
|
52
|
+
|
53
|
+
|
54
|
+
// @ts-expect-error env access
|
55
|
+
const LOG_PARSE = typeof process != 'undefined' && process.env && /\bfparse(:dbg)?\b/.test(process.env.LOG);
|
56
|
+
|
57
|
+
// @ts-expect-error env access
|
58
|
+
const LOG_PARSE_DEBUG = typeof process != 'undefined' && process.env && /\bfparse:dbg\b/.test(process.env.LOG);
|
59
|
+
|
60
|
+
// @ts-expect-error env access
|
61
|
+
const LOG_VARS = typeof process != 'undefined' && process.env && /\bcontext\b/.test(process.env.LOG);
|
62
|
+
|
63
|
+
const spaceChars = [
|
64
|
+
9, 11, 12, 32, 133, 160,
|
65
|
+
5760, 8192, 8193, 8194, 8195, 8196, 8197, 8198,
|
66
|
+
8199, 8200, 8201, 8202, 8232, 8233, 8239, 8287, 12288
|
67
|
+
];
|
68
|
+
|
69
|
+
const newlineChars = chars('\n\r');
|
70
|
+
|
71
|
+
const asterix = '*'.charCodeAt(0);
|
72
|
+
|
73
|
+
const additionalNameChars = chars("'./-+*^");
|
74
|
+
|
75
|
+
/**
|
76
|
+
* @typedef { VariableContext | any } ContextValue
|
77
|
+
*/
|
78
|
+
|
79
|
+
/**
|
80
|
+
* @param { string } str
|
81
|
+
* @return { number[] }
|
82
|
+
*/
|
83
|
+
function chars(str) {
|
84
|
+
return Array.from(str).map(s => s.charCodeAt(0));
|
85
|
+
}
|
86
|
+
|
87
|
+
/**
|
88
|
+
* @param { number } ch
|
89
|
+
* @return { boolean }
|
90
|
+
*/
|
91
|
+
function isStartChar(ch) {
|
92
|
+
return (
|
93
|
+
ch === 63 // ?
|
94
|
+
) || (
|
95
|
+
ch >= 65 && ch <= 90 // A-Z
|
96
|
+
) || (
|
97
|
+
ch === 95 // _
|
98
|
+
) || (
|
99
|
+
ch >= 97 && ch <= 122 // a-z
|
100
|
+
) || (
|
101
|
+
ch >= 0xC0 && ch <= 0xD6
|
102
|
+
) || (
|
103
|
+
ch >= 0xD8 && ch <= 0xF6
|
104
|
+
) || (
|
105
|
+
ch >= 0xF8 && ch <= 0x2FF
|
106
|
+
) || (
|
107
|
+
ch >= 0x370 && ch <= 0x37D
|
108
|
+
) || (
|
109
|
+
ch >= 0x37F && ch <= 0x1FFF
|
110
|
+
) || (
|
111
|
+
ch >= 0x200C && ch <= 0x200D
|
112
|
+
) || (
|
113
|
+
ch >= 0x2070 && ch <= 0x218F
|
114
|
+
) || (
|
115
|
+
ch >= 0x2C00 && ch <= 0x2FEF
|
116
|
+
) || (
|
117
|
+
ch >= 0x3001 && ch <= 0xD7FF
|
118
|
+
) || (
|
119
|
+
ch >= 0xF900 && ch <= 0xFDCF
|
120
|
+
) || (
|
121
|
+
ch >= 0xFDF0 && ch <= 0xFFFD
|
122
|
+
) || (
|
123
|
+
ch >= 0xD800 && ch <= 0xDBFF // upper surrogate
|
124
|
+
) || (
|
125
|
+
ch >= 0xDC00 && ch <= 0xDFFF // lower surrogate
|
126
|
+
);
|
127
|
+
}
|
128
|
+
|
129
|
+
/**
|
130
|
+
* @param { number } ch
|
131
|
+
* @return { boolean }
|
132
|
+
*/
|
133
|
+
function isAdditional(ch) {
|
134
|
+
return additionalNameChars.includes(ch);
|
135
|
+
}
|
136
|
+
|
137
|
+
/**
|
138
|
+
* @param { number } ch
|
139
|
+
* @return { boolean }
|
140
|
+
*/
|
141
|
+
function isPartChar(ch) {
|
142
|
+
return (
|
143
|
+
ch >= 48 && ch <= 57 // 0-9
|
144
|
+
) || (
|
145
|
+
ch === 0xB7
|
146
|
+
) || (
|
147
|
+
ch >= 0x0300 && ch <= 0x036F
|
148
|
+
) || (
|
149
|
+
ch >= 0x203F && ch <= 0x2040
|
150
|
+
);
|
151
|
+
}
|
152
|
+
|
153
|
+
/**
|
154
|
+
* @param { number } ch
|
155
|
+
* @return { boolean }
|
156
|
+
*/
|
157
|
+
function isSpace(ch) {
|
158
|
+
return spaceChars.includes(ch);
|
159
|
+
}
|
160
|
+
|
161
|
+
function indent(str, spaces) {
|
162
|
+
return spaces.concat(
|
163
|
+
str.split(/\n/g).join('\n' + spaces)
|
164
|
+
);
|
165
|
+
}
|
166
|
+
|
167
|
+
/**
|
168
|
+
* @param { import('@lezer/lr').InputStream } input
|
169
|
+
* @param { number } [offset]
|
170
|
+
*
|
171
|
+
* @return { { token: string, offset: number } | null }
|
172
|
+
*/
|
173
|
+
function parseAdditionalSymbol(input, offset = 0) {
|
174
|
+
|
175
|
+
const next = input.peek(offset);
|
176
|
+
|
177
|
+
if (next === asterix && input.peek(offset + 1) === asterix) {
|
178
|
+
|
179
|
+
return {
|
180
|
+
offset: 2,
|
181
|
+
token: '**'
|
182
|
+
};
|
183
|
+
}
|
184
|
+
|
185
|
+
if (isAdditional(next)) {
|
186
|
+
return {
|
187
|
+
offset: 1,
|
188
|
+
token: String.fromCharCode(next)
|
189
|
+
};
|
190
|
+
}
|
191
|
+
|
192
|
+
return null;
|
193
|
+
}
|
194
|
+
|
195
|
+
/**
|
196
|
+
* @param { import('@lezer/lr').InputStream } input
|
197
|
+
* @param { number } [offset]
|
198
|
+
* @param { boolean } [namePart]
|
199
|
+
*
|
200
|
+
* @return { { token: string, offset: number } | null }
|
201
|
+
*/
|
202
|
+
function parseIdentifier(input, offset = 0, namePart = false) {
|
203
|
+
for (let inside = false, chars = [], i = 0;; i++) {
|
204
|
+
const next = input.peek(offset + i);
|
205
|
+
|
206
|
+
if (isStartChar(next) || ((inside || namePart) && isPartChar(next))) {
|
207
|
+
if (!inside) {
|
208
|
+
inside = true;
|
209
|
+
}
|
210
|
+
|
211
|
+
chars.push(next);
|
212
|
+
} else {
|
213
|
+
|
214
|
+
if (chars.length) {
|
215
|
+
return {
|
216
|
+
token: String.fromCharCode(...chars),
|
217
|
+
offset: i
|
218
|
+
};
|
219
|
+
}
|
220
|
+
|
221
|
+
return null;
|
222
|
+
}
|
223
|
+
}
|
224
|
+
}
|
225
|
+
|
226
|
+
/**
|
227
|
+
* @param { import('@lezer/lr').InputStream } input
|
228
|
+
* @param { number } offset
|
229
|
+
*
|
230
|
+
* @return { { token: string, offset: number } | null }
|
231
|
+
*/
|
232
|
+
function parseSpaces(input, offset) {
|
233
|
+
|
234
|
+
for (let inside = false, i = 0;; i++) {
|
235
|
+
let next = input.peek(offset + i);
|
236
|
+
|
237
|
+
if (isSpace(next)) {
|
238
|
+
if (!inside) {
|
239
|
+
inside = true;
|
240
|
+
}
|
241
|
+
} else {
|
242
|
+
if (inside) {
|
243
|
+
return {
|
244
|
+
token: ' ',
|
245
|
+
offset: i
|
246
|
+
};
|
247
|
+
}
|
248
|
+
|
249
|
+
return null;
|
250
|
+
}
|
251
|
+
}
|
252
|
+
}
|
253
|
+
|
254
|
+
/**
|
255
|
+
* Parse a name from the input and return the first match, if any.
|
256
|
+
*
|
257
|
+
* @param { import('@lezer/lr').InputStream } input
|
258
|
+
* @param { Variables } variables
|
259
|
+
*
|
260
|
+
* @return { { token: string, offset: number, term: number } | null }
|
261
|
+
*/
|
262
|
+
function parseName(input, variables) {
|
263
|
+
const contextKeys = variables.contextKeys();
|
264
|
+
|
265
|
+
const start = variables.tokens;
|
266
|
+
|
267
|
+
for (let i = 0, tokens = [], nextMatch = null;;) {
|
268
|
+
|
269
|
+
const namePart = (start.length + tokens.length) > 0;
|
270
|
+
const maybeSpace = tokens.length > 0;
|
271
|
+
|
272
|
+
const match = (
|
273
|
+
parseIdentifier(input, i, namePart) ||
|
274
|
+
namePart && parseAdditionalSymbol(input, i) ||
|
275
|
+
maybeSpace && parseSpaces(input, i)
|
276
|
+
);
|
277
|
+
|
278
|
+
// match is required
|
279
|
+
if (!match) {
|
280
|
+
return nextMatch;
|
281
|
+
}
|
282
|
+
|
283
|
+
const {
|
284
|
+
token,
|
285
|
+
offset
|
286
|
+
} = match;
|
287
|
+
|
288
|
+
i += offset;
|
289
|
+
|
290
|
+
if (token === ' ') {
|
291
|
+
continue;
|
292
|
+
}
|
293
|
+
|
294
|
+
tokens = [ ...tokens, token ];
|
295
|
+
|
296
|
+
const name = [ ...start, ...tokens ].join(' ');
|
297
|
+
|
298
|
+
if (contextKeys.some(el => el === name)) {
|
299
|
+
const token = tokens[0];
|
300
|
+
|
301
|
+
nextMatch = {
|
302
|
+
token,
|
303
|
+
offset: token.length,
|
304
|
+
term: nameIdentifier
|
305
|
+
};
|
306
|
+
}
|
307
|
+
|
308
|
+
if (contextKeys.some(el => el.startsWith(name))) {
|
309
|
+
continue;
|
310
|
+
}
|
311
|
+
|
312
|
+
if (dateTimeIdentifiers.some(el => el === name)) {
|
313
|
+
const token = tokens[0];
|
314
|
+
|
315
|
+
// parse date time identifiers as normal
|
316
|
+
// identifiers to allow specialization to kick in
|
317
|
+
//
|
318
|
+
// cf. https://github.com/nikku/lezer-feel/issues/8
|
319
|
+
nextMatch = {
|
320
|
+
token,
|
321
|
+
offset: token.length,
|
322
|
+
term: identifier
|
323
|
+
};
|
324
|
+
}
|
325
|
+
|
326
|
+
if (dateTimeIdentifiers.some(el => el.startsWith(name))) {
|
327
|
+
continue;
|
328
|
+
}
|
329
|
+
|
330
|
+
return nextMatch;
|
331
|
+
}
|
332
|
+
|
333
|
+
}
|
334
|
+
|
335
|
+
const identifiersMap = {
|
336
|
+
[ identifier ]: 'identifier',
|
337
|
+
[ nameIdentifier ]: 'nameIdentifier'
|
338
|
+
};
|
339
|
+
|
340
|
+
const identifiers = new ExternalTokenizer((input, stack) => {
|
341
|
+
|
342
|
+
LOG_PARSE_DEBUG && console.log('%s: T <identifier | nameIdentifier>', input.pos);
|
343
|
+
|
344
|
+
const nameMatch = parseName(input, stack.context);
|
345
|
+
|
346
|
+
const start = stack.context.tokens;
|
347
|
+
|
348
|
+
const match = nameMatch || parseIdentifier(input, 0, start.length > 0);
|
349
|
+
|
350
|
+
if (match) {
|
351
|
+
input.advance(match.offset);
|
352
|
+
input.acceptToken(nameMatch ? nameMatch.term : identifier);
|
353
|
+
|
354
|
+
LOG_PARSE && console.log('%s: MATCH <%s> <%s>', input.pos, nameMatch ? identifiersMap[nameMatch.term] : 'identifier', match.token);
|
355
|
+
}
|
356
|
+
}, { contextual: true });
|
357
|
+
|
358
|
+
|
359
|
+
const propertyIdentifiers = new ExternalTokenizer((input, stack) => {
|
360
|
+
|
361
|
+
LOG_PARSE_DEBUG && console.log('%s: T <propertyIdentifier>', input.pos);
|
362
|
+
|
363
|
+
const start = stack.context.tokens;
|
364
|
+
|
365
|
+
const match = parseIdentifier(input, 0, start.length > 0);
|
366
|
+
|
367
|
+
if (match) {
|
368
|
+
input.advance(match.offset);
|
369
|
+
input.acceptToken(propertyIdentifier);
|
370
|
+
|
371
|
+
LOG_PARSE && console.log('%s: MATCH <propertyIdentifier> <%s>', input.pos, match.token);
|
372
|
+
}
|
373
|
+
});
|
374
|
+
|
375
|
+
|
376
|
+
const insertSemicolon = new ExternalTokenizer((input, stack) => {
|
377
|
+
|
378
|
+
LOG_PARSE_DEBUG && console.log('%s: T <insertSemi>', input.pos);
|
379
|
+
|
380
|
+
let offset;
|
381
|
+
let insert = false;
|
382
|
+
|
383
|
+
for (offset = 0;; offset++) {
|
384
|
+
const char = input.peek(offset);
|
385
|
+
|
386
|
+
if (spaceChars.includes(char)) {
|
387
|
+
continue;
|
388
|
+
}
|
389
|
+
|
390
|
+
if (newlineChars.includes(char)) {
|
391
|
+
insert = true;
|
392
|
+
}
|
393
|
+
|
394
|
+
break;
|
395
|
+
}
|
396
|
+
|
397
|
+
if (insert) {
|
398
|
+
|
399
|
+
const identifier = parseIdentifier(input, offset + 1);
|
400
|
+
const spaces = parseSpaces(input, offset + 1);
|
401
|
+
|
402
|
+
if (spaces || identifier && /^(then|else|return|satisfies)$/.test(identifier.token)) {
|
403
|
+
return;
|
404
|
+
}
|
405
|
+
|
406
|
+
LOG_PARSE && console.log('%s: MATCH <insertSemi>', input.pos);
|
407
|
+
input.acceptToken(insertSemi);
|
408
|
+
}
|
409
|
+
});
|
410
|
+
|
411
|
+
const prefixedContextStarts = {
|
412
|
+
[ functionInvocationStart ]: 'FunctionInvocation',
|
413
|
+
[ filterExpressionStart ]: 'FilterExpression',
|
414
|
+
[ pathExpressionStart ]: 'PathExpression'
|
415
|
+
};
|
416
|
+
|
417
|
+
const contextStarts = {
|
418
|
+
[ contextStart ]: 'Context',
|
419
|
+
[ functionDefinitionStart ]: 'FunctionDefinition',
|
420
|
+
[ forExpressionStart ]: 'ForExpression',
|
421
|
+
[ listStart ]: 'List',
|
422
|
+
[ ifExpressionStart ]: 'IfExpression',
|
423
|
+
[ quantifiedExpressionStart ]: 'QuantifiedExpression'
|
424
|
+
};
|
425
|
+
|
426
|
+
const contextEnds = {
|
427
|
+
[ Context ]: 'Context',
|
428
|
+
[ FunctionDefinition ]: 'FunctionDefinition',
|
429
|
+
[ ForExpression ]: 'ForExpression',
|
430
|
+
[ List ]: 'List',
|
431
|
+
[ IfExpression ]: 'IfExpression',
|
432
|
+
[ QuantifiedExpression ]: 'QuantifiedExpression',
|
433
|
+
[ PathExpression ]: 'PathExpression',
|
434
|
+
[ FunctionInvocation ]: 'FunctionInvocation',
|
435
|
+
[ FilterExpression ]: 'FilterExpression',
|
436
|
+
[ ArithmeticExpression ]: 'ArithmeticExpression'
|
437
|
+
};
|
438
|
+
|
439
|
+
/**
|
440
|
+
* A simple producer that retrievs a value from
|
441
|
+
* a given context. Used to lazily take things.
|
442
|
+
*/
|
443
|
+
class ValueProducer {
|
444
|
+
|
445
|
+
/**
|
446
|
+
* @param { Function } fn
|
447
|
+
*/
|
448
|
+
constructor(fn) {
|
449
|
+
this.fn = fn;
|
450
|
+
}
|
451
|
+
|
452
|
+
get(variables) {
|
453
|
+
return this.fn(variables);
|
454
|
+
}
|
455
|
+
|
456
|
+
/**
|
457
|
+
* @param { Function } fn
|
458
|
+
*
|
459
|
+
* @return { ValueProducer }
|
460
|
+
*/
|
461
|
+
static of(fn) {
|
462
|
+
return new ValueProducer(fn);
|
463
|
+
}
|
464
|
+
|
465
|
+
}
|
466
|
+
|
467
|
+
const dateTimeLiterals = {
|
468
|
+
'date and time': 1,
|
469
|
+
'date': 1,
|
470
|
+
'time': 1,
|
471
|
+
'duration': 1
|
472
|
+
};
|
473
|
+
|
474
|
+
const dateTimeIdentifiers = Object.keys(dateTimeLiterals);
|
475
|
+
|
476
|
+
|
477
|
+
/**
|
478
|
+
* A basic key-value store to hold context values.
|
479
|
+
*/
|
480
|
+
class VariableContext {
|
481
|
+
|
482
|
+
/**
|
483
|
+
* Creates a new context from a JavaScript object.
|
484
|
+
*
|
485
|
+
* @param {any} [value]
|
486
|
+
*/
|
487
|
+
constructor(value = {}) {
|
488
|
+
|
489
|
+
/**
|
490
|
+
* @protected
|
491
|
+
*/
|
492
|
+
this.value = value;
|
493
|
+
}
|
494
|
+
|
495
|
+
/**
|
496
|
+
* Return all defined keys of the context.
|
497
|
+
*
|
498
|
+
* @returns {Array<string>} the keys of the context
|
499
|
+
*/
|
500
|
+
getKeys() {
|
501
|
+
return Object.keys(this.value);
|
502
|
+
}
|
503
|
+
|
504
|
+
/**
|
505
|
+
* Returns the value of the given key.
|
506
|
+
*
|
507
|
+
* If the value represents a context itself, it should be wrapped in a
|
508
|
+
* context class.
|
509
|
+
*
|
510
|
+
* @param {String} key
|
511
|
+
* @returns {VariableContext|ValueProducer|null}
|
512
|
+
*/
|
513
|
+
get(key) {
|
514
|
+
const result = this.value[key];
|
515
|
+
|
516
|
+
const constructor = /** @type { typeof VariableContext } */ (this.constructor);
|
517
|
+
|
518
|
+
if (constructor.isAtomic(result)) {
|
519
|
+
return result;
|
520
|
+
}
|
521
|
+
|
522
|
+
return constructor.of(result);
|
523
|
+
}
|
524
|
+
|
525
|
+
/**
|
526
|
+
* Creates a new context with the given key added.
|
527
|
+
*
|
528
|
+
* @param {String} key
|
529
|
+
* @param {any} value
|
530
|
+
*
|
531
|
+
* @returns {VariableContext} new context with the given key added
|
532
|
+
*/
|
533
|
+
set(key, value) {
|
534
|
+
|
535
|
+
const constructor = /** @type { typeof VariableContext } */ (this.constructor);
|
536
|
+
|
537
|
+
return constructor.of({
|
538
|
+
...this.value,
|
539
|
+
[key]: value
|
540
|
+
});
|
541
|
+
}
|
542
|
+
|
543
|
+
/**
|
544
|
+
* Non-destructively merge another context into this one,
|
545
|
+
* and return the result.
|
546
|
+
*
|
547
|
+
* @param {ContextValue} other
|
548
|
+
*
|
549
|
+
* @return {VariableContext}
|
550
|
+
*/
|
551
|
+
merge(other) {
|
552
|
+
const constructor = /** @type { typeof VariableContext } */ (this.constructor);
|
553
|
+
|
554
|
+
return new constructor(
|
555
|
+
constructor.__merge(this.value, other)
|
556
|
+
);
|
557
|
+
}
|
558
|
+
|
559
|
+
/**
|
560
|
+
* Wether the given value is atomic. Non-atomic values need to be wrapped in a
|
561
|
+
* context Class.
|
562
|
+
*
|
563
|
+
* @param {any} value
|
564
|
+
* @returns {Boolean}
|
565
|
+
*/
|
566
|
+
static isAtomic(value) {
|
567
|
+
return !value ||
|
568
|
+
value instanceof this ||
|
569
|
+
value instanceof ValueProducer ||
|
570
|
+
typeof value !== 'object';
|
571
|
+
}
|
572
|
+
|
573
|
+
/**
|
574
|
+
* Takes any number of Contexts and merges them into a single context.
|
575
|
+
*
|
576
|
+
* @param { ...VariableContext } contexts
|
577
|
+
* @returns { VariableContext }
|
578
|
+
*/
|
579
|
+
static of(...contexts) {
|
580
|
+
return contexts.reduce((context, otherContext) => {
|
581
|
+
return context.merge(otherContext);
|
582
|
+
}, new this({}));
|
583
|
+
}
|
584
|
+
|
585
|
+
/**
|
586
|
+
* Returns the raw representation of the given context.
|
587
|
+
*
|
588
|
+
* @param {VariableContext | any} context
|
589
|
+
*
|
590
|
+
* @return {any}
|
591
|
+
*/
|
592
|
+
static __unwrap(context) {
|
593
|
+
if (!context) {
|
594
|
+
return {};
|
595
|
+
}
|
596
|
+
|
597
|
+
if (context instanceof this) {
|
598
|
+
return context.value;
|
599
|
+
}
|
600
|
+
|
601
|
+
if (typeof context !== 'object') {
|
602
|
+
return {};
|
603
|
+
}
|
604
|
+
|
605
|
+
return { ...context };
|
606
|
+
}
|
607
|
+
|
608
|
+
/**
|
609
|
+
* Non-destructively merges two contexts (or their values)
|
610
|
+
* with each other, returning the result.
|
611
|
+
*
|
612
|
+
* @param {ContextValue} context
|
613
|
+
* @param {ContextValue} other
|
614
|
+
*
|
615
|
+
* @return {any}
|
616
|
+
*/
|
617
|
+
static __merge(context, other) {
|
618
|
+
|
619
|
+
return reduce(this.__unwrap(other), (merged, value, key) => {
|
620
|
+
if (value instanceof ValueProducer) {
|
621
|
+
|
622
|
+
// keep value producers in tact
|
623
|
+
return {
|
624
|
+
...merged,
|
625
|
+
[key]: value
|
626
|
+
};
|
627
|
+
}
|
628
|
+
|
629
|
+
value = this.__unwrap(value);
|
630
|
+
|
631
|
+
if (has(merged, key)) {
|
632
|
+
value = this.__merge(this.__unwrap(merged[key]), value);
|
633
|
+
}
|
634
|
+
|
635
|
+
return {
|
636
|
+
...merged,
|
637
|
+
[key]: value
|
638
|
+
};
|
639
|
+
}, this.__unwrap(context));
|
640
|
+
}
|
641
|
+
|
642
|
+
}
|
643
|
+
|
644
|
+
class Variables {
|
645
|
+
|
646
|
+
/**
|
647
|
+
* @param { {
|
648
|
+
* name?: string,
|
649
|
+
* tokens?: string[],
|
650
|
+
* children?: Variables[],
|
651
|
+
* parent: Variables | null
|
652
|
+
* context: VariableContext,
|
653
|
+
* value?: any,
|
654
|
+
* raw?: any
|
655
|
+
* } } options
|
656
|
+
*/
|
657
|
+
constructor({
|
658
|
+
name = 'Expressions',
|
659
|
+
tokens = [],
|
660
|
+
children = [],
|
661
|
+
parent = null,
|
662
|
+
context,
|
663
|
+
value,
|
664
|
+
raw
|
665
|
+
}) {
|
666
|
+
this.name = name;
|
667
|
+
this.tokens = tokens;
|
668
|
+
this.children = children;
|
669
|
+
this.parent = parent;
|
670
|
+
this.context = context;
|
671
|
+
this.value = value;
|
672
|
+
this.raw = raw;
|
673
|
+
}
|
674
|
+
|
675
|
+
enterScope(name) {
|
676
|
+
|
677
|
+
const childScope = this.of({
|
678
|
+
name,
|
679
|
+
parent: this
|
680
|
+
});
|
681
|
+
|
682
|
+
LOG_VARS && console.log('[%s] enter', childScope.path, childScope.context);
|
683
|
+
|
684
|
+
return childScope;
|
685
|
+
}
|
686
|
+
|
687
|
+
exitScope(str) {
|
688
|
+
|
689
|
+
if (!this.parent) {
|
690
|
+
LOG_VARS && console.log('[%s] NO exit %o\n%s', this.path, this.context, indent(str, ' '));
|
691
|
+
|
692
|
+
return this;
|
693
|
+
}
|
694
|
+
|
695
|
+
LOG_VARS && console.log('[%s] exit %o\n%s', this.path, this.context, indent(str, ' '));
|
696
|
+
|
697
|
+
return this.parent.pushChild(this);
|
698
|
+
}
|
699
|
+
|
700
|
+
token(part) {
|
701
|
+
|
702
|
+
LOG_VARS && console.log('[%s] token <%s> + <%s>', this.path, this.tokens.join(' '), part);
|
703
|
+
|
704
|
+
return this.assign({
|
705
|
+
tokens: [ ...this.tokens, part ]
|
706
|
+
});
|
707
|
+
}
|
708
|
+
|
709
|
+
literal(value) {
|
710
|
+
|
711
|
+
LOG_VARS && console.log('[%s] literal %o', this.path, value);
|
712
|
+
|
713
|
+
return this.pushChild(this.of({
|
714
|
+
name: 'Literal',
|
715
|
+
value
|
716
|
+
}));
|
717
|
+
}
|
718
|
+
|
719
|
+
/**
|
720
|
+
* Return computed scope value
|
721
|
+
*
|
722
|
+
* @return {any}
|
723
|
+
*/
|
724
|
+
computedValue() {
|
725
|
+
for (let scope = this;;scope = last(scope.children)) {
|
726
|
+
|
727
|
+
if (!scope) {
|
728
|
+
return null;
|
729
|
+
}
|
730
|
+
|
731
|
+
if (scope.value) {
|
732
|
+
return scope.value;
|
733
|
+
}
|
734
|
+
}
|
735
|
+
}
|
736
|
+
|
737
|
+
contextKeys() {
|
738
|
+
return this.context.getKeys().map(normalizeContextKey);
|
739
|
+
}
|
740
|
+
|
741
|
+
get path() {
|
742
|
+
return this.parent?.path?.concat(' > ', this.name) || this.name;
|
743
|
+
}
|
744
|
+
|
745
|
+
/**
|
746
|
+
* Return value of variable.
|
747
|
+
*
|
748
|
+
* @param { string } variable
|
749
|
+
* @return { any } value
|
750
|
+
*/
|
751
|
+
get(variable) {
|
752
|
+
|
753
|
+
const names = [ variable, variable && normalizeContextKey(variable) ];
|
754
|
+
|
755
|
+
const contextKey = this.context.getKeys().find(
|
756
|
+
key => names.includes(normalizeContextKey(key))
|
757
|
+
);
|
758
|
+
|
759
|
+
if (typeof contextKey === 'undefined') {
|
760
|
+
return undefined;
|
761
|
+
}
|
762
|
+
|
763
|
+
const val = this.context.get(contextKey);
|
764
|
+
|
765
|
+
if (val instanceof ValueProducer) {
|
766
|
+
return val.get(this);
|
767
|
+
} else {
|
768
|
+
return val;
|
769
|
+
}
|
770
|
+
}
|
771
|
+
|
772
|
+
resolveName() {
|
773
|
+
|
774
|
+
const variable = this.tokens.join(' ');
|
775
|
+
const tokens = [];
|
776
|
+
|
777
|
+
const parentScope = this.assign({
|
778
|
+
tokens
|
779
|
+
});
|
780
|
+
|
781
|
+
const variableScope = this.of({
|
782
|
+
name: 'VariableName',
|
783
|
+
parent: parentScope,
|
784
|
+
value: this.get(variable),
|
785
|
+
raw: variable
|
786
|
+
});
|
787
|
+
|
788
|
+
LOG_VARS && console.log('[%s] resolve name <%s=%s>', variableScope.path, variable, this.get(variable));
|
789
|
+
|
790
|
+
return parentScope.pushChild(variableScope);
|
791
|
+
}
|
792
|
+
|
793
|
+
pushChild(child) {
|
794
|
+
|
795
|
+
if (!child) {
|
796
|
+
return this;
|
797
|
+
}
|
798
|
+
|
799
|
+
const parent = this.assign({
|
800
|
+
children: [ ...this.children, child ]
|
801
|
+
});
|
802
|
+
|
803
|
+
child.parent = parent;
|
804
|
+
|
805
|
+
return parent;
|
806
|
+
}
|
807
|
+
|
808
|
+
pushChildren(children) {
|
809
|
+
|
810
|
+
/**
|
811
|
+
* @type {Variables}
|
812
|
+
*/
|
813
|
+
let parent = this;
|
814
|
+
|
815
|
+
for (const child of children) {
|
816
|
+
parent = parent.pushChild(child);
|
817
|
+
}
|
818
|
+
|
819
|
+
return parent;
|
820
|
+
}
|
821
|
+
|
822
|
+
declareName() {
|
823
|
+
|
824
|
+
if (this.tokens.length === 0) {
|
825
|
+
throw Error('no tokens to declare name');
|
826
|
+
}
|
827
|
+
|
828
|
+
const variableName = this.tokens.join(' ');
|
829
|
+
|
830
|
+
LOG_VARS && console.log('[%s] declareName <%s>', this.path, variableName);
|
831
|
+
|
832
|
+
return this.assign({
|
833
|
+
tokens: []
|
834
|
+
}).pushChild(
|
835
|
+
this.of({
|
836
|
+
name: 'Name',
|
837
|
+
value: variableName
|
838
|
+
})
|
839
|
+
);
|
840
|
+
}
|
841
|
+
|
842
|
+
define(name, value) {
|
843
|
+
|
844
|
+
if (typeof name !== 'string') {
|
845
|
+
LOG_VARS && console.log('[%s] no define <%s=%s>', this.path, name, value);
|
846
|
+
|
847
|
+
return this;
|
848
|
+
}
|
849
|
+
|
850
|
+
LOG_VARS && console.log('[%s] define <%s=%s>', this.path, name, value);
|
851
|
+
|
852
|
+
const context = this.context.set(name, value);
|
853
|
+
|
854
|
+
return this.assign({
|
855
|
+
context
|
856
|
+
});
|
857
|
+
}
|
858
|
+
|
859
|
+
/**
|
860
|
+
* @param { Record<string, any> } [options]
|
861
|
+
*
|
862
|
+
* @return { Variables }
|
863
|
+
*/
|
864
|
+
assign(options = {}) {
|
865
|
+
|
866
|
+
return Variables.of({
|
867
|
+
...this,
|
868
|
+
...options
|
869
|
+
});
|
870
|
+
}
|
871
|
+
|
872
|
+
/**
|
873
|
+
* @param { Record<string, any> } [options]
|
874
|
+
*
|
875
|
+
* @return { Variables }
|
876
|
+
*/
|
877
|
+
of(options = {}) {
|
878
|
+
|
879
|
+
const defaultOptions = {
|
880
|
+
context: this.context,
|
881
|
+
parent: this.parent
|
882
|
+
};
|
883
|
+
|
884
|
+
return Variables.of({
|
885
|
+
...defaultOptions,
|
886
|
+
...options
|
887
|
+
});
|
888
|
+
}
|
889
|
+
|
890
|
+
/**
|
891
|
+
* @param { {
|
892
|
+
* name?: string,
|
893
|
+
* tokens?: string[],
|
894
|
+
* children?: Variables[],
|
895
|
+
* parent?: Variables | null
|
896
|
+
* context: VariableContext,
|
897
|
+
* value?: any,
|
898
|
+
* raw?: any
|
899
|
+
* } } options
|
900
|
+
*
|
901
|
+
* @return {Variables}
|
902
|
+
*/
|
903
|
+
static of(options) {
|
904
|
+
|
905
|
+
const {
|
906
|
+
name,
|
907
|
+
tokens = [],
|
908
|
+
children = [],
|
909
|
+
parent = null,
|
910
|
+
context,
|
911
|
+
value,
|
912
|
+
raw
|
913
|
+
} = options;
|
914
|
+
|
915
|
+
if (!context) {
|
916
|
+
throw new Error('must provide <context>');
|
917
|
+
}
|
918
|
+
|
919
|
+
return new Variables({
|
920
|
+
name,
|
921
|
+
tokens: [ ...tokens ],
|
922
|
+
children: [ ...children ],
|
923
|
+
context,
|
924
|
+
parent,
|
925
|
+
value,
|
926
|
+
raw
|
927
|
+
});
|
928
|
+
}
|
929
|
+
|
930
|
+
}
|
931
|
+
|
932
|
+
/**
|
933
|
+
* @param { string } name
|
934
|
+
*
|
935
|
+
* @return { string } normalizedName
|
936
|
+
*/
|
937
|
+
function normalizeContextKey(name) {
|
938
|
+
return name.replace(/\s*([./\-'+]|\*\*?)\s*/g, ' $1 ').replace(/\s{2,}/g, ' ').trim();
|
939
|
+
}
|
940
|
+
|
941
|
+
/**
|
942
|
+
* Wrap children of variables under the given named child.
|
943
|
+
*
|
944
|
+
* @param { Variables } variables
|
945
|
+
* @param { string } scopeName
|
946
|
+
* @param { string } code
|
947
|
+
* @return { Variables }
|
948
|
+
*/
|
949
|
+
function wrap(variables, scopeName, code) {
|
950
|
+
|
951
|
+
const parts = variables.children.filter(c => c.name !== scopeName);
|
952
|
+
const children = variables.children.filter(c => c.name === scopeName);
|
953
|
+
|
954
|
+
const namePart = parts[0];
|
955
|
+
const valuePart = parts[Math.max(1, parts.length - 1)];
|
956
|
+
|
957
|
+
const name = namePart?.computedValue();
|
958
|
+
const value = valuePart?.computedValue() || null;
|
959
|
+
|
960
|
+
return variables
|
961
|
+
.assign({
|
962
|
+
children
|
963
|
+
})
|
964
|
+
.enterScope(scopeName)
|
965
|
+
.pushChildren(parts)
|
966
|
+
.exitScope(code)
|
967
|
+
.define(name, value);
|
968
|
+
}
|
969
|
+
|
970
|
+
/**
|
971
|
+
* @param { ContextValue } [context]
|
972
|
+
* @param { typeof VariableContext } [Context]
|
973
|
+
*
|
974
|
+
* @return { ContextTracker<Variables> }
|
975
|
+
*/
|
976
|
+
function trackVariables(context = {}, Context = VariableContext) {
|
977
|
+
|
978
|
+
const start = Variables.of({
|
979
|
+
context: Context.of(context)
|
980
|
+
});
|
981
|
+
|
982
|
+
return new ContextTracker({
|
983
|
+
start,
|
984
|
+
reduce(variables, term, stack, input) {
|
985
|
+
|
986
|
+
if (term === IfExpression) {
|
987
|
+
const [ thenPart, elsePart ] = variables.children.slice(-2);
|
988
|
+
|
989
|
+
variables = variables.assign({
|
990
|
+
value: Context.of(
|
991
|
+
thenPart?.computedValue(),
|
992
|
+
elsePart?.computedValue()
|
993
|
+
)
|
994
|
+
});
|
995
|
+
}
|
996
|
+
|
997
|
+
if (term === List) {
|
998
|
+
variables = variables.assign({
|
999
|
+
value: Context.of(
|
1000
|
+
...variables.children.map(
|
1001
|
+
c => c?.computedValue()
|
1002
|
+
)
|
1003
|
+
)
|
1004
|
+
});
|
1005
|
+
}
|
1006
|
+
|
1007
|
+
if (term === FilterExpression) {
|
1008
|
+
const [ sourcePart, _ ] = variables.children.slice(-2);
|
1009
|
+
|
1010
|
+
variables = variables.assign({
|
1011
|
+
value: sourcePart?.computedValue()
|
1012
|
+
});
|
1013
|
+
}
|
1014
|
+
|
1015
|
+
if (term === FunctionInvocation) {
|
1016
|
+
|
1017
|
+
const [
|
1018
|
+
name,
|
1019
|
+
...args
|
1020
|
+
] = variables.children;
|
1021
|
+
|
1022
|
+
// preserve type information through `get value(context, key)` utility
|
1023
|
+
if (name?.raw === 'get value') {
|
1024
|
+
variables = getContextValue(variables, args);
|
1025
|
+
}
|
1026
|
+
}
|
1027
|
+
|
1028
|
+
const start = contextStarts[term];
|
1029
|
+
|
1030
|
+
if (start) {
|
1031
|
+
return variables.enterScope(start);
|
1032
|
+
}
|
1033
|
+
|
1034
|
+
const prefixedStart = prefixedContextStarts[term];
|
1035
|
+
|
1036
|
+
// pull <expression> into new <prefixedStart> context
|
1037
|
+
if (prefixedStart) {
|
1038
|
+
|
1039
|
+
const {
|
1040
|
+
children: currentChildren,
|
1041
|
+
context: currentContext,
|
1042
|
+
} = variables;
|
1043
|
+
|
1044
|
+
const children = currentChildren.slice(0, -1);
|
1045
|
+
const lastChild = last(currentChildren);
|
1046
|
+
|
1047
|
+
let newContext = null;
|
1048
|
+
|
1049
|
+
if (term === pathExpressionStart) {
|
1050
|
+
newContext = Context.of(lastChild?.computedValue());
|
1051
|
+
}
|
1052
|
+
|
1053
|
+
if (term === filterExpressionStart) {
|
1054
|
+
newContext = Context.of(
|
1055
|
+
currentContext,
|
1056
|
+
lastChild?.computedValue()
|
1057
|
+
).set('item', lastChild?.computedValue());
|
1058
|
+
}
|
1059
|
+
|
1060
|
+
return variables
|
1061
|
+
.assign({ children })
|
1062
|
+
.enterScope(prefixedStart)
|
1063
|
+
.pushChild(lastChild)
|
1064
|
+
.assign({ context: newContext || currentContext });
|
1065
|
+
}
|
1066
|
+
|
1067
|
+
// @ts-expect-error internal method
|
1068
|
+
const code = input.read(input.pos, stack.pos);
|
1069
|
+
|
1070
|
+
const end = contextEnds[term];
|
1071
|
+
|
1072
|
+
if (end) {
|
1073
|
+
return variables.exitScope(code);
|
1074
|
+
}
|
1075
|
+
|
1076
|
+
if (term === ContextEntry) {
|
1077
|
+
const parts = variables.children.filter(c => c.name !== 'ContextEntry');
|
1078
|
+
|
1079
|
+
const name = parts[0];
|
1080
|
+
const value = last(parts);
|
1081
|
+
|
1082
|
+
return wrap(variables, 'ContextEntry', code).assign(
|
1083
|
+
{
|
1084
|
+
value: Context
|
1085
|
+
.of(variables.value)
|
1086
|
+
.set(name?.computedValue(), value?.computedValue())
|
1087
|
+
}
|
1088
|
+
);
|
1089
|
+
}
|
1090
|
+
|
1091
|
+
if (
|
1092
|
+
term === ForInExpression ||
|
1093
|
+
term === QuantifiedInExpression
|
1094
|
+
) {
|
1095
|
+
return wrap(variables, 'InExpression', code);
|
1096
|
+
}
|
1097
|
+
|
1098
|
+
// define <partial> within ForExpression body
|
1099
|
+
if (term === forExpressionBodyStart) {
|
1100
|
+
|
1101
|
+
return variables.define(
|
1102
|
+
'partial',
|
1103
|
+
ValueProducer.of(variables => {
|
1104
|
+
return last(variables.children)?.computedValue();
|
1105
|
+
})
|
1106
|
+
);
|
1107
|
+
}
|
1108
|
+
|
1109
|
+
if (
|
1110
|
+
term === ParameterName
|
1111
|
+
) {
|
1112
|
+
const name = last(variables.children).computedValue();
|
1113
|
+
|
1114
|
+
// TODO: attach type information
|
1115
|
+
return variables.define(name, 1);
|
1116
|
+
}
|
1117
|
+
|
1118
|
+
// pull <expression> into ArithmeticExpression child
|
1119
|
+
if (
|
1120
|
+
term === arithmeticPlusStart ||
|
1121
|
+
term === arithmeticTimesStart ||
|
1122
|
+
term === arithmeticExpStart
|
1123
|
+
) {
|
1124
|
+
const children = variables.children.slice(0, -1);
|
1125
|
+
const lastChild = last(variables.children);
|
1126
|
+
|
1127
|
+
return variables.assign({
|
1128
|
+
children
|
1129
|
+
}).enterScope('ArithmeticExpression').pushChild(lastChild);
|
1130
|
+
}
|
1131
|
+
|
1132
|
+
if (term === arithmeticUnaryStart) {
|
1133
|
+
return variables.enterScope('ArithmeticExpression');
|
1134
|
+
}
|
1135
|
+
|
1136
|
+
if (
|
1137
|
+
term === Identifier ||
|
1138
|
+
term === AdditionalIdentifier ||
|
1139
|
+
term === PropertyIdentifier
|
1140
|
+
) {
|
1141
|
+
return variables.token(code);
|
1142
|
+
}
|
1143
|
+
|
1144
|
+
if (
|
1145
|
+
term === StringLiteral
|
1146
|
+
) {
|
1147
|
+
return variables.literal(code.replace(/^"|"$/g, ''));
|
1148
|
+
}
|
1149
|
+
|
1150
|
+
if (term === BooleanLiteral) {
|
1151
|
+
return variables.literal(code === 'true' ? true : false);
|
1152
|
+
}
|
1153
|
+
|
1154
|
+
if (term === NumericLiteral) {
|
1155
|
+
return variables.literal(parseFloat(code));
|
1156
|
+
}
|
1157
|
+
|
1158
|
+
if (term === nil) {
|
1159
|
+
return variables.literal(null);
|
1160
|
+
}
|
1161
|
+
|
1162
|
+
if (
|
1163
|
+
term === VariableName
|
1164
|
+
) {
|
1165
|
+
return variables.resolveName();
|
1166
|
+
}
|
1167
|
+
|
1168
|
+
if (
|
1169
|
+
term === Name ||
|
1170
|
+
term === PropertyName
|
1171
|
+
) {
|
1172
|
+
return variables.declareName();
|
1173
|
+
}
|
1174
|
+
|
1175
|
+
if (
|
1176
|
+
term === expression0 ||
|
1177
|
+
term === PositiveUnaryTest
|
1178
|
+
) {
|
1179
|
+
if (variables.tokens.length > 0) {
|
1180
|
+
throw new Error('uncleared name');
|
1181
|
+
}
|
1182
|
+
}
|
1183
|
+
|
1184
|
+
if (term === expression0) {
|
1185
|
+
|
1186
|
+
let parent = variables;
|
1187
|
+
|
1188
|
+
while (parent.parent) {
|
1189
|
+
parent = parent.exitScope(code);
|
1190
|
+
}
|
1191
|
+
|
1192
|
+
return parent;
|
1193
|
+
}
|
1194
|
+
|
1195
|
+
return variables;
|
1196
|
+
}
|
1197
|
+
});
|
1198
|
+
}
|
1199
|
+
|
1200
|
+
const variableTracker = trackVariables({});
|
1201
|
+
|
1202
|
+
|
1203
|
+
// helpers //////////////
|
1204
|
+
|
1205
|
+
function getContextValue(variables, args) {
|
1206
|
+
|
1207
|
+
if (!args.length) {
|
1208
|
+
return variables.assign({
|
1209
|
+
value: null
|
1210
|
+
});
|
1211
|
+
}
|
1212
|
+
|
1213
|
+
if (args[0].name === 'Name') {
|
1214
|
+
args = extractNamedArgs(args, [ 'm', 'key' ]);
|
1215
|
+
}
|
1216
|
+
|
1217
|
+
if (args.length !== 2) {
|
1218
|
+
return variables.assign({
|
1219
|
+
value: null
|
1220
|
+
});
|
1221
|
+
}
|
1222
|
+
|
1223
|
+
const [
|
1224
|
+
context,
|
1225
|
+
key
|
1226
|
+
] = args;
|
1227
|
+
|
1228
|
+
const keyValue = key?.computedValue();
|
1229
|
+
const contextValue = context?.computedValue();
|
1230
|
+
|
1231
|
+
if (
|
1232
|
+
(!contextValue || typeof contextValue !== 'object') || typeof keyValue !== 'string'
|
1233
|
+
) {
|
1234
|
+
return variables.assign({
|
1235
|
+
value: null
|
1236
|
+
});
|
1237
|
+
}
|
1238
|
+
|
1239
|
+
return variables.assign({
|
1240
|
+
value: [ normalizeContextKey(keyValue), keyValue ].reduce((value, keyValue) => {
|
1241
|
+
return contextValue.get(keyValue) || value;
|
1242
|
+
}, null)
|
1243
|
+
});
|
1244
|
+
}
|
1245
|
+
|
1246
|
+
function extractNamedArgs(args, argNames) {
|
1247
|
+
|
1248
|
+
const context = {};
|
1249
|
+
|
1250
|
+
for (let i = 0; i < args.length; i += 2) {
|
1251
|
+
const [ name, value ] = args.slice(i, i + 2);
|
1252
|
+
|
1253
|
+
context[name.value] = value;
|
1254
|
+
}
|
1255
|
+
|
1256
|
+
return argNames.map(name => context[name]);
|
1257
|
+
}
|
1258
|
+
|
1259
|
+
function last(arr) {
|
1260
|
+
return arr[arr.length - 1];
|
1261
|
+
}
|
1262
|
+
|
1263
|
+
const feelHighlighting = styleTags({
|
1264
|
+
StringLiteral: tags.string,
|
1265
|
+
NumericLiteral: tags.number,
|
1266
|
+
BooleanLiteral: tags.bool,
|
1267
|
+
'AtLiteral!': tags.special(tags.string),
|
1268
|
+
CompareOp: tags.compareOperator,
|
1269
|
+
ArithOp: tags.arithmeticOperator,
|
1270
|
+
'for if then else some every satisfies between return': tags.controlKeyword,
|
1271
|
+
'in instance of and or': tags.operatorKeyword,
|
1272
|
+
function: tags.definitionKeyword,
|
1273
|
+
as: tags.keyword,
|
1274
|
+
'Type/...': tags.typeName,
|
1275
|
+
Wildcard: tags.special(tags.variableName),
|
1276
|
+
null: tags.null,
|
1277
|
+
LineComment: tags.lineComment,
|
1278
|
+
BlockComment: tags.blockComment,
|
1279
|
+
'VariableName! "?"': tags.variableName,
|
1280
|
+
'DateTimeConstructor! SpecialFunctionName!': tags.function(tags.special(tags.variableName)),
|
1281
|
+
'List Interval': tags.list,
|
1282
|
+
Context: tags.definition(tags.literal),
|
1283
|
+
'Name!': tags.definition(tags.variableName),
|
1284
|
+
'Key/Name! ContextEntryType/Name!': tags.definition(tags.propertyName),
|
1285
|
+
'PathExpression/VariableName!': tags.function(tags.propertyName),
|
1286
|
+
'FormalParameter/ParameterName!': tags.function(tags.definition(tags.variableName)),
|
1287
|
+
'( )': tags.paren,
|
1288
|
+
'[ ]': tags.squareBracket,
|
1289
|
+
'{ }': tags.brace,
|
1290
|
+
'.': tags.derefOperator,
|
1291
|
+
', ;': tags.separator,
|
1292
|
+
'..': tags.punctuation
|
1293
|
+
});
|
1294
|
+
|
1295
|
+
// This file was generated by lezer-generator. You probably shouldn't edit it.
|
1296
|
+
const spec_identifier = {__proto__:null,for:10, in:32, return:36, if:40, then:42, else:44, some:48, every:50, satisfies:56, or:60, and:64, between:72, instance:86, of:89, days:101, time:103, duration:105, years:107, months:109, date:111, list:117, context:123, function:130, null:156, true:330, false:330, "?":170, external:186, not:211};
|
1297
|
+
const parser = LRParser.deserialize({
|
1298
|
+
version: 14,
|
1299
|
+
states: "C|O`QYOOO`QYOOO$sQYOOOOQU'#Ce'#CeO$}QYO'#C`O&WQYO'#FQOOQQ'#Ff'#FfO&bQYO'#FfO`QYO'#DVOOQU'#En'#EnO(UQ^O'#D]OOQU'#D^'#D^OOQU'#D]'#D]OOQO'#Fn'#FnO*RQWO'#DvOOQQ'#D}'#D}OOQQ'#EO'#EOOOQQ'#EP'#EPO*WOWO'#ESO*RQWO'#EQOOQQ'#EQ'#EQOOQQ'#Ft'#FtOOQQ'#Fr'#FrOOQQ'#Fy'#FyOOQQ'#EU'#EUO`QYO'#EWOOQQ'#FS'#FSO*]Q^O'#FSO,SQYO'#EXO,ZQWO'#EYOOQP'#F}'#F}O,`QXO'#EaOOQQ'#Fz'#FzOOQQ'#FR'#FRQOQWOOOOQ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!p#Z#]#_#c#g#r$O$P$Y$^$_$b$q$}%X%d%y%zR#TwT#Rw$`V!SQ#_#r!X!aT!Q!t!v#P#X#Y#i#n#o#p#q#v$k$o$r%R%S%Z%^%_%b%e%o%w%{&^!Z!bT!Q!t!v#P#X#Y#i#j#n#o#p#q#v$k$o$r%R%S%Z%^%_%b%e%o%w%{&^!]!cT!Q!t!v#P#X#Y#i#j#k#n#o#p#q#v$k$o$r%R%S%Z%^%_%b%e%o%w%{&^!mWOPQWilu|}!]!a!b!c!g!h!i!j!k!p#Z#]#_#c#g#r$O$P$Y$^$_$b$q$}%X%d%y%zR&V%mT&Z%n&t!a!eT!Q!n!t!v#P#X#Y#i#j#k#l#n#o#p#q#v$k$o$r%R%S%Z%^%_%b%e%o%w%{&^!a!gT!Q!n!t!v#P#X#Y#i#j#k#l#n#o#p#q#v$k$o$r%R%S%Z%^%_%b%e%o%w%{&^!m^OPQWilu|}!]!a!b!c!g!h!i!j!k!p#Z#]#_#c#g#r$O$P$Y$^$_$b$q$}%X%d%y%zQ!q^R!scR#z!pQ!wlR#{!p!mfOPQWilu|}!]!a!b!c!g!h!i!j!k!p#Z#]#_#c#g#r$O$P$Y$^$_$b$q$}%X%d%y%z!mlOPQWilu|}!]!a!b!c!g!h!i!j!k!p#Z#]#_#c#g#r$O$P$Y$^$_$b$q$}%X%d%y%z!mmOPQWilu|}!]!a!b!c!g!h!i!j!k!p#Z#]#_#c#g#r$O$P$Y$^$_$b$q$}%X%d%y%zR$U!x!moOPQWilu|}!]!a!b!c!g!h!i!j!k!p#Z#]#_#c#g#r$O$P$Y$^$_$b$q$}%X%d%y%zR#Oo",
|
1302
|
+
nodeNames: "⚠ LineComment BlockComment Expression ForExpression for InExpressions InExpression Name Identifier Identifier ArithOp ArithOp ArithOp ArithOp ArithOp in IterationContext return IfExpression if then else QuantifiedExpression some every InExpressions InExpression satisfies Disjunction or Conjunction and Comparison CompareOp CompareOp between PositiveUnaryTest ( PositiveUnaryTests ) ArithmeticExpression InstanceOfExpression instance of Type QualifiedName VariableName BacktickIdentifier SpecialType days time duration years months date > ListType list < ContextType context ContextEntryTypes ContextEntryType FunctionType function ArgumentTypes ArgumentType PathExpression ] FilterExpression [ FunctionInvocation SpecialFunctionName NamedParameters NamedParameter ParameterName PositionalParameters null NumericLiteral StringLiteral BooleanLiteral DateTimeLiteral DateTimeConstructor AtLiteral ? SimplePositiveUnaryTest Interval ParenthesizedExpression List FunctionDefinition FormalParameters FormalParameter external FunctionBody } { Context ContextEntry Key Name Identifier Expressions UnaryTests Wildcard not",
|
1303
|
+
maxTerm: 173,
|
1304
|
+
context: variableTracker,
|
1305
|
+
nodeProps: [
|
1306
|
+
["group", -17,4,19,23,29,31,33,41,42,68,70,72,85,86,88,89,90,97,"Expr",47,"Expr Expr",-5,78,79,80,81,82,"Expr Literal"],
|
1307
|
+
["closedBy", 38,")",71,"]",96,"}"],
|
1308
|
+
["openedBy", 40,"(",69,"[",95,"{"]
|
1309
|
+
],
|
1310
|
+
propSources: [feelHighlighting],
|
1311
|
+
skippedNodes: [0,1,2],
|
1312
|
+
repeatNodeCount: 14,
|
1313
|
+
tokenData: ".Z~RvXY#iYZ$^Z[#i]^$^pq#iqr$crs$nwx&fxy&kyz&pz{&u{|'S|}'X}!O'^!O!P'k!P!Q(u!Q![*p![!]+X!]!^+^!^!_+c!_!`$i!`!a+r!b!c+|!}#O,R#P#Q,W#Q#R&}#S#T,]#o#p.P#q#r.U$f$g#i#BY#BZ#i$IS$I_#i$I|$I}$^$I}$JO$^$JT$JU#i$KV$KW#i&FU&FV#i?HT?HU#i~#nY#r~XY#iZ[#ipq#i$f$g#i#BY#BZ#i$IS$I_#i$JT$JU#i$KV$KW#i&FU&FV#i?HT?HU#i~$cO#s~~$fP!_!`$i~$nOr~~$sW$j~OY$nZr$nrs%]s#O$n#O#P%b#P;'S$n;'S;=`&`<%lO$n~%bO$j~~%eRO;'S$n;'S;=`%n;=`O$n~%sX$j~OY$nZr$nrs%]s#O$n#O#P%b#P;'S$n;'S;=`&`;=`<%l$n<%lO$n~&cP;=`<%l$n~&kO#{~~&pOv~~&uOx~~&zP^~z{&}~'SO_~~'XO[~~'^O$O~R'cPZP!`!a'fQ'kO$_Q~'pQ#z~!O!P'v!Q!['{~'{O#}~~(QR$i~!Q!['{!g!h(Z#X#Y(Z~(^R{|(g}!O(g!Q![(m~(jP!Q![(m~(rP$i~!Q![(m~(zQ]~z{)Q!P!Q*X~)TTOz)Qz{)d{;'S)Q;'S;=`*R<%lO)Q~)gVOz)Qz{)d{!P)Q!P!Q)|!Q;'S)Q;'S;=`*R<%lO)Q~*ROQ~~*UP;=`<%l)Q~*^SP~OY*XZ;'S*X;'S;=`*j<%lO*X~*mP;=`<%l*X~*uS$i~!O!P+R!Q![*p!g!h(Z#X#Y(Z~+UP!Q!['{~+^O$]~~+cO$s~R+jP!]QsP!_!`+mP+rOsPR+yP!YQsP!_!`+m~,RO$l~~,WO!i~~,]O!g~~,`WOY,]Z#O,]#O#P,x#P#S,]#S#T-t#T;'S,];'S;=`-y<%lO,]~,{RO;'S,];'S;=`-U;=`O,]~-XXOY,]Z#O,]#O#P,x#P#S,]#S#T-t#T;'S,];'S;=`-y;=`<%l,]<%lO,]~-yO$Z~~-|P;=`<%l,]~.UO#S~~.ZO#R~",
|
1314
|
+
tokenizers: [propertyIdentifiers, identifiers, insertSemicolon, 0, 1],
|
1315
|
+
topRules: {"Expression":[0,3],"Expressions":[1,102],"UnaryTests":[2,103]},
|
1316
|
+
dialects: {camunda: 2544},
|
1317
|
+
dynamicPrecedences: {"31":-1,"68":1,"72":-1,"74":-1},
|
1318
|
+
specialized: [{term: 122, get: (value) => spec_identifier[value] || -1}],
|
1319
|
+
tokenPrec: 2546
|
1320
|
+
});
|
1321
|
+
|
1322
|
+
export { VariableContext, normalizeContextKey, parser, trackVariables };
|
1323
|
+
//# sourceMappingURL=index.js.map
|