solve-engine 2.23.0 → 2.25.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/README.md +82 -32
- package/dist/{BytecodeBuilder-aqVa7Plx.d.cts → BytecodeBuilder-DSWKZi4f.d.cts} +11 -9
- package/dist/{BytecodeBuilder-aqVa7Plx.d.ts → BytecodeBuilder-DSWKZi4f.d.ts} +11 -9
- package/dist/{Configuration-BGQn-cJ8.d.cts → Configuration-DnzYPmoK.d.cts} +33 -0
- package/dist/{Configuration-BGQn-cJ8.d.ts → Configuration-DnzYPmoK.d.ts} +33 -0
- package/dist/{EngineError-DTk7I7hZ.d.cts → EngineError-fR1K1rvx.d.cts} +6 -0
- package/dist/{EngineError-DTk7I7hZ.d.ts → EngineError-fR1K1rvx.d.ts} +6 -0
- package/dist/{Lexer-CqagTewQ.d.ts → Lexer-Bmctxl0n.d.ts} +84 -35
- package/dist/{Lexer-CCHFDcgP.d.cts → Lexer-aB95pjoX.d.cts} +84 -35
- package/dist/{PackageCompatibility-BGXSFuL9.d.ts → PackageCompatibility-BludTs7v.d.ts} +1 -1
- package/dist/{PackageCompatibility-BZCqaTOO.d.cts → PackageCompatibility-CUVg8tmt.d.cts} +1 -1
- package/dist/{PackageRegistry-BRoVOYzg.d.ts → PackageRegistry-DT-x32OM.d.ts} +67 -14
- package/dist/{PackageRegistry-rMGnTh7W.d.cts → PackageRegistry-Dvn4i2QK.d.cts} +67 -14
- package/dist/{Parselet-Bkbp9CKD.d.cts → Parselet-BawfGuTF.d.cts} +8 -2
- package/dist/{Parselet-B-WyUtX4.d.ts → Parselet-DqTbbtWA.d.ts} +8 -2
- package/dist/{ScopeManager-gB9UengK.d.ts → ScopeManager-B636am7Y.d.ts} +39 -8
- package/dist/{ScopeManager-bCYewWVt.d.cts → ScopeManager-CdwX0VTw.d.cts} +39 -8
- package/dist/{TokenNormalizer-OTPS0Otq.d.ts → TokenNormalizer-CLBtiE8M.d.ts} +45 -26
- package/dist/{TokenNormalizer-MXaKLJ_m.d.cts → TokenNormalizer-CjTDmHgB.d.cts} +45 -26
- package/dist/{VMCheckpoints-DGar9Yg8.d.cts → VMCheckpoints-CYqeq8IV.d.cts} +3 -3
- package/dist/{VMCheckpoints-BDRY1Kx8.d.ts → VMCheckpoints-DDlxNssY.d.ts} +3 -3
- package/dist/{Value-DCTqTSeP.d.cts → Value-Ds3Gy07C.d.cts} +1 -1
- package/dist/{Value-DCTqTSeP.d.ts → Value-Ds3Gy07C.d.ts} +1 -1
- package/dist/{WorkerError-DGBNM3gA.d.cts → WorkerError-B1dF3VYT.d.cts} +1 -1
- package/dist/{WorkerError-DpZgKRks.d.ts → WorkerError-dneODN-u.d.ts} +1 -1
- package/dist/{chunk-YAONCEAW.cjs → chunk-4BAUQE6A.cjs} +3 -3
- package/dist/{chunk-YAONCEAW.cjs.map → chunk-4BAUQE6A.cjs.map} +1 -1
- package/dist/chunk-4BRTUFTH.js +2 -0
- package/dist/chunk-4BRTUFTH.js.map +1 -0
- package/dist/chunk-4NZXCHQL.cjs +2 -0
- package/dist/chunk-4NZXCHQL.cjs.map +1 -0
- package/dist/chunk-57PSJQQW.js +3 -0
- package/dist/chunk-57PSJQQW.js.map +1 -0
- package/dist/chunk-634ILVMP.cjs +2 -0
- package/dist/chunk-634ILVMP.cjs.map +1 -0
- package/dist/{chunk-HMC7FJO7.js → chunk-63ZOOUOL.js} +2 -2
- package/dist/{chunk-HMC7FJO7.js.map → chunk-63ZOOUOL.js.map} +1 -1
- package/dist/chunk-72PYPENZ.js +2 -0
- package/dist/chunk-72PYPENZ.js.map +1 -0
- package/dist/chunk-77KI7AKJ.cjs +2 -0
- package/dist/chunk-77KI7AKJ.cjs.map +1 -0
- package/dist/chunk-7DP57BA7.js +2 -0
- package/dist/chunk-7DP57BA7.js.map +1 -0
- package/dist/chunk-7N3IJSWF.js +5 -0
- package/dist/chunk-7N3IJSWF.js.map +1 -0
- package/dist/chunk-BMXYR5LI.cjs +2 -0
- package/dist/chunk-BMXYR5LI.cjs.map +1 -0
- package/dist/chunk-DUYTXLO2.js +2 -0
- package/dist/chunk-DUYTXLO2.js.map +1 -0
- package/dist/chunk-EL2XUOWX.js +2 -0
- package/dist/chunk-EL2XUOWX.js.map +1 -0
- package/dist/chunk-FYAMQFZZ.cjs +3 -0
- package/dist/chunk-FYAMQFZZ.cjs.map +1 -0
- package/dist/chunk-FYTB7SDP.cjs +2 -0
- package/dist/chunk-FYTB7SDP.cjs.map +1 -0
- package/dist/chunk-GBCN7FNV.cjs +2 -0
- package/dist/chunk-GBCN7FNV.cjs.map +1 -0
- package/dist/{chunk-7E7NXKQ5.js → chunk-IJHL3LMH.js} +2 -2
- package/dist/chunk-IJHL3LMH.js.map +1 -0
- package/dist/{chunk-4ETS224G.js → chunk-JFZ5SLF7.js} +2 -2
- package/dist/{chunk-4ETS224G.js.map → chunk-JFZ5SLF7.js.map} +1 -1
- package/dist/chunk-JSM3O7EM.cjs +2 -0
- package/dist/chunk-JSM3O7EM.cjs.map +1 -0
- package/dist/chunk-MZMA32NE.js +3 -0
- package/dist/chunk-MZMA32NE.js.map +1 -0
- package/dist/chunk-N4SSR7Q6.js +2 -0
- package/dist/chunk-N4SSR7Q6.js.map +1 -0
- package/dist/{chunk-TL545PXW.cjs → chunk-NEGZZB7F.cjs} +2 -2
- package/dist/{chunk-TL545PXW.cjs.map → chunk-NEGZZB7F.cjs.map} +1 -1
- package/dist/{chunk-3GR46UOX.js → chunk-NMU5E7W7.js} +2 -2
- package/dist/{chunk-3GR46UOX.js.map → chunk-NMU5E7W7.js.map} +1 -1
- package/dist/chunk-OB2VX4IL.js +2 -0
- package/dist/chunk-OB2VX4IL.js.map +1 -0
- package/dist/{chunk-MRRMIBHE.js → chunk-OONQ3V3I.js} +2 -2
- package/dist/{chunk-MRRMIBHE.js.map → chunk-OONQ3V3I.js.map} +1 -1
- package/dist/{chunk-N37PUZJR.cjs → chunk-RAPEZR5L.cjs} +2 -2
- package/dist/{chunk-N37PUZJR.cjs.map → chunk-RAPEZR5L.cjs.map} +1 -1
- package/dist/{chunk-KEA5HRL3.js → chunk-RDYXH7ML.js} +2 -2
- package/dist/{chunk-KEA5HRL3.js.map → chunk-RDYXH7ML.js.map} +1 -1
- package/dist/{chunk-3SSMOVWB.cjs → chunk-SAF3B3AX.cjs} +2 -2
- package/dist/{chunk-3SSMOVWB.cjs.map → chunk-SAF3B3AX.cjs.map} +1 -1
- package/dist/chunk-SPOVFRZO.cjs +5 -0
- package/dist/chunk-SPOVFRZO.cjs.map +1 -0
- package/dist/{chunk-75JLWK4L.cjs → chunk-SQHBOWES.cjs} +2 -2
- package/dist/{chunk-75JLWK4L.cjs.map → chunk-SQHBOWES.cjs.map} +1 -1
- package/dist/chunk-UF5XMZTT.js +2 -0
- package/dist/chunk-UF5XMZTT.js.map +1 -0
- package/dist/chunk-UV3EUIBT.cjs +3 -0
- package/dist/chunk-UV3EUIBT.cjs.map +1 -0
- package/dist/chunk-VMSCRVNX.cjs +2 -0
- package/dist/chunk-VMSCRVNX.cjs.map +1 -0
- package/dist/{chunk-J7ABVGZH.cjs → chunk-WGP4UUO5.cjs} +2 -2
- package/dist/{chunk-J7ABVGZH.cjs.map → chunk-WGP4UUO5.cjs.map} +1 -1
- package/dist/chunk-XBGK3TTU.cjs +3 -0
- package/dist/chunk-XBGK3TTU.cjs.map +1 -0
- package/dist/chunk-XHQYHXRE.js +3 -0
- package/dist/chunk-XHQYHXRE.js.map +1 -0
- package/dist/chunk-XX55RR4Q.js +3 -0
- package/dist/chunk-XX55RR4Q.js.map +1 -0
- package/dist/chunk-YBQPEWT7.cjs +3 -0
- package/dist/chunk-YBQPEWT7.cjs.map +1 -0
- package/dist/{chunk-CHSO3DCS.js → chunk-ZDCZ5IDD.js} +3 -3
- package/dist/{chunk-CHSO3DCS.js.map → chunk-ZDCZ5IDD.js.map} +1 -1
- package/dist/{chunk-LNZNJSRW.cjs → chunk-ZVPZQ66D.cjs} +2 -2
- package/dist/chunk-ZVPZQ66D.cjs.map +1 -0
- package/dist/constants.cjs +1 -1
- package/dist/constants.d.cts +1 -1
- package/dist/constants.d.ts +1 -1
- package/dist/constants.js +1 -1
- package/dist/engine.cjs +1 -1
- package/dist/engine.d.cts +12 -12
- package/dist/engine.d.ts +12 -12
- package/dist/engine.js +1 -1
- package/dist/errors.cjs +1 -1
- package/dist/errors.d.cts +3 -3
- package/dist/errors.d.ts +3 -3
- package/dist/errors.js +1 -1
- package/dist/format.cjs +1 -1
- package/dist/format.d.cts +1 -1
- package/dist/format.d.ts +1 -1
- package/dist/format.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -12
- package/dist/index.d.ts +14 -12
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/language.d.cts +11 -11
- package/dist/language.d.ts +11 -11
- package/dist/lexer.cjs +1 -1
- package/dist/lexer.cjs.map +1 -1
- package/dist/lexer.d.cts +8 -7
- package/dist/lexer.d.ts +8 -7
- package/dist/lexer.js +1 -1
- package/dist/lexer.js.map +1 -1
- package/dist/normalizer.cjs +1 -1
- package/dist/normalizer.d.cts +16 -10
- package/dist/normalizer.d.ts +16 -10
- package/dist/normalizer.js +1 -1
- package/dist/packages.cjs +1 -1
- package/dist/packages.d.cts +10 -10
- package/dist/packages.d.ts +10 -10
- package/dist/packages.js +1 -1
- package/dist/parser.cjs +1 -1
- package/dist/parser.d.cts +4 -4
- package/dist/parser.d.ts +4 -4
- package/dist/parser.js +1 -1
- package/dist/{pipeline-B4wf3M1h.d.cts → pipeline-69q2tsLE.d.cts} +1 -1
- package/dist/{pipeline-QIT4iD8f.d.ts → pipeline-DTqGLPsV.d.ts} +1 -1
- package/dist/resolvers.cjs +1 -1
- package/dist/resolvers.d.cts +19 -3
- package/dist/resolvers.d.ts +19 -3
- package/dist/resolvers.js +1 -1
- package/dist/testing.cjs +2 -2
- package/dist/testing.d.cts +11 -11
- package/dist/testing.d.ts +11 -11
- package/dist/testing.js +1 -1
- package/dist/uom.cjs +1 -1
- package/dist/uom.d.cts +2 -2
- package/dist/uom.d.ts +2 -2
- package/dist/uom.js +1 -1
- package/dist/vm.cjs +1 -1
- package/dist/vm.d.cts +8 -8
- package/dist/vm.d.ts +8 -8
- package/dist/vm.js +1 -1
- package/dist/worker.cjs +2 -2
- package/dist/worker.cjs.map +1 -1
- package/dist/worker.d.cts +34 -25
- package/dist/worker.d.ts +34 -25
- package/dist/worker.js +1 -1
- package/dist/worker.js.map +1 -1
- package/package.json +5 -5
- package/dist/chunk-42JXN3BH.js +0 -5
- package/dist/chunk-42JXN3BH.js.map +0 -1
- package/dist/chunk-4DJJIUQF.js +0 -2
- package/dist/chunk-4DJJIUQF.js.map +0 -1
- package/dist/chunk-6YM67DWH.cjs +0 -3
- package/dist/chunk-6YM67DWH.cjs.map +0 -1
- package/dist/chunk-7E7NXKQ5.js.map +0 -1
- package/dist/chunk-7SZBEE5R.cjs +0 -2
- package/dist/chunk-7SZBEE5R.cjs.map +0 -1
- package/dist/chunk-A5M4QZIK.js +0 -2
- package/dist/chunk-A5M4QZIK.js.map +0 -1
- package/dist/chunk-AF7HQN6I.js +0 -2
- package/dist/chunk-AF7HQN6I.js.map +0 -1
- package/dist/chunk-ALY4ZMYO.js +0 -2
- package/dist/chunk-ALY4ZMYO.js.map +0 -1
- package/dist/chunk-BRJ4RT5U.js +0 -2
- package/dist/chunk-BRJ4RT5U.js.map +0 -1
- package/dist/chunk-CO2BI6WL.cjs +0 -3
- package/dist/chunk-CO2BI6WL.cjs.map +0 -1
- package/dist/chunk-EN3CDYOS.cjs +0 -2
- package/dist/chunk-EN3CDYOS.cjs.map +0 -1
- package/dist/chunk-EQDT42JG.js +0 -3
- package/dist/chunk-EQDT42JG.js.map +0 -1
- package/dist/chunk-FMMT5C5H.cjs +0 -3
- package/dist/chunk-FMMT5C5H.cjs.map +0 -1
- package/dist/chunk-FP6Z6PYR.js +0 -2
- package/dist/chunk-FP6Z6PYR.js.map +0 -1
- package/dist/chunk-H3JXNH7X.cjs +0 -3
- package/dist/chunk-H3JXNH7X.cjs.map +0 -1
- package/dist/chunk-HZOLIL5T.js +0 -3
- package/dist/chunk-HZOLIL5T.js.map +0 -1
- package/dist/chunk-JVMINMAB.js +0 -2
- package/dist/chunk-JVMINMAB.js.map +0 -1
- package/dist/chunk-JYLNQOPU.cjs +0 -2
- package/dist/chunk-JYLNQOPU.cjs.map +0 -1
- package/dist/chunk-KRXO3MOW.cjs +0 -2
- package/dist/chunk-KRXO3MOW.cjs.map +0 -1
- package/dist/chunk-KVLJDOZ7.cjs +0 -5
- package/dist/chunk-KVLJDOZ7.cjs.map +0 -1
- package/dist/chunk-LNZNJSRW.cjs.map +0 -1
- package/dist/chunk-O3BDXOQJ.js +0 -2
- package/dist/chunk-O3BDXOQJ.js.map +0 -1
- package/dist/chunk-PIZQIQVM.js +0 -3
- package/dist/chunk-PIZQIQVM.js.map +0 -1
- package/dist/chunk-QTSDIDAS.js +0 -3
- package/dist/chunk-QTSDIDAS.js.map +0 -1
- package/dist/chunk-SGIDBZ4T.cjs +0 -2
- package/dist/chunk-SGIDBZ4T.cjs.map +0 -1
- package/dist/chunk-UNKSCVIL.cjs +0 -2
- package/dist/chunk-UNKSCVIL.cjs.map +0 -1
- package/dist/chunk-USQ4KL6S.cjs +0 -2
- package/dist/chunk-USQ4KL6S.cjs.map +0 -1
- package/dist/chunk-XDXIPVZB.cjs +0 -2
- package/dist/chunk-XDXIPVZB.cjs.map +0 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { T as Token } from './Token-CbP_OutD.cjs';
|
|
2
|
+
import { E as EngineError } from './EngineError-fR1K1rvx.cjs';
|
|
2
3
|
|
|
3
4
|
/** Trie node for multi-word phrase matching. */
|
|
4
5
|
interface PhraseNode {
|
|
@@ -101,6 +102,14 @@ interface ScanLineResult {
|
|
|
101
102
|
tokens: Token[];
|
|
102
103
|
/** Inline solve spans found in this line (empty if none). */
|
|
103
104
|
inlineSolves: InlineSolveSpan[];
|
|
105
|
+
/**
|
|
106
|
+
* The structured error the tokeniser raised on this line, if it raised one
|
|
107
|
+
* (an unterminated string literal is the one it can raise today). The line
|
|
108
|
+
* carries no tokens then, and the rest of the document is unaffected: a
|
|
109
|
+
* half-typed quote used to escape {@link ExpressionLexer.scanDocument} as
|
|
110
|
+
* a throw and take every other line's result down with it.
|
|
111
|
+
*/
|
|
112
|
+
error?: EngineError;
|
|
104
113
|
}
|
|
105
114
|
/**
|
|
106
115
|
* A token, as the lexer produces it.
|
|
@@ -208,16 +217,6 @@ interface LexerVocabulary {
|
|
|
208
217
|
*/
|
|
209
218
|
declare class ExpressionLexer {
|
|
210
219
|
private static readonly CHAR_CLASS;
|
|
211
|
-
/**
|
|
212
|
-
* Configured TokenLookup from TokenClassRegistry. When set, replaces
|
|
213
|
-
* the internal keyword map and unit set with registry-built equivalents.
|
|
214
|
-
* Enables data-driven keyword/unit registration across locale keywords,
|
|
215
|
-
* provider keywords, and plugins.
|
|
216
|
-
*
|
|
217
|
-
* Set at construction time via the constructor parameter. Plugin-registered
|
|
218
|
-
* keywords/units (via registerVocabulary()) are checked alongside
|
|
219
|
-
* the configuredLookup, neither source is bypassed.
|
|
220
|
-
*/ private configuredLookup;
|
|
221
220
|
private input;
|
|
222
221
|
private pos;
|
|
223
222
|
private len;
|
|
@@ -227,7 +226,16 @@ declare class ExpressionLexer {
|
|
|
227
226
|
private keywordMap;
|
|
228
227
|
private mergedKeywords;
|
|
229
228
|
private mergedUnits;
|
|
230
|
-
|
|
229
|
+
/**
|
|
230
|
+
* Who registered each plugin keyword, unit and two-character operator, in
|
|
231
|
+
* registration order. Two packages may claim the same word (the
|
|
232
|
+
* compatibility index warns, and the last registered wins, as before); the
|
|
233
|
+
* owner lists make unregistration exact, so removing one package hands the
|
|
234
|
+
* word back to the other rather than deleting it for both.
|
|
235
|
+
*/
|
|
236
|
+
private pluginKeywordOwners;
|
|
237
|
+
private pluginUnitOwners;
|
|
238
|
+
private pluginOperatorOwners;
|
|
231
239
|
private pluginOperators;
|
|
232
240
|
private pluginUnits;
|
|
233
241
|
private hasPluginOps;
|
|
@@ -235,7 +243,7 @@ declare class ExpressionLexer {
|
|
|
235
243
|
private locale;
|
|
236
244
|
/**
|
|
237
245
|
* Inline solve spans collected during the most recent tokenization pass.
|
|
238
|
-
* Populated by
|
|
246
|
+
* Populated by tokenizeInto() and consumed by scanDocument().
|
|
239
247
|
*/
|
|
240
248
|
_inlineSolveSpans: InlineSolveSpan[];
|
|
241
249
|
private pluginRawLinePatterns;
|
|
@@ -260,7 +268,14 @@ declare class ExpressionLexer {
|
|
|
260
268
|
private matchRawLine;
|
|
261
269
|
/** Rebuild merged keyword and unit collections after plugin registration. */
|
|
262
270
|
private rebuildMergedUnits;
|
|
263
|
-
|
|
271
|
+
/**
|
|
272
|
+
* @param localeCode - Locale whose keyword table seeds the lexer.
|
|
273
|
+
* @param _lookup - Ignored. The lexer built its keyword, unit and phrase
|
|
274
|
+
* tables from the locale and the registered packages and never read the
|
|
275
|
+
* lookup it was handed; the parameter stays so existing callers compile.
|
|
276
|
+
* @deprecated Removed in 3.0.
|
|
277
|
+
*/
|
|
278
|
+
constructor(localeCode?: string, _lookup?: TokenLookup);
|
|
264
279
|
/**
|
|
265
280
|
* Register a plugin to extend the lexer with custom tokens.
|
|
266
281
|
*
|
|
@@ -276,6 +291,10 @@ declare class ExpressionLexer {
|
|
|
276
291
|
* that conflicts with a built-in one.
|
|
277
292
|
*/
|
|
278
293
|
registerVocabulary(plugin: LexerVocabulary): void;
|
|
294
|
+
/** Record `owner`'s claim on `key`. The newest claim is the one in force. */
|
|
295
|
+
private claim;
|
|
296
|
+
/** Drop `owner`'s claim on `key`, and return the claim now in force, if any is left. */
|
|
297
|
+
private release;
|
|
279
298
|
/**
|
|
280
299
|
* Unregister a plugin, removing its custom tokens from the lexer.
|
|
281
300
|
*
|
|
@@ -307,9 +326,9 @@ declare class ExpressionLexer {
|
|
|
307
326
|
* lines that classifyLine() marks as having inline solves.
|
|
308
327
|
*
|
|
309
328
|
* Tokenization is scoped to each line by temporarily restricting
|
|
310
|
-
* `this.len` to the line end position, so
|
|
311
|
-
*
|
|
312
|
-
*
|
|
329
|
+
* `this.len` to the line end position, so tokenizeInto() naturally
|
|
330
|
+
* stops at the line boundary. After tokenization, `this.len` is
|
|
331
|
+
* restored and `this.pos` advances past the newline.
|
|
313
332
|
*
|
|
314
333
|
* @param text The full document text (with newlines).
|
|
315
334
|
* @returns Array of ScanLineResult, one per line, in document order.
|
|
@@ -318,9 +337,7 @@ declare class ExpressionLexer {
|
|
|
318
337
|
/**
|
|
319
338
|
* Tokenize an expression string into an array of Tokens.
|
|
320
339
|
*
|
|
321
|
-
*
|
|
322
|
-
* yielded tokens via Array.from(). For memory-sensitive use cases, prefer
|
|
323
|
-
* iterating the lexer directly with for...of to avoid array allocation.
|
|
340
|
+
* Runs {@link tokenizeInto} into a fresh array.
|
|
324
341
|
*
|
|
325
342
|
* Optimizations:
|
|
326
343
|
* - CHAR_CLASS jump table (Uint8Array) → switch on small integers
|
|
@@ -332,20 +349,31 @@ declare class ExpressionLexer {
|
|
|
332
349
|
*/
|
|
333
350
|
tokenizeAll(): Token[];
|
|
334
351
|
/**
|
|
335
|
-
*
|
|
336
|
-
*
|
|
352
|
+
* Scan the current input and append every token to `out`.
|
|
353
|
+
*
|
|
354
|
+
* This is the scanner itself: {@link tokenizeAll} and the iterator are
|
|
355
|
+
* thin wrappers over it. It pushes into an array the caller owns rather
|
|
356
|
+
* than yielding, because a generator paid a resume per token and
|
|
357
|
+
* `Array.from` a second pass on top, and because a caller that catches a
|
|
358
|
+
* tokeniser fault (highlighting a line with an unterminated quote) still
|
|
359
|
+
* holds the tokens read before it.
|
|
337
360
|
*
|
|
338
|
-
*
|
|
339
|
-
*
|
|
340
|
-
*
|
|
341
|
-
*
|
|
361
|
+
* IMPORTANT: `this.len` is read ONCE on entry (const len = this.len).
|
|
362
|
+
* `scanDocument()` relies on this to scope a pass to a single line by
|
|
363
|
+
* restricting `this.len` to the line end before calling. Do not re-read
|
|
364
|
+
* `this.len` mid-loop without also updating `scanDocument()`.
|
|
342
365
|
*
|
|
343
|
-
*
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
*
|
|
348
|
-
*
|
|
366
|
+
* @param out - The array to append to. Left as it was if the input is empty.
|
|
367
|
+
*/
|
|
368
|
+
tokenizeInto(out: Token[]): void;
|
|
369
|
+
/**
|
|
370
|
+
* Iterate the tokens of the current input.
|
|
371
|
+
*
|
|
372
|
+
* Runs {@link tokenizeInto} first, so the tokens are the same as before,
|
|
373
|
+
* but a fault part way through the line is thrown from the first
|
|
374
|
+
* `next()` rather than at the token it occurred on. A caller that wants
|
|
375
|
+
* the tokens read before a fault calls {@link tokenizeInto} with its own
|
|
376
|
+
* array.
|
|
349
377
|
*/
|
|
350
378
|
[Symbol.iterator](): Generator<Token, void, undefined>;
|
|
351
379
|
/**
|
|
@@ -456,6 +484,27 @@ declare class ExpressionLexer {
|
|
|
456
484
|
* `#12345` (length 5), `#ff0000zz` (trailing word) do not.
|
|
457
485
|
*/
|
|
458
486
|
private matchHexColourEnd;
|
|
487
|
+
/**
|
|
488
|
+
* Whether an inline-solve opener (`s` + backtick) occurs in `[from, end)`.
|
|
489
|
+
*
|
|
490
|
+
* Bounded by hand rather than written as `input.indexOf("s\`", from)`. This
|
|
491
|
+
* used to be the `indexOf` form with an `idx < end` check afterwards, which
|
|
492
|
+
* is correct but not bounded: when {@link scanDocument} is classifying,
|
|
493
|
+
* `this.input` is the whole document, so a line with no marker scanned to
|
|
494
|
+
* the END OF THE DOCUMENT before the check could reject the hit. Every line
|
|
495
|
+
* paid for every line after it, and a whole-document parse was quadratic in
|
|
496
|
+
* line count (measured at 28.9 us per line at 10,000 lines against 10.1 us
|
|
497
|
+
* at 1,000, and two thirds of the parse's self time in a profile). A prose
|
|
498
|
+
* document with many candidate `s` characters was worse still. The
|
|
499
|
+
* wikilink close in {@link indexOfWithin} had the same shape.
|
|
500
|
+
*/
|
|
501
|
+
private hasInlineSolveWithin;
|
|
502
|
+
/**
|
|
503
|
+
* `input.indexOf(needle, from)` restricted to `[from, end)`, returning -1
|
|
504
|
+
* when the needle does not occur wholly before `end`. See
|
|
505
|
+
* {@link hasInlineSolveWithin} for why the plain `indexOf` was not enough.
|
|
506
|
+
*/
|
|
507
|
+
private indexOfWithin;
|
|
459
508
|
private classifyFromPositions;
|
|
460
509
|
/**
|
|
461
510
|
* Classify a single line of markdown text.
|
|
@@ -530,11 +579,11 @@ declare class Lexer {
|
|
|
530
579
|
private tokenIdx;
|
|
531
580
|
/**
|
|
532
581
|
* @param localeCode - Locale code (e.g., "en", "de"). Defaults to "en".
|
|
533
|
-
* @param
|
|
534
|
-
*
|
|
535
|
-
*
|
|
582
|
+
* @param _tokenLookup - Ignored. The lexer never read the lookup it was
|
|
583
|
+
* handed; the parameter stays so existing callers compile.
|
|
584
|
+
* @deprecated Removed in 3.0.
|
|
536
585
|
*/
|
|
537
|
-
constructor(localeCode?: string,
|
|
586
|
+
constructor(localeCode?: string, _tokenLookup?: TokenLookup);
|
|
538
587
|
reset(input: string, state?: LexerState): void;
|
|
539
588
|
/**
|
|
540
589
|
* Classify a single line of markdown text (Phase B).
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { a as PrecedenceParser, b as PrefixParselet, I as InfixParselet } from './Parselet-
|
|
2
|
-
import { V as Value,
|
|
3
|
-
import { M as MarkdownLineType, L as Lexer, e as TokenCategory, c as LexerVocabulary } from './Lexer-
|
|
1
|
+
import { a as PrecedenceParser, b as PrefixParselet, I as InfixParselet } from './Parselet-DqTbbtWA.js';
|
|
2
|
+
import { V as Value, a as ValueType } from './Value-Ds3Gy07C.js';
|
|
3
|
+
import { M as MarkdownLineType, L as Lexer, e as TokenCategory, c as LexerVocabulary } from './Lexer-Bmctxl0n.js';
|
|
4
4
|
import { IAsyncResolver } from './resolvers.js';
|
|
5
|
-
import { T as TokenFusion, c as TokenNormalizer, a as NormalizerRule } from './TokenNormalizer-
|
|
6
|
-
import { D as DependencyGraph, V as VM, a as DagSnapshot, b as EngineContext, S as ScopeManager, P as PluginFunctionHandler } from './ScopeManager-
|
|
7
|
-
import { a as BytecodeProgram } from './BytecodeBuilder-
|
|
5
|
+
import { T as TokenFusion, c as TokenNormalizer, a as NormalizerRule } from './TokenNormalizer-CLBtiE8M.js';
|
|
6
|
+
import { D as DependencyGraph, V as VM, a as DagSnapshot, b as EngineContext, S as ScopeManager, P as PluginFunctionHandler } from './ScopeManager-B636am7Y.js';
|
|
7
|
+
import { a as BytecodeProgram } from './BytecodeBuilder-DSWKZi4f.js';
|
|
8
8
|
import { QueryClient } from '@tanstack/query-core';
|
|
9
|
-
import { E as EngineError } from './EngineError-
|
|
10
|
-
import { a as DiagnosticReportJSON, D as DiagnosticPipeline } from './pipeline-
|
|
9
|
+
import { E as EngineError } from './EngineError-fR1K1rvx.js';
|
|
10
|
+
import { a as DiagnosticReportJSON, D as DiagnosticPipeline } from './pipeline-DTqGLPsV.js';
|
|
11
11
|
import { T as Token } from './Token-CbP_OutD.js';
|
|
12
|
-
import { E as EngineConfigOverride, a as EngineConfig } from './Configuration-
|
|
12
|
+
import { E as EngineConfigOverride, a as EngineConfig } from './Configuration-DnzYPmoK.js';
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* One line's compiled bytecode, plus the variables it reads and writes.
|
|
@@ -728,9 +728,10 @@ declare class AsyncResolutionBatcher {
|
|
|
728
728
|
* Nullable rather than a constructor parameter because it is cleared by
|
|
729
729
|
* `clearAll()` and re-wired on re-subscribe, so it cannot be readonly. That
|
|
730
730
|
* makes it easy to miss, which is why {@link warnIfUnwired} exists: leaving
|
|
731
|
-
* it unset
|
|
732
|
-
*
|
|
733
|
-
*
|
|
731
|
+
* it unset, with nobody reading {@link getEventStream} either, means async
|
|
732
|
+
* values resolve into the cache and are never shown, with nothing to
|
|
733
|
+
* indicate why. A host that genuinely does not want async results should
|
|
734
|
+
* not register async resolvers at all.
|
|
734
735
|
*/
|
|
735
736
|
onLineResult: ((lineNumber: number, value: Value) => void) | null;
|
|
736
737
|
/**
|
|
@@ -742,11 +743,15 @@ declare class AsyncResolutionBatcher {
|
|
|
742
743
|
*/
|
|
743
744
|
private warnedAboutMissingHook;
|
|
744
745
|
/**
|
|
745
|
-
* Warn once if an async result resolved with
|
|
746
|
+
* Warn once if an async result resolved with nobody to receive it: no
|
|
747
|
+
* {@link onLineResult} wired and no reader on {@link getEventStream}.
|
|
746
748
|
*
|
|
747
749
|
* The failure this catches is silent by nature: the value arrives, the cache
|
|
748
750
|
* updates, and the line keeps showing pending forever. Without this a host
|
|
749
|
-
* author has no thread to pull on.
|
|
751
|
+
* author has no thread to pull on. A host reading the event stream is not
|
|
752
|
+
* in that position: the stream is the documented way to learn which lines
|
|
753
|
+
* to re-evaluate, and this used to warn at it anyway, telling it to set a
|
|
754
|
+
* hook it did not need.
|
|
750
755
|
*/
|
|
751
756
|
private warnIfUnwired;
|
|
752
757
|
/** High-water mark used when (re)creating the event stream. */
|
|
@@ -1635,6 +1640,13 @@ declare class ExpressionEngine {
|
|
|
1635
1640
|
* every `name(` call word instead of one rule per package.
|
|
1636
1641
|
*/
|
|
1637
1642
|
private callFusions;
|
|
1643
|
+
/**
|
|
1644
|
+
* Which packages claim each call-fusion word, in registration order. The
|
|
1645
|
+
* newest claim is the one {@link callFusions} holds; removing a package
|
|
1646
|
+
* hands the word back to the previous claimant rather than deleting it
|
|
1647
|
+
* for both.
|
|
1648
|
+
*/
|
|
1649
|
+
private callFusionOwners;
|
|
1638
1650
|
/**
|
|
1639
1651
|
* Incremental index behind the package-compatibility check. Kept in step
|
|
1640
1652
|
* with {@link registeredPackages} so each `registerPackage` costs O(that
|
|
@@ -1801,6 +1813,45 @@ declare class ExpressionEngine {
|
|
|
1801
1813
|
/** TanStack Query client, injected into resolvers for cache reads/writes. */
|
|
1802
1814
|
readonly queryClient: QueryClient;
|
|
1803
1815
|
private bytecodeCache;
|
|
1816
|
+
/**
|
|
1817
|
+
* What the front half of the pipeline produced for a cached program: the
|
|
1818
|
+
* normalised tokens the program was compiled from and the reads and
|
|
1819
|
+
* writes extracted from them. Keyed like {@link bytecodeCache} and kept
|
|
1820
|
+
* in step with it (same eviction, same clears), so a hit here means a hit
|
|
1821
|
+
* there.
|
|
1822
|
+
*
|
|
1823
|
+
* A bytecode-cache hit used to pay for the whole front half anyway: the
|
|
1824
|
+
* length check, lexing, normalising, the complexity score, the three
|
|
1825
|
+
* effectful-grammar tries and the reads/writes extraction all ran before
|
|
1826
|
+
* `bytecodeCache.get`, and on a cache-hit evaluation of an ordinary line
|
|
1827
|
+
* lexing and normalising were about two fifths of the cost. Everything
|
|
1828
|
+
* the later stages read from the front half is remembered here instead,
|
|
1829
|
+
* so a hit skips straight to the async preflight and the VM. Entries
|
|
1830
|
+
* restored from a snapshot carry a program but no front half; the first
|
|
1831
|
+
* evaluation after a restore runs the full front half once and fills it.
|
|
1832
|
+
* The memory is a few hundred bytes per cached expression, bounded by the
|
|
1833
|
+
* same `defaultCacheSize` as the programs.
|
|
1834
|
+
*/
|
|
1835
|
+
private compiledFrontHalf;
|
|
1836
|
+
/**
|
|
1837
|
+
* Expressions whose last parse threw, with what the front half produced
|
|
1838
|
+
* for them. A line that does not parse is the ordinary state of a line
|
|
1839
|
+
* being typed, and every re-evaluation of the document lexed, normalised
|
|
1840
|
+
* and re-parsed it, paying for the throw each time. The entry is used
|
|
1841
|
+
* only after the effectful-grammar tries, which still run because they
|
|
1842
|
+
* read the VM (a stored equation, a running total), so nothing that
|
|
1843
|
+
* depends on document state is skipped: only the pure front half and the
|
|
1844
|
+
* parse that is known to fail. The error object is the one first thrown,
|
|
1845
|
+
* so its timestamp is the first failure's. Cleared with the compiled
|
|
1846
|
+
* caches, because the vocabulary and parselet changes that would change
|
|
1847
|
+
* a program can change whether a line parses at all. Bounded by the same
|
|
1848
|
+
* `defaultCacheSize` as the programs.
|
|
1849
|
+
*/
|
|
1850
|
+
private failedParses;
|
|
1851
|
+
/** Whether `expression` can be answered without lexing or normalising: both compiled caches hold it, or its parse is known to fail. */
|
|
1852
|
+
private frontHalfCached;
|
|
1853
|
+
/** Drop every cached program, its front half and every remembered parse failure. Every invalidation goes through here so the three cannot drift. */
|
|
1854
|
+
private clearCompiledCache;
|
|
1804
1855
|
/**
|
|
1805
1856
|
* Insert into the bytecode cache, evicting the oldest entry when full.
|
|
1806
1857
|
*
|
|
@@ -1813,6 +1864,8 @@ declare class ExpressionEngine {
|
|
|
1813
1864
|
* the bytecode-cache benefit on re-evaluation regardless of config.
|
|
1814
1865
|
*/
|
|
1815
1866
|
private cacheBytecode;
|
|
1867
|
+
/** Remember a parse failure, evicting the oldest when full: bounded like the program cache. */
|
|
1868
|
+
private rememberFailedParse;
|
|
1816
1869
|
private pluginFunctionIndexByName;
|
|
1817
1870
|
private builderPool;
|
|
1818
1871
|
private builderPoolIndex;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { a as PrecedenceParser, b as PrefixParselet, I as InfixParselet } from './Parselet-
|
|
2
|
-
import { V as Value,
|
|
3
|
-
import { M as MarkdownLineType, L as Lexer, e as TokenCategory, c as LexerVocabulary } from './Lexer-
|
|
1
|
+
import { a as PrecedenceParser, b as PrefixParselet, I as InfixParselet } from './Parselet-BawfGuTF.cjs';
|
|
2
|
+
import { V as Value, a as ValueType } from './Value-Ds3Gy07C.cjs';
|
|
3
|
+
import { M as MarkdownLineType, L as Lexer, e as TokenCategory, c as LexerVocabulary } from './Lexer-aB95pjoX.cjs';
|
|
4
4
|
import { IAsyncResolver } from './resolvers.cjs';
|
|
5
|
-
import { T as TokenFusion, c as TokenNormalizer, a as NormalizerRule } from './TokenNormalizer-
|
|
6
|
-
import { D as DependencyGraph, V as VM, a as DagSnapshot, b as EngineContext, S as ScopeManager, P as PluginFunctionHandler } from './ScopeManager-
|
|
7
|
-
import { a as BytecodeProgram } from './BytecodeBuilder-
|
|
5
|
+
import { T as TokenFusion, c as TokenNormalizer, a as NormalizerRule } from './TokenNormalizer-CjTDmHgB.cjs';
|
|
6
|
+
import { D as DependencyGraph, V as VM, a as DagSnapshot, b as EngineContext, S as ScopeManager, P as PluginFunctionHandler } from './ScopeManager-CdwX0VTw.cjs';
|
|
7
|
+
import { a as BytecodeProgram } from './BytecodeBuilder-DSWKZi4f.cjs';
|
|
8
8
|
import { QueryClient } from '@tanstack/query-core';
|
|
9
|
-
import { E as EngineError } from './EngineError-
|
|
10
|
-
import { a as DiagnosticReportJSON, D as DiagnosticPipeline } from './pipeline-
|
|
9
|
+
import { E as EngineError } from './EngineError-fR1K1rvx.cjs';
|
|
10
|
+
import { a as DiagnosticReportJSON, D as DiagnosticPipeline } from './pipeline-69q2tsLE.cjs';
|
|
11
11
|
import { T as Token } from './Token-CbP_OutD.cjs';
|
|
12
|
-
import { E as EngineConfigOverride, a as EngineConfig } from './Configuration-
|
|
12
|
+
import { E as EngineConfigOverride, a as EngineConfig } from './Configuration-DnzYPmoK.cjs';
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* One line's compiled bytecode, plus the variables it reads and writes.
|
|
@@ -728,9 +728,10 @@ declare class AsyncResolutionBatcher {
|
|
|
728
728
|
* Nullable rather than a constructor parameter because it is cleared by
|
|
729
729
|
* `clearAll()` and re-wired on re-subscribe, so it cannot be readonly. That
|
|
730
730
|
* makes it easy to miss, which is why {@link warnIfUnwired} exists: leaving
|
|
731
|
-
* it unset
|
|
732
|
-
*
|
|
733
|
-
*
|
|
731
|
+
* it unset, with nobody reading {@link getEventStream} either, means async
|
|
732
|
+
* values resolve into the cache and are never shown, with nothing to
|
|
733
|
+
* indicate why. A host that genuinely does not want async results should
|
|
734
|
+
* not register async resolvers at all.
|
|
734
735
|
*/
|
|
735
736
|
onLineResult: ((lineNumber: number, value: Value) => void) | null;
|
|
736
737
|
/**
|
|
@@ -742,11 +743,15 @@ declare class AsyncResolutionBatcher {
|
|
|
742
743
|
*/
|
|
743
744
|
private warnedAboutMissingHook;
|
|
744
745
|
/**
|
|
745
|
-
* Warn once if an async result resolved with
|
|
746
|
+
* Warn once if an async result resolved with nobody to receive it: no
|
|
747
|
+
* {@link onLineResult} wired and no reader on {@link getEventStream}.
|
|
746
748
|
*
|
|
747
749
|
* The failure this catches is silent by nature: the value arrives, the cache
|
|
748
750
|
* updates, and the line keeps showing pending forever. Without this a host
|
|
749
|
-
* author has no thread to pull on.
|
|
751
|
+
* author has no thread to pull on. A host reading the event stream is not
|
|
752
|
+
* in that position: the stream is the documented way to learn which lines
|
|
753
|
+
* to re-evaluate, and this used to warn at it anyway, telling it to set a
|
|
754
|
+
* hook it did not need.
|
|
750
755
|
*/
|
|
751
756
|
private warnIfUnwired;
|
|
752
757
|
/** High-water mark used when (re)creating the event stream. */
|
|
@@ -1635,6 +1640,13 @@ declare class ExpressionEngine {
|
|
|
1635
1640
|
* every `name(` call word instead of one rule per package.
|
|
1636
1641
|
*/
|
|
1637
1642
|
private callFusions;
|
|
1643
|
+
/**
|
|
1644
|
+
* Which packages claim each call-fusion word, in registration order. The
|
|
1645
|
+
* newest claim is the one {@link callFusions} holds; removing a package
|
|
1646
|
+
* hands the word back to the previous claimant rather than deleting it
|
|
1647
|
+
* for both.
|
|
1648
|
+
*/
|
|
1649
|
+
private callFusionOwners;
|
|
1638
1650
|
/**
|
|
1639
1651
|
* Incremental index behind the package-compatibility check. Kept in step
|
|
1640
1652
|
* with {@link registeredPackages} so each `registerPackage` costs O(that
|
|
@@ -1801,6 +1813,45 @@ declare class ExpressionEngine {
|
|
|
1801
1813
|
/** TanStack Query client, injected into resolvers for cache reads/writes. */
|
|
1802
1814
|
readonly queryClient: QueryClient;
|
|
1803
1815
|
private bytecodeCache;
|
|
1816
|
+
/**
|
|
1817
|
+
* What the front half of the pipeline produced for a cached program: the
|
|
1818
|
+
* normalised tokens the program was compiled from and the reads and
|
|
1819
|
+
* writes extracted from them. Keyed like {@link bytecodeCache} and kept
|
|
1820
|
+
* in step with it (same eviction, same clears), so a hit here means a hit
|
|
1821
|
+
* there.
|
|
1822
|
+
*
|
|
1823
|
+
* A bytecode-cache hit used to pay for the whole front half anyway: the
|
|
1824
|
+
* length check, lexing, normalising, the complexity score, the three
|
|
1825
|
+
* effectful-grammar tries and the reads/writes extraction all ran before
|
|
1826
|
+
* `bytecodeCache.get`, and on a cache-hit evaluation of an ordinary line
|
|
1827
|
+
* lexing and normalising were about two fifths of the cost. Everything
|
|
1828
|
+
* the later stages read from the front half is remembered here instead,
|
|
1829
|
+
* so a hit skips straight to the async preflight and the VM. Entries
|
|
1830
|
+
* restored from a snapshot carry a program but no front half; the first
|
|
1831
|
+
* evaluation after a restore runs the full front half once and fills it.
|
|
1832
|
+
* The memory is a few hundred bytes per cached expression, bounded by the
|
|
1833
|
+
* same `defaultCacheSize` as the programs.
|
|
1834
|
+
*/
|
|
1835
|
+
private compiledFrontHalf;
|
|
1836
|
+
/**
|
|
1837
|
+
* Expressions whose last parse threw, with what the front half produced
|
|
1838
|
+
* for them. A line that does not parse is the ordinary state of a line
|
|
1839
|
+
* being typed, and every re-evaluation of the document lexed, normalised
|
|
1840
|
+
* and re-parsed it, paying for the throw each time. The entry is used
|
|
1841
|
+
* only after the effectful-grammar tries, which still run because they
|
|
1842
|
+
* read the VM (a stored equation, a running total), so nothing that
|
|
1843
|
+
* depends on document state is skipped: only the pure front half and the
|
|
1844
|
+
* parse that is known to fail. The error object is the one first thrown,
|
|
1845
|
+
* so its timestamp is the first failure's. Cleared with the compiled
|
|
1846
|
+
* caches, because the vocabulary and parselet changes that would change
|
|
1847
|
+
* a program can change whether a line parses at all. Bounded by the same
|
|
1848
|
+
* `defaultCacheSize` as the programs.
|
|
1849
|
+
*/
|
|
1850
|
+
private failedParses;
|
|
1851
|
+
/** Whether `expression` can be answered without lexing or normalising: both compiled caches hold it, or its parse is known to fail. */
|
|
1852
|
+
private frontHalfCached;
|
|
1853
|
+
/** Drop every cached program, its front half and every remembered parse failure. Every invalidation goes through here so the three cannot drift. */
|
|
1854
|
+
private clearCompiledCache;
|
|
1804
1855
|
/**
|
|
1805
1856
|
* Insert into the bytecode cache, evicting the oldest entry when full.
|
|
1806
1857
|
*
|
|
@@ -1813,6 +1864,8 @@ declare class ExpressionEngine {
|
|
|
1813
1864
|
* the bytecode-cache benefit on re-evaluation regardless of config.
|
|
1814
1865
|
*/
|
|
1815
1866
|
private cacheBytecode;
|
|
1867
|
+
/** Remember a parse failure, evicting the oldest when full: bounded like the program cache. */
|
|
1868
|
+
private rememberFailedParse;
|
|
1816
1869
|
private pluginFunctionIndexByName;
|
|
1817
1870
|
private builderPool;
|
|
1818
1871
|
private builderPoolIndex;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { B as BytecodeBuilder } from './BytecodeBuilder-
|
|
1
|
+
import { B as BytecodeBuilder } from './BytecodeBuilder-DSWKZi4f.cjs';
|
|
2
2
|
import { T as Token } from './Token-CbP_OutD.cjs';
|
|
3
|
-
import { D as DiagnosticPipeline } from './pipeline-
|
|
3
|
+
import { D as DiagnosticPipeline } from './pipeline-69q2tsLE.cjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Dual-keyed ParseletRegistry, accepts both string token types and
|
|
@@ -222,6 +222,8 @@ declare class PrecedenceParser {
|
|
|
222
222
|
* @param _builder - accepted for parselet API compatibility; always uses `this.builder`.
|
|
223
223
|
*/
|
|
224
224
|
parseExpression(minBp?: number, _builder?: BytecodeBuilder): void;
|
|
225
|
+
/** The prefix and infix loop of {@link parseExpression}, run with the depth already counted and the builder in place. */
|
|
226
|
+
private parseExpressionBody;
|
|
225
227
|
/**
|
|
226
228
|
* Parse a prefix token. Built-in tokens (NUMBER, IDENT, LPAREN, etc.) are
|
|
227
229
|
* handled inline with zero registry lookup. Everything else falls through
|
|
@@ -300,6 +302,10 @@ declare class PrecedenceParser {
|
|
|
300
302
|
private consumeParamName;
|
|
301
303
|
private parseUserFunctionDefinition;
|
|
302
304
|
private parseUserFunctionCall;
|
|
305
|
+
/** The source span of `token`: where an editor underlines the error. */
|
|
306
|
+
private spanOf;
|
|
307
|
+
/** An empty span just after the last token: where a line that stops short is pointed at. */
|
|
308
|
+
private spanAtEnd;
|
|
303
309
|
consume(expectedType?: string): Token;
|
|
304
310
|
match(expectedType: string): boolean;
|
|
305
311
|
peek(): Token | undefined;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { B as BytecodeBuilder } from './BytecodeBuilder-
|
|
1
|
+
import { B as BytecodeBuilder } from './BytecodeBuilder-DSWKZi4f.js';
|
|
2
2
|
import { T as Token } from './Token-CbP_OutD.js';
|
|
3
|
-
import { D as DiagnosticPipeline } from './pipeline-
|
|
3
|
+
import { D as DiagnosticPipeline } from './pipeline-DTqGLPsV.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Dual-keyed ParseletRegistry, accepts both string token types and
|
|
@@ -222,6 +222,8 @@ declare class PrecedenceParser {
|
|
|
222
222
|
* @param _builder - accepted for parselet API compatibility; always uses `this.builder`.
|
|
223
223
|
*/
|
|
224
224
|
parseExpression(minBp?: number, _builder?: BytecodeBuilder): void;
|
|
225
|
+
/** The prefix and infix loop of {@link parseExpression}, run with the depth already counted and the builder in place. */
|
|
226
|
+
private parseExpressionBody;
|
|
225
227
|
/**
|
|
226
228
|
* Parse a prefix token. Built-in tokens (NUMBER, IDENT, LPAREN, etc.) are
|
|
227
229
|
* handled inline with zero registry lookup. Everything else falls through
|
|
@@ -300,6 +302,10 @@ declare class PrecedenceParser {
|
|
|
300
302
|
private consumeParamName;
|
|
301
303
|
private parseUserFunctionDefinition;
|
|
302
304
|
private parseUserFunctionCall;
|
|
305
|
+
/** The source span of `token`: where an editor underlines the error. */
|
|
306
|
+
private spanOf;
|
|
307
|
+
/** An empty span just after the last token: where a line that stops short is pointed at. */
|
|
308
|
+
private spanAtEnd;
|
|
303
309
|
consume(expectedType?: string): Token;
|
|
304
310
|
match(expectedType: string): boolean;
|
|
305
311
|
peek(): Token | undefined;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { V as Value } from './Value-
|
|
2
|
-
import { U as UserFunctionDef, A as AnonymousBodyDef, a as BytecodeProgram } from './BytecodeBuilder-
|
|
3
|
-
import { E as EngineError } from './EngineError-
|
|
4
|
-
import { D as DiagnosticPipeline } from './pipeline-
|
|
1
|
+
import { V as Value } from './Value-Ds3Gy07C.js';
|
|
2
|
+
import { U as UserFunctionDef, A as AnonymousBodyDef, a as BytecodeProgram } from './BytecodeBuilder-DSWKZi4f.js';
|
|
3
|
+
import { E as EngineError } from './EngineError-fR1K1rvx.js';
|
|
4
|
+
import { D as DiagnosticPipeline } from './pipeline-DTqGLPsV.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Create a new VM instance with the given opcode registry and configurable limits.
|
|
@@ -76,6 +76,13 @@ interface Bytecode {
|
|
|
76
76
|
interface LineExecutionContext {
|
|
77
77
|
/** 1-based current line number, or -1 when there is no real document (see class doc above). */
|
|
78
78
|
lineIndex: number;
|
|
79
|
+
/**
|
|
80
|
+
* Whether this engine may fetch live data (`network.enabled`). A plugin
|
|
81
|
+
* function that reads a resolver's cache uses it to say "live data is
|
|
82
|
+
* switched off" when the cache is empty, rather than the "not preflighted"
|
|
83
|
+
* message that describes a different fault. Absent means enabled.
|
|
84
|
+
*/
|
|
85
|
+
networkEnabled?: boolean;
|
|
79
86
|
/** Look up another line's cached result by 1-based line number. `undefined` = not evaluated yet (or out of range), distinct from a line that evaluated to an actual `undefined`-like Value, which can't happen (every Value type has a concrete representation). */
|
|
80
87
|
getLineResult?: (lineNumber: number) => Value | undefined;
|
|
81
88
|
/** Whether line `lineNumber` is a blank line or a `#` heading, the stopping condition for "total above"/"sum above"/"average above" aggregation. */
|
|
@@ -250,6 +257,17 @@ interface EngineContext {
|
|
|
250
257
|
* nowhere.
|
|
251
258
|
*/
|
|
252
259
|
readonly pluginFunctionOwners: Record<number, string>;
|
|
260
|
+
/**
|
|
261
|
+
* Whether this engine may fetch live data, from `network.enabled` in the
|
|
262
|
+
* engine's configuration.
|
|
263
|
+
*
|
|
264
|
+
* Lives on the context rather than only on the engine because the VM is
|
|
265
|
+
* where a plugin function's promise is first seen and where a currency
|
|
266
|
+
* conversion discovers it has no rate. Both need to answer "live data is
|
|
267
|
+
* switched off" rather than "no rate available" or "result discarded", and
|
|
268
|
+
* the context is the one object every VM already holds.
|
|
269
|
+
*/
|
|
270
|
+
readonly networkEnabled: boolean;
|
|
253
271
|
}
|
|
254
272
|
|
|
255
273
|
/**
|
|
@@ -356,15 +374,28 @@ declare class OpRegistry {
|
|
|
356
374
|
* and abort signal management for async cancellation.
|
|
357
375
|
*/
|
|
358
376
|
interface VM {
|
|
377
|
+
/**
|
|
378
|
+
* Push a value.
|
|
379
|
+
*
|
|
380
|
+
* @throws `STACK_LIMIT_EXCEEDED` (EXECUTION) when the stack is already at
|
|
381
|
+
* `maxStackDepth`. It used to drop the value silently, so a handler's
|
|
382
|
+
* result vanished and the next opcode read whatever lay beneath.
|
|
383
|
+
*/
|
|
359
384
|
push(value: Value): void;
|
|
385
|
+
/**
|
|
386
|
+
* Pop the top of the stack.
|
|
387
|
+
*
|
|
388
|
+
* @throws `STACK_UNDERFLOW` (INTERNAL) if the stack is empty. It used to
|
|
389
|
+
* answer with a plain `0`, which is indistinguishable from a real zero
|
|
390
|
+
* and turned a mismatched push/pop count into a wrong number.
|
|
391
|
+
*/
|
|
360
392
|
pop(): Value;
|
|
361
393
|
/**
|
|
362
394
|
* Pop the top of the stack as a number.
|
|
363
395
|
*
|
|
364
|
-
* @throws `STACK_UNDERFLOW` (INTERNAL) if the stack is empty
|
|
365
|
-
* `pop()
|
|
366
|
-
*
|
|
367
|
-
* one. Every Value converts, so there is no operand-type throw here.
|
|
396
|
+
* @throws `STACK_UNDERFLOW` (INTERNAL) if the stack is empty, exactly as
|
|
397
|
+
* `pop()` does. Every Value converts, so there is no operand-type throw
|
|
398
|
+
* here.
|
|
368
399
|
*/
|
|
369
400
|
popNumber(): number;
|
|
370
401
|
/**
|