solve-engine 2.24.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/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/{EngineError-D1kXsjIj.d.cts → EngineError-fR1K1rvx.d.cts} +2 -0
- package/dist/{EngineError-D1kXsjIj.d.ts → EngineError-fR1K1rvx.d.ts} +2 -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-Bq82y0ZN.d.ts → PackageCompatibility-BludTs7v.d.ts} +1 -1
- package/dist/{PackageCompatibility-CeAPVHZr.d.cts → PackageCompatibility-CUVg8tmt.d.cts} +1 -1
- package/dist/{PackageRegistry-CDEgfhT_.d.ts → PackageRegistry-DT-x32OM.d.ts} +54 -6
- package/dist/{PackageRegistry-B9-7fJGH.d.cts → PackageRegistry-Dvn4i2QK.d.cts} +54 -6
- package/dist/{Parselet-4oH5OuRt.d.cts → Parselet-BawfGuTF.d.cts} +7 -1
- package/dist/{Parselet-BwDqKFfK.d.ts → Parselet-DqTbbtWA.d.ts} +7 -1
- package/dist/{ScopeManager-BQBhlDAu.d.ts → ScopeManager-B636am7Y.d.ts} +2 -2
- package/dist/{ScopeManager-DrXB3Nvm.d.cts → ScopeManager-CdwX0VTw.d.cts} +2 -2
- 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-BK32PTl2.d.cts → VMCheckpoints-CYqeq8IV.d.cts} +2 -2
- package/dist/{VMCheckpoints-C5jC92o3.d.ts → VMCheckpoints-DDlxNssY.d.ts} +2 -2
- package/dist/{WorkerError-DaNWQFp1.d.cts → WorkerError-B1dF3VYT.d.cts} +1 -1
- package/dist/{WorkerError-CVQbs6_D.d.ts → WorkerError-dneODN-u.d.ts} +1 -1
- package/dist/{chunk-CMZSK6FY.cjs → chunk-4BAUQE6A.cjs} +3 -3
- package/dist/{chunk-CMZSK6FY.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-UY3ID6JF.cjs → chunk-4NZXCHQL.cjs} +2 -2
- 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-AUOE7MFI.cjs.map → chunk-634ILVMP.cjs.map} +1 -1
- package/dist/{chunk-3SHWTGTP.js → chunk-63ZOOUOL.js} +2 -2
- package/dist/{chunk-3SHWTGTP.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-HQ7BKXG7.js → chunk-DUYTXLO2.js} +2 -2
- 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-MWWAKZOD.cjs → chunk-FYAMQFZZ.cjs} +3 -3
- package/dist/{chunk-MWWAKZOD.cjs.map → chunk-FYAMQFZZ.cjs.map} +1 -1
- 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-PTQCHMYA.js → chunk-JFZ5SLF7.js} +2 -2
- package/dist/{chunk-PTQCHMYA.js.map → chunk-JFZ5SLF7.js.map} +1 -1
- package/dist/{chunk-RMCN5WFO.cjs → chunk-JSM3O7EM.cjs} +2 -2
- package/dist/{chunk-RMCN5WFO.cjs.map → chunk-JSM3O7EM.cjs.map} +1 -1
- package/dist/chunk-MZMA32NE.js +3 -0
- package/dist/chunk-MZMA32NE.js.map +1 -0
- package/dist/{chunk-D2Q2VFJ6.js → chunk-N4SSR7Q6.js} +2 -2
- package/dist/{chunk-D2Q2VFJ6.js.map → chunk-N4SSR7Q6.js.map} +1 -1
- package/dist/{chunk-RN3ISTM3.cjs → chunk-NEGZZB7F.cjs} +2 -2
- package/dist/{chunk-RN3ISTM3.cjs.map → chunk-NEGZZB7F.cjs.map} +1 -1
- package/dist/{chunk-IPSOWFCA.js → chunk-NMU5E7W7.js} +2 -2
- package/dist/{chunk-IPSOWFCA.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-OMHRBKAT.js → chunk-OONQ3V3I.js} +2 -2
- package/dist/{chunk-OMHRBKAT.js.map → chunk-OONQ3V3I.js.map} +1 -1
- package/dist/{chunk-LTJV3VJE.cjs → chunk-RAPEZR5L.cjs} +2 -2
- package/dist/{chunk-LTJV3VJE.cjs.map → chunk-RAPEZR5L.cjs.map} +1 -1
- package/dist/{chunk-UXR7JIPX.js → chunk-RDYXH7ML.js} +2 -2
- package/dist/{chunk-UXR7JIPX.js.map → chunk-RDYXH7ML.js.map} +1 -1
- package/dist/{chunk-CDNJZBM3.cjs → chunk-SAF3B3AX.cjs} +2 -2
- package/dist/{chunk-CDNJZBM3.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-DA7M6H63.cjs → chunk-SQHBOWES.cjs} +2 -2
- package/dist/{chunk-DA7M6H63.cjs.map → chunk-SQHBOWES.cjs.map} +1 -1
- package/dist/{chunk-2BXNZM3G.js → chunk-UF5XMZTT.js} +2 -2
- package/dist/{chunk-2BXNZM3G.js.map → chunk-UF5XMZTT.js.map} +1 -1
- 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-2VE4OW4A.cjs → chunk-WGP4UUO5.cjs} +2 -2
- package/dist/{chunk-2VE4OW4A.cjs.map → chunk-WGP4UUO5.cjs.map} +1 -1
- package/dist/{chunk-F7QIBC4B.cjs → chunk-XBGK3TTU.cjs} +3 -3
- package/dist/{chunk-F7QIBC4B.cjs.map → chunk-XBGK3TTU.cjs.map} +1 -1
- package/dist/{chunk-GP4H5OIT.js → chunk-XHQYHXRE.js} +3 -3
- package/dist/{chunk-GP4H5OIT.js.map → chunk-XHQYHXRE.js.map} +1 -1
- package/dist/{chunk-RE6AIU6Y.js → chunk-XX55RR4Q.js} +3 -3
- package/dist/{chunk-RE6AIU6Y.js.map → chunk-XX55RR4Q.js.map} +1 -1
- package/dist/chunk-YBQPEWT7.cjs +3 -0
- package/dist/chunk-YBQPEWT7.cjs.map +1 -0
- package/dist/{chunk-7EP36NXE.js → chunk-ZDCZ5IDD.js} +3 -3
- package/dist/{chunk-7EP36NXE.js.map → chunk-ZDCZ5IDD.js.map} +1 -1
- package/dist/constants.cjs +1 -1
- package/dist/constants.js +1 -1
- package/dist/engine.cjs +1 -1
- package/dist/engine.d.cts +9 -9
- package/dist/engine.d.ts +9 -9
- 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.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +9 -9
- package/dist/index.d.ts +9 -9
- package/dist/index.js +1 -1
- package/dist/language.d.cts +8 -8
- package/dist/language.d.ts +8 -8
- 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 +2 -2
- package/dist/normalizer.d.ts +2 -2
- package/dist/normalizer.js +1 -1
- package/dist/packages.cjs +1 -1
- package/dist/packages.d.cts +7 -7
- package/dist/packages.d.ts +7 -7
- package/dist/packages.js +1 -1
- package/dist/parser.cjs +1 -1
- package/dist/parser.d.cts +2 -2
- package/dist/parser.d.ts +2 -2
- package/dist/parser.js +1 -1
- package/dist/resolvers.d.cts +1 -1
- package/dist/resolvers.d.ts +1 -1
- package/dist/testing.cjs +2 -2
- package/dist/testing.d.cts +8 -8
- package/dist/testing.d.ts +8 -8
- package/dist/testing.js +1 -1
- package/dist/uom.cjs +1 -1
- package/dist/uom.d.cts +1 -1
- package/dist/uom.d.ts +1 -1
- package/dist/uom.js +1 -1
- package/dist/vm.cjs +1 -1
- package/dist/vm.d.cts +5 -5
- package/dist/vm.d.ts +5 -5
- package/dist/vm.js +1 -1
- package/dist/worker.cjs +2 -2
- package/dist/worker.d.cts +8 -8
- package/dist/worker.d.ts +8 -8
- package/dist/worker.js +1 -1
- package/package.json +5 -5
- package/dist/chunk-2JSNWYYA.cjs +0 -3
- package/dist/chunk-2JSNWYYA.cjs.map +0 -1
- package/dist/chunk-5GL4SAVH.cjs +0 -2
- package/dist/chunk-5GL4SAVH.cjs.map +0 -1
- package/dist/chunk-72N3ZRVE.cjs +0 -2
- package/dist/chunk-72N3ZRVE.cjs.map +0 -1
- package/dist/chunk-A4JV7HRB.js +0 -3
- package/dist/chunk-A4JV7HRB.js.map +0 -1
- package/dist/chunk-AUOE7MFI.cjs +0 -2
- package/dist/chunk-BDF4VCQX.js +0 -3
- package/dist/chunk-BDF4VCQX.js.map +0 -1
- package/dist/chunk-ELQQKZN3.cjs +0 -3
- package/dist/chunk-ELQQKZN3.cjs.map +0 -1
- package/dist/chunk-HQ7BKXG7.js.map +0 -1
- package/dist/chunk-IHAZL4EF.cjs +0 -2
- package/dist/chunk-IHAZL4EF.cjs.map +0 -1
- package/dist/chunk-LM6ZQUEU.js +0 -2
- package/dist/chunk-LM6ZQUEU.js.map +0 -1
- package/dist/chunk-NUF66H57.js +0 -5
- package/dist/chunk-NUF66H57.js.map +0 -1
- package/dist/chunk-PWWQZFAE.js +0 -2
- package/dist/chunk-PWWQZFAE.js.map +0 -1
- package/dist/chunk-RECRD45C.cjs +0 -5
- package/dist/chunk-RECRD45C.cjs.map +0 -1
- package/dist/chunk-RENO2AWO.js +0 -2
- package/dist/chunk-RENO2AWO.js.map +0 -1
- package/dist/chunk-S46R5QZP.cjs +0 -2
- package/dist/chunk-S46R5QZP.cjs.map +0 -1
- package/dist/chunk-UPH22K2T.cjs +0 -2
- package/dist/chunk-UPH22K2T.cjs.map +0 -1
- package/dist/chunk-UY3ID6JF.cjs.map +0 -1
- package/dist/chunk-WFOQRPA6.js +0 -2
- package/dist/chunk-WFOQRPA6.js.map +0 -1
- package/dist/chunk-XFJABR3B.js +0 -2
- package/dist/chunk-XFJABR3B.js.map +0 -1
package/dist/constants.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunk4NZXCHQL_cjs=require('./chunk-4NZXCHQL.cjs');require('./chunk-YBQPEWT7.cjs');Object.defineProperty(exports,"ConfigManager",{enumerable:true,get:function(){return chunk4NZXCHQL_cjs.d}});Object.defineProperty(exports,"DEFAULT_CONFIG",{enumerable:true,get:function(){return chunk4NZXCHQL_cjs.b}});Object.defineProperty(exports,"ENGINE_VERSION",{enumerable:true,get:function(){return chunk4NZXCHQL_cjs.a}});//# sourceMappingURL=constants.cjs.map
|
|
2
2
|
//# sourceMappingURL=constants.cjs.map
|
package/dist/constants.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{d as ConfigManager,b as DEFAULT_CONFIG,a as ENGINE_VERSION}from'./chunk-
|
|
1
|
+
export{d as ConfigManager,b as DEFAULT_CONFIG,a as ENGINE_VERSION}from'./chunk-DUYTXLO2.js';import'./chunk-57PSJQQW.js';//# sourceMappingURL=constants.js.map
|
|
2
2
|
//# sourceMappingURL=constants.js.map
|
package/dist/engine.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunk4BAUQE6A_cjs=require('./chunk-4BAUQE6A.cjs');require('./chunk-EFJCC6FJ.cjs');var chunkSPOVFRZO_cjs=require('./chunk-SPOVFRZO.cjs');require('./chunk-VMSCRVNX.cjs'),require('./chunk-NGBBNL4K.cjs'),require('./chunk-ZVPZQ66D.cjs'),require('./chunk-TTFO4YDP.cjs'),require('./chunk-JSM3O7EM.cjs'),require('./chunk-HG4NPDN5.cjs'),require('./chunk-XBGK3TTU.cjs'),require('./chunk-R2SZFJTT.cjs'),require('./chunk-RAPEZR5L.cjs'),require('./chunk-FYTB7SDP.cjs'),require('./chunk-GBCN7FNV.cjs'),require('./chunk-UURM7P3P.cjs'),require('./chunk-ZLRJ7TDP.cjs'),require('./chunk-634ILVMP.cjs'),require('./chunk-FYAMQFZZ.cjs'),require('./chunk-ABVDKMNF.cjs'),require('./chunk-TLG7VZRX.cjs'),require('./chunk-5TVI2UPZ.cjs'),require('./chunk-WGP4UUO5.cjs'),require('./chunk-SQHBOWES.cjs'),require('./chunk-ZKFCKAIX.cjs'),require('./chunk-4NZXCHQL.cjs'),require('./chunk-BMXYR5LI.cjs'),require('./chunk-Y7O4D3BJ.cjs'),require('./chunk-77KI7AKJ.cjs'),require('./chunk-5IJD5L3O.cjs'),require('./chunk-S3DFU33X.cjs'),require('./chunk-J4LSAHCY.cjs'),require('./chunk-EZKR44MA.cjs'),require('./chunk-YBQPEWT7.cjs');Object.defineProperty(exports,"DocumentModel",{enumerable:true,get:function(){return chunk4BAUQE6A_cjs.a}});Object.defineProperty(exports,"EvalTier",{enumerable:true,get:function(){return chunk4BAUQE6A_cjs.b}});Object.defineProperty(exports,"ThreeTierEvaluator",{enumerable:true,get:function(){return chunk4BAUQE6A_cjs.c}});Object.defineProperty(exports,"evaluateDocument",{enumerable:true,get:function(){return chunk4BAUQE6A_cjs.d}});Object.defineProperty(exports,"AsyncResolutionBatcher",{enumerable:true,get:function(){return chunkSPOVFRZO_cjs.h}});Object.defineProperty(exports,"ExpressionEngine",{enumerable:true,get:function(){return chunkSPOVFRZO_cjs.n}});Object.defineProperty(exports,"SNAPSHOT_FORMAT",{enumerable:true,get:function(){return chunkSPOVFRZO_cjs.d}});Object.defineProperty(exports,"SNAPSHOT_VERSION",{enumerable:true,get:function(){return chunkSPOVFRZO_cjs.e}});Object.defineProperty(exports,"SnapshotErrorCodes",{enumerable:true,get:function(){return chunkSPOVFRZO_cjs.f}});Object.defineProperty(exports,"checkExpressionComplexity",{enumerable:true,get:function(){return chunkSPOVFRZO_cjs.j}});Object.defineProperty(exports,"checkExpressionLength",{enumerable:true,get:function(){return chunkSPOVFRZO_cjs.i}});Object.defineProperty(exports,"extractReadsAndWrites",{enumerable:true,get:function(){return chunkSPOVFRZO_cjs.k}});Object.defineProperty(exports,"findInlineSolvesInLine",{enumerable:true,get:function(){return chunkSPOVFRZO_cjs.m}});Object.defineProperty(exports,"isEmptyLine",{enumerable:true,get:function(){return chunkSPOVFRZO_cjs.l}});//# sourceMappingURL=engine.cjs.map
|
|
2
2
|
//# sourceMappingURL=engine.cjs.map
|
package/dist/engine.d.cts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { D as DocumentModel, E as ExpressionEngine, V as ViewportRange, r as LineChange, U as UnifiedParsingOptions, P as ParsingResult, s as InlineSolvePosition } from './PackageRegistry-
|
|
2
|
-
export { A as ApplyChangesResult, t as AsyncCachePackageInfo, u as AsyncErrorEvent, v as AsyncResolutionBatcher, w as AsyncResolutionEvent, B as BatcherMetrics, x as BytecodeCacheEntry, y as CacheSnapshot, z as CheckpointSnapshot, a as EngineOptions, b as EngineRestoreOptions, c as EngineSnapshot, d as Explanation, e as ExplanationStep, F as LineCacheEntryInfo, G as LineState, H as LinesUpdatedEvent, J as ParsedLine, S as SNAPSHOT_FORMAT, f as SNAPSHOT_VERSION, g as SerializedAnonymousBody, h as SerializedBytecode, i as SerializedDecimal, j as SerializedLineCacheEntry, k as SerializedNumber, l as SerializedRational, m as SerializedUserFunction, n as SerializedValue, o as SnapshotErrorCodes } from './PackageRegistry-
|
|
1
|
+
import { D as DocumentModel, E as ExpressionEngine, V as ViewportRange, r as LineChange, U as UnifiedParsingOptions, P as ParsingResult, s as InlineSolvePosition } from './PackageRegistry-Dvn4i2QK.cjs';
|
|
2
|
+
export { A as ApplyChangesResult, t as AsyncCachePackageInfo, u as AsyncErrorEvent, v as AsyncResolutionBatcher, w as AsyncResolutionEvent, B as BatcherMetrics, x as BytecodeCacheEntry, y as CacheSnapshot, z as CheckpointSnapshot, a as EngineOptions, b as EngineRestoreOptions, c as EngineSnapshot, d as Explanation, e as ExplanationStep, F as LineCacheEntryInfo, G as LineState, H as LinesUpdatedEvent, J as ParsedLine, S as SNAPSHOT_FORMAT, f as SNAPSHOT_VERSION, g as SerializedAnonymousBody, h as SerializedBytecode, i as SerializedDecimal, j as SerializedLineCacheEntry, k as SerializedNumber, l as SerializedRational, m as SerializedUserFunction, n as SerializedValue, o as SnapshotErrorCodes } from './PackageRegistry-Dvn4i2QK.cjs';
|
|
3
3
|
import { V as Value } from './Value-Ds3Gy07C.cjs';
|
|
4
|
-
import { a as VMCheckpointer } from './VMCheckpoints-
|
|
4
|
+
import { a as VMCheckpointer } from './VMCheckpoints-CYqeq8IV.cjs';
|
|
5
5
|
import { T as Token } from './Token-CbP_OutD.cjs';
|
|
6
|
-
import { E as EngineError } from './EngineError-
|
|
7
|
-
import { a as BytecodeProgram } from './BytecodeBuilder-
|
|
8
|
-
export { a as DagSnapshot } from './ScopeManager-
|
|
9
|
-
import './Parselet-
|
|
6
|
+
import { E as EngineError } from './EngineError-fR1K1rvx.cjs';
|
|
7
|
+
import { a as BytecodeProgram } from './BytecodeBuilder-DSWKZi4f.cjs';
|
|
8
|
+
export { a as DagSnapshot } from './ScopeManager-CdwX0VTw.cjs';
|
|
9
|
+
import './Parselet-BawfGuTF.cjs';
|
|
10
10
|
import './pipeline-69q2tsLE.cjs';
|
|
11
|
-
import './Lexer-
|
|
11
|
+
import './Lexer-aB95pjoX.cjs';
|
|
12
12
|
import './resolvers.cjs';
|
|
13
13
|
import '@tanstack/query-core';
|
|
14
|
-
import './TokenNormalizer-
|
|
14
|
+
import './TokenNormalizer-CjTDmHgB.cjs';
|
|
15
15
|
import './Configuration-DnzYPmoK.cjs';
|
|
16
16
|
|
|
17
17
|
/**
|
package/dist/engine.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { D as DocumentModel, E as ExpressionEngine, V as ViewportRange, r as LineChange, U as UnifiedParsingOptions, P as ParsingResult, s as InlineSolvePosition } from './PackageRegistry-
|
|
2
|
-
export { A as ApplyChangesResult, t as AsyncCachePackageInfo, u as AsyncErrorEvent, v as AsyncResolutionBatcher, w as AsyncResolutionEvent, B as BatcherMetrics, x as BytecodeCacheEntry, y as CacheSnapshot, z as CheckpointSnapshot, a as EngineOptions, b as EngineRestoreOptions, c as EngineSnapshot, d as Explanation, e as ExplanationStep, F as LineCacheEntryInfo, G as LineState, H as LinesUpdatedEvent, J as ParsedLine, S as SNAPSHOT_FORMAT, f as SNAPSHOT_VERSION, g as SerializedAnonymousBody, h as SerializedBytecode, i as SerializedDecimal, j as SerializedLineCacheEntry, k as SerializedNumber, l as SerializedRational, m as SerializedUserFunction, n as SerializedValue, o as SnapshotErrorCodes } from './PackageRegistry-
|
|
1
|
+
import { D as DocumentModel, E as ExpressionEngine, V as ViewportRange, r as LineChange, U as UnifiedParsingOptions, P as ParsingResult, s as InlineSolvePosition } from './PackageRegistry-DT-x32OM.js';
|
|
2
|
+
export { A as ApplyChangesResult, t as AsyncCachePackageInfo, u as AsyncErrorEvent, v as AsyncResolutionBatcher, w as AsyncResolutionEvent, B as BatcherMetrics, x as BytecodeCacheEntry, y as CacheSnapshot, z as CheckpointSnapshot, a as EngineOptions, b as EngineRestoreOptions, c as EngineSnapshot, d as Explanation, e as ExplanationStep, F as LineCacheEntryInfo, G as LineState, H as LinesUpdatedEvent, J as ParsedLine, S as SNAPSHOT_FORMAT, f as SNAPSHOT_VERSION, g as SerializedAnonymousBody, h as SerializedBytecode, i as SerializedDecimal, j as SerializedLineCacheEntry, k as SerializedNumber, l as SerializedRational, m as SerializedUserFunction, n as SerializedValue, o as SnapshotErrorCodes } from './PackageRegistry-DT-x32OM.js';
|
|
3
3
|
import { V as Value } from './Value-Ds3Gy07C.js';
|
|
4
|
-
import { a as VMCheckpointer } from './VMCheckpoints-
|
|
4
|
+
import { a as VMCheckpointer } from './VMCheckpoints-DDlxNssY.js';
|
|
5
5
|
import { T as Token } from './Token-CbP_OutD.js';
|
|
6
|
-
import { E as EngineError } from './EngineError-
|
|
7
|
-
import { a as BytecodeProgram } from './BytecodeBuilder-
|
|
8
|
-
export { a as DagSnapshot } from './ScopeManager-
|
|
9
|
-
import './Parselet-
|
|
6
|
+
import { E as EngineError } from './EngineError-fR1K1rvx.js';
|
|
7
|
+
import { a as BytecodeProgram } from './BytecodeBuilder-DSWKZi4f.js';
|
|
8
|
+
export { a as DagSnapshot } from './ScopeManager-B636am7Y.js';
|
|
9
|
+
import './Parselet-DqTbbtWA.js';
|
|
10
10
|
import './pipeline-DTqGLPsV.js';
|
|
11
|
-
import './Lexer-
|
|
11
|
+
import './Lexer-Bmctxl0n.js';
|
|
12
12
|
import './resolvers.js';
|
|
13
13
|
import '@tanstack/query-core';
|
|
14
|
-
import './TokenNormalizer-
|
|
14
|
+
import './TokenNormalizer-CLBtiE8M.js';
|
|
15
15
|
import './Configuration-DnzYPmoK.js';
|
|
16
16
|
|
|
17
17
|
/**
|
package/dist/engine.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{a as DocumentModel,b as EvalTier,c as ThreeTierEvaluator,d as evaluateDocument}from'./chunk-
|
|
1
|
+
export{a as DocumentModel,b as EvalTier,c as ThreeTierEvaluator,d as evaluateDocument}from'./chunk-ZDCZ5IDD.js';import'./chunk-RAF57WYO.js';export{h as AsyncResolutionBatcher,n as ExpressionEngine,d as SNAPSHOT_FORMAT,e as SNAPSHOT_VERSION,f as SnapshotErrorCodes,j as checkExpressionComplexity,i as checkExpressionLength,k as extractReadsAndWrites,m as findInlineSolvesInLine,l as isEmptyLine}from'./chunk-7N3IJSWF.js';import'./chunk-4BRTUFTH.js';import'./chunk-2RWAXT6O.js';import'./chunk-IJHL3LMH.js';import'./chunk-MIQBJGGR.js';import'./chunk-N4SSR7Q6.js';import'./chunk-JP4JMQOG.js';import'./chunk-XX55RR4Q.js';import'./chunk-XEIDV5JP.js';import'./chunk-63ZOOUOL.js';import'./chunk-EL2XUOWX.js';import'./chunk-72PYPENZ.js';import'./chunk-76F3LCIL.js';import'./chunk-TCZSPH4A.js';import'./chunk-UF5XMZTT.js';import'./chunk-XHQYHXRE.js';import'./chunk-TZYMXNIB.js';import'./chunk-HFKDWQUL.js';import'./chunk-5TCSFTZD.js';import'./chunk-RDYXH7ML.js';import'./chunk-NMU5E7W7.js';import'./chunk-4CNYGIND.js';import'./chunk-DUYTXLO2.js';import'./chunk-7DP57BA7.js';import'./chunk-JPFCXLJV.js';import'./chunk-OB2VX4IL.js';import'./chunk-IJMNVBIS.js';import'./chunk-LHLW7JLS.js';import'./chunk-CHVGFTO3.js';import'./chunk-PRSXXDTA.js';import'./chunk-57PSJQQW.js';//# sourceMappingURL=engine.js.map
|
|
2
2
|
//# sourceMappingURL=engine.js.map
|
package/dist/errors.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunkSAF3B3AX_cjs=require('./chunk-SAF3B3AX.cjs'),chunkYBQPEWT7_cjs=require('./chunk-YBQPEWT7.cjs');Object.defineProperty(exports,"WorkerErrorCodes",{enumerable:true,get:function(){return chunkSAF3B3AX_cjs.a}});Object.defineProperty(exports,"deserializeEngineError",{enumerable:true,get:function(){return chunkSAF3B3AX_cjs.c}});Object.defineProperty(exports,"serializeEngineError",{enumerable:true,get:function(){return chunkSAF3B3AX_cjs.b}});Object.defineProperty(exports,"workerCancelledError",{enumerable:true,get:function(){return chunkSAF3B3AX_cjs.d}});Object.defineProperty(exports,"workerTerminatedError",{enumerable:true,get:function(){return chunkSAF3B3AX_cjs.e}});Object.defineProperty(exports,"workerTransportError",{enumerable:true,get:function(){return chunkSAF3B3AX_cjs.f}});Object.defineProperty(exports,"CoreErrorCodes",{enumerable:true,get:function(){return chunkYBQPEWT7_cjs.r}});Object.defineProperty(exports,"EngineError",{enumerable:true,get:function(){return chunkYBQPEWT7_cjs.b}});Object.defineProperty(exports,"ErrorCategory",{enumerable:true,get:function(){return chunkYBQPEWT7_cjs.a}});Object.defineProperty(exports,"ErrorFactory",{enumerable:true,get:function(){return chunkYBQPEWT7_cjs.c}});Object.defineProperty(exports,"andThen",{enumerable:true,get:function(){return chunkYBQPEWT7_cjs.k}});Object.defineProperty(exports,"combine",{enumerable:true,get:function(){return chunkYBQPEWT7_cjs.n}});Object.defineProperty(exports,"err",{enumerable:true,get:function(){return chunkYBQPEWT7_cjs.f}});Object.defineProperty(exports,"isErr",{enumerable:true,get:function(){return chunkYBQPEWT7_cjs.h}});Object.defineProperty(exports,"isOk",{enumerable:true,get:function(){return chunkYBQPEWT7_cjs.g}});Object.defineProperty(exports,"map",{enumerable:true,get:function(){return chunkYBQPEWT7_cjs.i}});Object.defineProperty(exports,"mapErr",{enumerable:true,get:function(){return chunkYBQPEWT7_cjs.j}});Object.defineProperty(exports,"match",{enumerable:true,get:function(){return chunkYBQPEWT7_cjs.m}});Object.defineProperty(exports,"normalizeUnknownError",{enumerable:true,get:function(){return chunkYBQPEWT7_cjs.d}});Object.defineProperty(exports,"ok",{enumerable:true,get:function(){return chunkYBQPEWT7_cjs.e}});Object.defineProperty(exports,"throwIfErr",{enumerable:true,get:function(){return chunkYBQPEWT7_cjs.o}});Object.defineProperty(exports,"tryCatch",{enumerable:true,get:function(){return chunkYBQPEWT7_cjs.p}});Object.defineProperty(exports,"tryCatchAsync",{enumerable:true,get:function(){return chunkYBQPEWT7_cjs.q}});Object.defineProperty(exports,"unwrapOr",{enumerable:true,get:function(){return chunkYBQPEWT7_cjs.l}});//# sourceMappingURL=errors.cjs.map
|
|
2
2
|
//# sourceMappingURL=errors.cjs.map
|
package/dist/errors.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { E as EngineError } from './EngineError-
|
|
2
|
-
export { C as CoreErrorCode, a as CoreErrorCodes, b as EngineErrorInit, c as ErrorCategory, d as ErrorCode, e as ErrorFactory, S as SourceSpan, n as normalizeUnknownError } from './EngineError-
|
|
3
|
-
export { S as SerializedEngineError, W as WorkerErrorCodes, d as deserializeEngineError, s as serializeEngineError, w as workerCancelledError, a as workerTerminatedError, b as workerTransportError } from './WorkerError-
|
|
1
|
+
import { E as EngineError } from './EngineError-fR1K1rvx.cjs';
|
|
2
|
+
export { C as CoreErrorCode, a as CoreErrorCodes, b as EngineErrorInit, c as ErrorCategory, d as ErrorCode, e as ErrorFactory, S as SourceSpan, n as normalizeUnknownError } from './EngineError-fR1K1rvx.cjs';
|
|
3
|
+
export { S as SerializedEngineError, W as WorkerErrorCodes, d as deserializeEngineError, s as serializeEngineError, w as workerCancelledError, a as workerTerminatedError, b as workerTransportError } from './WorkerError-B1dF3VYT.cjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* A Rust-style `Result<T, E>`, the value half of this engine's error-handling
|
package/dist/errors.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { E as EngineError } from './EngineError-
|
|
2
|
-
export { C as CoreErrorCode, a as CoreErrorCodes, b as EngineErrorInit, c as ErrorCategory, d as ErrorCode, e as ErrorFactory, S as SourceSpan, n as normalizeUnknownError } from './EngineError-
|
|
3
|
-
export { S as SerializedEngineError, W as WorkerErrorCodes, d as deserializeEngineError, s as serializeEngineError, w as workerCancelledError, a as workerTerminatedError, b as workerTransportError } from './WorkerError-
|
|
1
|
+
import { E as EngineError } from './EngineError-fR1K1rvx.js';
|
|
2
|
+
export { C as CoreErrorCode, a as CoreErrorCodes, b as EngineErrorInit, c as ErrorCategory, d as ErrorCode, e as ErrorFactory, S as SourceSpan, n as normalizeUnknownError } from './EngineError-fR1K1rvx.js';
|
|
3
|
+
export { S as SerializedEngineError, W as WorkerErrorCodes, d as deserializeEngineError, s as serializeEngineError, w as workerCancelledError, a as workerTerminatedError, b as workerTransportError } from './WorkerError-dneODN-u.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* A Rust-style `Result<T, E>`, the value half of this engine's error-handling
|
package/dist/errors.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{a as WorkerErrorCodes,c as deserializeEngineError,b as serializeEngineError,d as workerCancelledError,e as workerTerminatedError,f as workerTransportError}from'./chunk-
|
|
1
|
+
export{a as WorkerErrorCodes,c as deserializeEngineError,b as serializeEngineError,d as workerCancelledError,e as workerTerminatedError,f as workerTransportError}from'./chunk-JFZ5SLF7.js';export{r as CoreErrorCodes,b as EngineError,a as ErrorCategory,c as ErrorFactory,k as andThen,n as combine,f as err,h as isErr,g as isOk,i as map,j as mapErr,m as match,d as normalizeUnknownError,e as ok,o as throwIfErr,p as tryCatch,q as tryCatchAsync,l as unwrapOr}from'./chunk-57PSJQQW.js';//# sourceMappingURL=errors.js.map
|
|
2
2
|
//# sourceMappingURL=errors.js.map
|
package/dist/format.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunkXBGK3TTU_cjs=require('./chunk-XBGK3TTU.cjs');require('./chunk-R2SZFJTT.cjs'),require('./chunk-5TVI2UPZ.cjs'),require('./chunk-WGP4UUO5.cjs'),require('./chunk-SQHBOWES.cjs'),require('./chunk-S3DFU33X.cjs'),require('./chunk-YBQPEWT7.cjs');Object.defineProperty(exports,"DEFAULT_FORMATTING_SETTINGS",{enumerable:true,get:function(){return chunkXBGK3TTU_cjs.a}});Object.defineProperty(exports,"formatMatrixAligned",{enumerable:true,get:function(){return chunkXBGK3TTU_cjs.b}});Object.defineProperty(exports,"formatValue",{enumerable:true,get:function(){return chunkXBGK3TTU_cjs.c}});//# sourceMappingURL=format.cjs.map
|
|
2
2
|
//# sourceMappingURL=format.cjs.map
|
package/dist/format.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{a as DEFAULT_FORMATTING_SETTINGS,b as formatMatrixAligned,c as formatValue}from'./chunk-
|
|
1
|
+
export{a as DEFAULT_FORMATTING_SETTINGS,b as formatMatrixAligned,c as formatValue}from'./chunk-XX55RR4Q.js';import'./chunk-XEIDV5JP.js';import'./chunk-5TCSFTZD.js';import'./chunk-RDYXH7ML.js';import'./chunk-NMU5E7W7.js';import'./chunk-LHLW7JLS.js';import'./chunk-57PSJQQW.js';//# sourceMappingURL=format.js.map
|
|
2
2
|
//# sourceMappingURL=format.js.map
|
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';require('./chunk-
|
|
1
|
+
'use strict';require('./chunk-4BAUQE6A.cjs'),require('./chunk-EFJCC6FJ.cjs');var chunkSPOVFRZO_cjs=require('./chunk-SPOVFRZO.cjs');require('./chunk-VMSCRVNX.cjs'),require('./chunk-NGBBNL4K.cjs'),require('./chunk-ZVPZQ66D.cjs'),require('./chunk-TTFO4YDP.cjs'),require('./chunk-JSM3O7EM.cjs'),require('./chunk-HG4NPDN5.cjs');var chunkXBGK3TTU_cjs=require('./chunk-XBGK3TTU.cjs');require('./chunk-R2SZFJTT.cjs');var chunkUV3EUIBT_cjs=require('./chunk-UV3EUIBT.cjs');require('./chunk-NEGZZB7F.cjs'),require('./chunk-RAPEZR5L.cjs');var chunkFYTB7SDP_cjs=require('./chunk-FYTB7SDP.cjs');require('./chunk-GBCN7FNV.cjs'),require('./chunk-UURM7P3P.cjs'),require('./chunk-ZLRJ7TDP.cjs'),require('./chunk-634ILVMP.cjs'),require('./chunk-FYAMQFZZ.cjs'),require('./chunk-ABVDKMNF.cjs'),require('./chunk-TLG7VZRX.cjs'),require('./chunk-5TVI2UPZ.cjs'),require('./chunk-WGP4UUO5.cjs');var chunkSQHBOWES_cjs=require('./chunk-SQHBOWES.cjs');require('./chunk-ZKFCKAIX.cjs');var chunk4NZXCHQL_cjs=require('./chunk-4NZXCHQL.cjs');require('./chunk-BMXYR5LI.cjs'),require('./chunk-Y7O4D3BJ.cjs'),require('./chunk-77KI7AKJ.cjs'),require('./chunk-5IJD5L3O.cjs'),require('./chunk-S3DFU33X.cjs'),require('./chunk-J4LSAHCY.cjs'),require('./chunk-EZKR44MA.cjs');var chunkYBQPEWT7_cjs=require('./chunk-YBQPEWT7.cjs');var r={DEFINE_FUNCTION_INVALID_NAME:"DEFINE_FUNCTION_INVALID_NAME",DEFINE_FUNCTION_INVALID_SPEC:"DEFINE_FUNCTION_INVALID_SPEC",DEFINE_FUNCTION_ARITY_MISMATCH:"DEFINE_FUNCTION_ARITY_MISMATCH",DEFINE_FUNCTION_ARGUMENT_TYPE:"DEFINE_FUNCTION_ARGUMENT_TYPE",DEFINE_FUNCTION_RETURN_TYPE:"DEFINE_FUNCTION_RETURN_TYPE"},P=/^[a-z_][a-z0-9_]*$/i,N=new Set(["number","string","boolean"]);function u(e){return e===1?"1 argument":`${e} arguments`}function d(e){switch(e.type){case 0:case 1:return "a number";case 3:return "a string";case 10:return "a boolean";case 2:return "a big integer";case 5:return "a percentage";case 6:return "a value with a unit";case 4:return "a date";case 7:return "a matrix";case 8:return "a range";case 9:return "a symbolic expression";default:return "an unsupported value"}}function V(e,n,t){switch(n.type){case "number":if(e.type===0||e.type===1)return e.toNumber();break;case "string":if(e.type===3)return e.value;break;case "boolean":if(e.type===10)return e.value;break}throw chunkYBQPEWT7_cjs.c.execution({code:r.DEFINE_FUNCTION_ARGUMENT_TYPE,message:`${t}() expects "${n.name}" to be a ${n.type}, but was given ${d(e)}`,expected:`a ${n.type}`,found:d(e),context:{functionName:t,argName:n.name,expectedType:n.type}})}function O(e,n,t){switch(n){case "number":if(typeof e=="number")return chunkSQHBOWES_cjs.n(e);break;case "string":if(typeof e=="string")return chunkSQHBOWES_cjs.t(e);break;case "boolean":if(typeof e=="boolean")return chunkSQHBOWES_cjs.L(e);break}throw chunkYBQPEWT7_cjs.c.internal({code:r.DEFINE_FUNCTION_RETURN_TYPE,message:`${t}() is declared to return a ${n}, but its implementation returned ${typeof e}`,expected:`a ${n}`,found:typeof e,context:{functionName:t,expectedType:n}})}var p=class{constructor(n){this.fnName=n;this.category="Function";}parse(n,t,a){n.consume("LPAREN");let i=0;if(n.peek()?.type!=="RPAREN")for(n.parseExpression(chunkFYTB7SDP_cjs.a.Lowest,a),i++;n.match("COMMA");)n.parseExpression(chunkFYTB7SDP_cjs.a.Lowest,a),i++;n.consume("RPAREN"),a.emitPluginCall(this.fnName,i);}};function h(e){let n=e.args.length;return t=>{if(t.length!==n)throw chunkYBQPEWT7_cjs.c.execution({code:r.DEFINE_FUNCTION_ARITY_MISMATCH,message:`${e.name}() takes ${u(n)}, but was given ${t.length===0?"none":u(t.length)}`,expected:u(n),found:t.length===0?"none":u(t.length),context:{functionName:e.name,expected:n,actual:t.length}});let a=new Array(n);for(let s=0;s<n;s++)a[s]=V(t[s],e.args[s],e.name);let i=e.call(...a);return O(i,e.returns,e.name)}}function R(e){if(typeof e?.name!="string"||!P.test(e.name))throw chunkYBQPEWT7_cjs.c.config({code:r.DEFINE_FUNCTION_INVALID_NAME,message:`defineFunction: name must be a single identifier, got ${JSON.stringify(e?.name)}`,suggestion:'e.g. "vat" or "net_price"',context:{name:e?.name}});if(!Array.isArray(e.args))throw chunkYBQPEWT7_cjs.c.config({code:r.DEFINE_FUNCTION_INVALID_SPEC,message:`defineFunction: "${e.name}" args must be an array`,context:{name:e.name}});for(let n of e.args){if(typeof n?.name!="string"||n.name.length===0)throw chunkYBQPEWT7_cjs.c.config({code:r.DEFINE_FUNCTION_INVALID_SPEC,message:`defineFunction: "${e.name}" has an argument with no name`,context:{name:e.name}});if(!N.has(n.type))throw chunkYBQPEWT7_cjs.c.config({code:r.DEFINE_FUNCTION_INVALID_SPEC,message:`defineFunction: "${e.name}" argument "${n.name}" has unsupported type ${JSON.stringify(n.type)}`,suggestion:"supported argument types are number, string, boolean",context:{name:e.name,argName:n.name,type:n.type}})}if(!N.has(e.returns))throw chunkYBQPEWT7_cjs.c.config({code:r.DEFINE_FUNCTION_INVALID_SPEC,message:`defineFunction: "${e.name}" has unsupported return type ${JSON.stringify(e.returns)}`,suggestion:"supported return types are number, string, boolean",context:{name:e.name,returns:e.returns}});if(typeof e.call!="function")throw chunkYBQPEWT7_cjs.c.config({code:r.DEFINE_FUNCTION_INVALID_SPEC,message:`defineFunction: "${e.name}" is missing a call implementation`,context:{name:e.name}})}function k(e){R(e);let n=e.name,t=`DEFINE_FN_${n.toUpperCase()}`;return {name:`solve-fn-${n}`,lexerVocabulary:{keywords:{[n.toLowerCase()]:t}},prefixParselets:{[t]:new p(n)},pluginFunctions:{[n]:h(e)}}}function D(e={}){let{extraPackages:n=[],...t}=e;return new chunkSPOVFRZO_cjs.n({...t,packages:n.length>0?[...chunkUV3EUIBT_cjs.z,...n]:chunkUV3EUIBT_cjs.z})}Object.defineProperty(exports,"ExpressionEngine",{enumerable:true,get:function(){return chunkSPOVFRZO_cjs.n}});Object.defineProperty(exports,"SNAPSHOT_FORMAT",{enumerable:true,get:function(){return chunkSPOVFRZO_cjs.d}});Object.defineProperty(exports,"SNAPSHOT_VERSION",{enumerable:true,get:function(){return chunkSPOVFRZO_cjs.e}});Object.defineProperty(exports,"SnapshotErrorCodes",{enumerable:true,get:function(){return chunkSPOVFRZO_cjs.f}});Object.defineProperty(exports,"assertEngineVersionCompatible",{enumerable:true,get:function(){return chunkSPOVFRZO_cjs.c}});Object.defineProperty(exports,"checkEngineVersionCompatibility",{enumerable:true,get:function(){return chunkSPOVFRZO_cjs.b}});Object.defineProperty(exports,"checkPackageCompatibility",{enumerable:true,get:function(){return chunkSPOVFRZO_cjs.a}});Object.defineProperty(exports,"formatValue",{enumerable:true,get:function(){return chunkXBGK3TTU_cjs.c}});Object.defineProperty(exports,"Value",{enumerable:true,get:function(){return chunkSQHBOWES_cjs.m}});Object.defineProperty(exports,"ValueType",{enumerable:true,get:function(){return chunkSQHBOWES_cjs.g}});Object.defineProperty(exports,"ENGINE_VERSION",{enumerable:true,get:function(){return chunk4NZXCHQL_cjs.a}});exports.DefineFunctionErrorCodes=r;exports.createEngine=D;exports.defineFunction=k;//# sourceMappingURL=index.cjs.map
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.d.cts
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { I as IEnginePackage, a as EngineOptions, E as ExpressionEngine } from './PackageRegistry-
|
|
2
|
-
export { b as EngineRestoreOptions, c as EngineSnapshot, d as Explanation, e as ExplanationStep, S as SNAPSHOT_FORMAT, f as SNAPSHOT_VERSION, g as SerializedAnonymousBody, h as SerializedBytecode, i as SerializedDecimal, j as SerializedLineCacheEntry, k as SerializedNumber, l as SerializedRational, m as SerializedUserFunction, n as SerializedValue, o as SnapshotErrorCodes } from './PackageRegistry-
|
|
3
|
-
export { a as CompatibilityConflict, b as CompatibilityConflictKind, C as CompatibilityReport, c as CompatibilitySeverity, d as checkPackageCompatibility } from './PackageCompatibility-
|
|
1
|
+
import { I as IEnginePackage, a as EngineOptions, E as ExpressionEngine } from './PackageRegistry-Dvn4i2QK.cjs';
|
|
2
|
+
export { b as EngineRestoreOptions, c as EngineSnapshot, d as Explanation, e as ExplanationStep, S as SNAPSHOT_FORMAT, f as SNAPSHOT_VERSION, g as SerializedAnonymousBody, h as SerializedBytecode, i as SerializedDecimal, j as SerializedLineCacheEntry, k as SerializedNumber, l as SerializedRational, m as SerializedUserFunction, n as SerializedValue, o as SnapshotErrorCodes } from './PackageRegistry-Dvn4i2QK.cjs';
|
|
3
|
+
export { a as CompatibilityConflict, b as CompatibilityConflictKind, C as CompatibilityReport, c as CompatibilitySeverity, d as checkPackageCompatibility } from './PackageCompatibility-CUVg8tmt.cjs';
|
|
4
4
|
export { E as EngineConfigOverride } from './Configuration-DnzYPmoK.cjs';
|
|
5
5
|
export { V as Value, a as ValueType } from './Value-Ds3Gy07C.cjs';
|
|
6
6
|
export { formatValue } from './format.cjs';
|
|
7
7
|
export { F as FormattingSettings } from './FormattingSettings-bRKjU7wI.cjs';
|
|
8
8
|
export { ENGINE_VERSION } from './constants.cjs';
|
|
9
|
-
import './Parselet-
|
|
10
|
-
import './BytecodeBuilder-
|
|
9
|
+
import './Parselet-BawfGuTF.cjs';
|
|
10
|
+
import './BytecodeBuilder-DSWKZi4f.cjs';
|
|
11
11
|
import './Token-CbP_OutD.cjs';
|
|
12
12
|
import './pipeline-69q2tsLE.cjs';
|
|
13
|
-
import './Lexer-
|
|
13
|
+
import './Lexer-aB95pjoX.cjs';
|
|
14
|
+
import './EngineError-fR1K1rvx.cjs';
|
|
14
15
|
import './resolvers.cjs';
|
|
15
16
|
import '@tanstack/query-core';
|
|
16
|
-
import './TokenNormalizer-
|
|
17
|
-
import './ScopeManager-
|
|
18
|
-
import './EngineError-D1kXsjIj.cjs';
|
|
17
|
+
import './TokenNormalizer-CjTDmHgB.cjs';
|
|
18
|
+
import './ScopeManager-CdwX0VTw.cjs';
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* A higher-level, declarative way to contribute a single `name(args)`
|
package/dist/index.d.ts
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { I as IEnginePackage, a as EngineOptions, E as ExpressionEngine } from './PackageRegistry-
|
|
2
|
-
export { b as EngineRestoreOptions, c as EngineSnapshot, d as Explanation, e as ExplanationStep, S as SNAPSHOT_FORMAT, f as SNAPSHOT_VERSION, g as SerializedAnonymousBody, h as SerializedBytecode, i as SerializedDecimal, j as SerializedLineCacheEntry, k as SerializedNumber, l as SerializedRational, m as SerializedUserFunction, n as SerializedValue, o as SnapshotErrorCodes } from './PackageRegistry-
|
|
3
|
-
export { a as CompatibilityConflict, b as CompatibilityConflictKind, C as CompatibilityReport, c as CompatibilitySeverity, d as checkPackageCompatibility } from './PackageCompatibility-
|
|
1
|
+
import { I as IEnginePackage, a as EngineOptions, E as ExpressionEngine } from './PackageRegistry-DT-x32OM.js';
|
|
2
|
+
export { b as EngineRestoreOptions, c as EngineSnapshot, d as Explanation, e as ExplanationStep, S as SNAPSHOT_FORMAT, f as SNAPSHOT_VERSION, g as SerializedAnonymousBody, h as SerializedBytecode, i as SerializedDecimal, j as SerializedLineCacheEntry, k as SerializedNumber, l as SerializedRational, m as SerializedUserFunction, n as SerializedValue, o as SnapshotErrorCodes } from './PackageRegistry-DT-x32OM.js';
|
|
3
|
+
export { a as CompatibilityConflict, b as CompatibilityConflictKind, C as CompatibilityReport, c as CompatibilitySeverity, d as checkPackageCompatibility } from './PackageCompatibility-BludTs7v.js';
|
|
4
4
|
export { E as EngineConfigOverride } from './Configuration-DnzYPmoK.js';
|
|
5
5
|
export { V as Value, a as ValueType } from './Value-Ds3Gy07C.js';
|
|
6
6
|
export { formatValue } from './format.js';
|
|
7
7
|
export { F as FormattingSettings } from './FormattingSettings-bRKjU7wI.js';
|
|
8
8
|
export { ENGINE_VERSION } from './constants.js';
|
|
9
|
-
import './Parselet-
|
|
10
|
-
import './BytecodeBuilder-
|
|
9
|
+
import './Parselet-DqTbbtWA.js';
|
|
10
|
+
import './BytecodeBuilder-DSWKZi4f.js';
|
|
11
11
|
import './Token-CbP_OutD.js';
|
|
12
12
|
import './pipeline-DTqGLPsV.js';
|
|
13
|
-
import './Lexer-
|
|
13
|
+
import './Lexer-Bmctxl0n.js';
|
|
14
|
+
import './EngineError-fR1K1rvx.js';
|
|
14
15
|
import './resolvers.js';
|
|
15
16
|
import '@tanstack/query-core';
|
|
16
|
-
import './TokenNormalizer-
|
|
17
|
-
import './ScopeManager-
|
|
18
|
-
import './EngineError-D1kXsjIj.js';
|
|
17
|
+
import './TokenNormalizer-CLBtiE8M.js';
|
|
18
|
+
import './ScopeManager-B636am7Y.js';
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* A higher-level, declarative way to contribute a single `name(args)`
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import'./chunk-
|
|
1
|
+
import'./chunk-ZDCZ5IDD.js';import'./chunk-RAF57WYO.js';import {n}from'./chunk-7N3IJSWF.js';export{n as ExpressionEngine,d as SNAPSHOT_FORMAT,e as SNAPSHOT_VERSION,f as SnapshotErrorCodes,c as assertEngineVersionCompatible,b as checkEngineVersionCompatibility,a as checkPackageCompatibility}from'./chunk-7N3IJSWF.js';import'./chunk-4BRTUFTH.js';import'./chunk-2RWAXT6O.js';import'./chunk-IJHL3LMH.js';import'./chunk-MIQBJGGR.js';import'./chunk-N4SSR7Q6.js';import'./chunk-JP4JMQOG.js';export{c as formatValue}from'./chunk-XX55RR4Q.js';import'./chunk-XEIDV5JP.js';import {z}from'./chunk-MZMA32NE.js';import'./chunk-OONQ3V3I.js';import'./chunk-63ZOOUOL.js';import {a}from'./chunk-EL2XUOWX.js';import'./chunk-72PYPENZ.js';import'./chunk-76F3LCIL.js';import'./chunk-TCZSPH4A.js';import'./chunk-UF5XMZTT.js';import'./chunk-XHQYHXRE.js';import'./chunk-TZYMXNIB.js';import'./chunk-HFKDWQUL.js';import'./chunk-5TCSFTZD.js';import'./chunk-RDYXH7ML.js';import {L,t,n as n$1}from'./chunk-NMU5E7W7.js';export{m as Value,g as ValueType}from'./chunk-NMU5E7W7.js';import'./chunk-4CNYGIND.js';export{a as ENGINE_VERSION}from'./chunk-DUYTXLO2.js';import'./chunk-7DP57BA7.js';import'./chunk-JPFCXLJV.js';import'./chunk-OB2VX4IL.js';import'./chunk-IJMNVBIS.js';import'./chunk-LHLW7JLS.js';import'./chunk-CHVGFTO3.js';import'./chunk-PRSXXDTA.js';import {c}from'./chunk-57PSJQQW.js';var r={DEFINE_FUNCTION_INVALID_NAME:"DEFINE_FUNCTION_INVALID_NAME",DEFINE_FUNCTION_INVALID_SPEC:"DEFINE_FUNCTION_INVALID_SPEC",DEFINE_FUNCTION_ARITY_MISMATCH:"DEFINE_FUNCTION_ARITY_MISMATCH",DEFINE_FUNCTION_ARGUMENT_TYPE:"DEFINE_FUNCTION_ARGUMENT_TYPE",DEFINE_FUNCTION_RETURN_TYPE:"DEFINE_FUNCTION_RETURN_TYPE"},P=/^[a-z_][a-z0-9_]*$/i,N=new Set(["number","string","boolean"]);function u(e){return e===1?"1 argument":`${e} arguments`}function d(e){switch(e.type){case 0:case 1:return "a number";case 3:return "a string";case 10:return "a boolean";case 2:return "a big integer";case 5:return "a percentage";case 6:return "a value with a unit";case 4:return "a date";case 7:return "a matrix";case 8:return "a range";case 9:return "a symbolic expression";default:return "an unsupported value"}}function V(e,n,t){switch(n.type){case "number":if(e.type===0||e.type===1)return e.toNumber();break;case "string":if(e.type===3)return e.value;break;case "boolean":if(e.type===10)return e.value;break}throw c.execution({code:r.DEFINE_FUNCTION_ARGUMENT_TYPE,message:`${t}() expects "${n.name}" to be a ${n.type}, but was given ${d(e)}`,expected:`a ${n.type}`,found:d(e),context:{functionName:t,argName:n.name,expectedType:n.type}})}function O(e,n,t$1){switch(n){case "number":if(typeof e=="number")return n$1(e);break;case "string":if(typeof e=="string")return t(e);break;case "boolean":if(typeof e=="boolean")return L(e);break}throw c.internal({code:r.DEFINE_FUNCTION_RETURN_TYPE,message:`${t$1}() is declared to return a ${n}, but its implementation returned ${typeof e}`,expected:`a ${n}`,found:typeof e,context:{functionName:t$1,expectedType:n}})}var p=class{constructor(n){this.fnName=n;this.category="Function";}parse(n,t,a$1){n.consume("LPAREN");let i=0;if(n.peek()?.type!=="RPAREN")for(n.parseExpression(a.Lowest,a$1),i++;n.match("COMMA");)n.parseExpression(a.Lowest,a$1),i++;n.consume("RPAREN"),a$1.emitPluginCall(this.fnName,i);}};function h(e){let n=e.args.length;return t=>{if(t.length!==n)throw c.execution({code:r.DEFINE_FUNCTION_ARITY_MISMATCH,message:`${e.name}() takes ${u(n)}, but was given ${t.length===0?"none":u(t.length)}`,expected:u(n),found:t.length===0?"none":u(t.length),context:{functionName:e.name,expected:n,actual:t.length}});let a=new Array(n);for(let s=0;s<n;s++)a[s]=V(t[s],e.args[s],e.name);let i=e.call(...a);return O(i,e.returns,e.name)}}function R(e){if(typeof e?.name!="string"||!P.test(e.name))throw c.config({code:r.DEFINE_FUNCTION_INVALID_NAME,message:`defineFunction: name must be a single identifier, got ${JSON.stringify(e?.name)}`,suggestion:'e.g. "vat" or "net_price"',context:{name:e?.name}});if(!Array.isArray(e.args))throw c.config({code:r.DEFINE_FUNCTION_INVALID_SPEC,message:`defineFunction: "${e.name}" args must be an array`,context:{name:e.name}});for(let n of e.args){if(typeof n?.name!="string"||n.name.length===0)throw c.config({code:r.DEFINE_FUNCTION_INVALID_SPEC,message:`defineFunction: "${e.name}" has an argument with no name`,context:{name:e.name}});if(!N.has(n.type))throw c.config({code:r.DEFINE_FUNCTION_INVALID_SPEC,message:`defineFunction: "${e.name}" argument "${n.name}" has unsupported type ${JSON.stringify(n.type)}`,suggestion:"supported argument types are number, string, boolean",context:{name:e.name,argName:n.name,type:n.type}})}if(!N.has(e.returns))throw c.config({code:r.DEFINE_FUNCTION_INVALID_SPEC,message:`defineFunction: "${e.name}" has unsupported return type ${JSON.stringify(e.returns)}`,suggestion:"supported return types are number, string, boolean",context:{name:e.name,returns:e.returns}});if(typeof e.call!="function")throw c.config({code:r.DEFINE_FUNCTION_INVALID_SPEC,message:`defineFunction: "${e.name}" is missing a call implementation`,context:{name:e.name}})}function k(e){R(e);let n=e.name,t=`DEFINE_FN_${n.toUpperCase()}`;return {name:`solve-fn-${n}`,lexerVocabulary:{keywords:{[n.toLowerCase()]:t}},prefixParselets:{[t]:new p(n)},pluginFunctions:{[n]:h(e)}}}function D(e={}){let{extraPackages:n$1=[],...t}=e;return new n({...t,packages:n$1.length>0?[...z,...n$1]:z})}export{r as DefineFunctionErrorCodes,D as createEngine,k as defineFunction};//# sourceMappingURL=index.js.map
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/language.d.cts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { C as CompletionItem } from './PackageRegistry-
|
|
2
|
-
export { L as LanguageService, p as LanguageServiceOptions, q as SemanticToken } from './PackageRegistry-
|
|
3
|
-
import { e as TokenCategory } from './Lexer-
|
|
4
|
-
import './Parselet-
|
|
5
|
-
import './BytecodeBuilder-
|
|
1
|
+
import { C as CompletionItem } from './PackageRegistry-Dvn4i2QK.cjs';
|
|
2
|
+
export { L as LanguageService, p as LanguageServiceOptions, q as SemanticToken } from './PackageRegistry-Dvn4i2QK.cjs';
|
|
3
|
+
import { e as TokenCategory } from './Lexer-aB95pjoX.cjs';
|
|
4
|
+
import './Parselet-BawfGuTF.cjs';
|
|
5
|
+
import './BytecodeBuilder-DSWKZi4f.cjs';
|
|
6
6
|
import './Token-CbP_OutD.cjs';
|
|
7
7
|
import './pipeline-69q2tsLE.cjs';
|
|
8
8
|
import './Value-Ds3Gy07C.cjs';
|
|
9
9
|
import './resolvers.cjs';
|
|
10
10
|
import '@tanstack/query-core';
|
|
11
|
-
import './TokenNormalizer-
|
|
12
|
-
import './ScopeManager-
|
|
13
|
-
import './EngineError-
|
|
11
|
+
import './TokenNormalizer-CjTDmHgB.cjs';
|
|
12
|
+
import './ScopeManager-CdwX0VTw.cjs';
|
|
13
|
+
import './EngineError-fR1K1rvx.cjs';
|
|
14
14
|
import './Configuration-DnzYPmoK.cjs';
|
|
15
15
|
|
|
16
16
|
/**
|
package/dist/language.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { C as CompletionItem } from './PackageRegistry-
|
|
2
|
-
export { L as LanguageService, p as LanguageServiceOptions, q as SemanticToken } from './PackageRegistry-
|
|
3
|
-
import { e as TokenCategory } from './Lexer-
|
|
4
|
-
import './Parselet-
|
|
5
|
-
import './BytecodeBuilder-
|
|
1
|
+
import { C as CompletionItem } from './PackageRegistry-DT-x32OM.js';
|
|
2
|
+
export { L as LanguageService, p as LanguageServiceOptions, q as SemanticToken } from './PackageRegistry-DT-x32OM.js';
|
|
3
|
+
import { e as TokenCategory } from './Lexer-Bmctxl0n.js';
|
|
4
|
+
import './Parselet-DqTbbtWA.js';
|
|
5
|
+
import './BytecodeBuilder-DSWKZi4f.js';
|
|
6
6
|
import './Token-CbP_OutD.js';
|
|
7
7
|
import './pipeline-DTqGLPsV.js';
|
|
8
8
|
import './Value-Ds3Gy07C.js';
|
|
9
9
|
import './resolvers.js';
|
|
10
10
|
import '@tanstack/query-core';
|
|
11
|
-
import './TokenNormalizer-
|
|
12
|
-
import './ScopeManager-
|
|
13
|
-
import './EngineError-
|
|
11
|
+
import './TokenNormalizer-CLBtiE8M.js';
|
|
12
|
+
import './ScopeManager-B636am7Y.js';
|
|
13
|
+
import './EngineError-fR1K1rvx.js';
|
|
14
14
|
import './Configuration-DnzYPmoK.js';
|
|
15
15
|
|
|
16
16
|
/**
|
package/dist/lexer.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunkBMXYR5LI_cjs=require('./chunk-BMXYR5LI.cjs');require('./chunk-Y7O4D3BJ.cjs');var chunk77KI7AKJ_cjs=require('./chunk-77KI7AKJ.cjs'),chunk5IJD5L3O_cjs=require('./chunk-5IJD5L3O.cjs'),chunkS3DFU33X_cjs=require('./chunk-S3DFU33X.cjs'),chunkJ4LSAHCY_cjs=require('./chunk-J4LSAHCY.cjs');require('./chunk-EZKR44MA.cjs'),require('./chunk-YBQPEWT7.cjs');var i=class{constructor(){this.classes=[];this.localeKeywordMap=null;this.localePhraseMap=null;this.unitNames=null;}register(e){this.classes.push(e);}unregister(e){this.classes=this.classes.filter(r=>r.tokenType!==e);}setLocale(e,r){this.localeKeywordMap=e,this.localePhraseMap=r??null;}setUnits(e){this.unitNames=e;}build(){let e=new Map;if(this.localeKeywordMap)for(let[s,t]of Object.entries(this.localeKeywordMap))e.set(s.toLowerCase(),t);let r=[...this.classes].sort((s,t)=>(s.priority??0)-(t.priority??0));for(let s of r)for(let t of Object.keys(s.keywords))e.set(t.toLowerCase(),s.tokenType);let o=this.buildPhraseTrie(),n=this.buildPhraseStartWords();return {keywordToType:e,phraseTrie:o,phraseStartWords:n,unitNames:this.unitNames??new Set}}buildPhraseTrie(){let e={children:new Map};if(this.localePhraseMap)for(let[r,o]of Object.entries(this.localePhraseMap))this.insertPhrase(e,r.toLowerCase(),o);for(let r of this.classes)if(r.phrases)for(let o of Object.keys(r.phrases))this.insertPhrase(e,o.toLowerCase(),r.tokenType);return e.children.size>0?e:null}insertPhrase(e,r,o){let n=r.split(" "),s=e;for(let t of n)s.children.has(t)||s.children.set(t,{children:new Map}),s=s.children.get(t);s.type||(s.type=o);}buildPhraseStartWords(){let e=new Set;if(this.localePhraseMap)for(let r of Object.keys(this.localePhraseMap)){let o=r.split(" ")[0].toLowerCase();e.add(o);}for(let r of this.classes)if(r.phrases)for(let o of Object.keys(r.phrases)){let n=o.split(" ")[0].toLowerCase();e.add(n);}return e}};function m(p="en"){let e=chunkS3DFU33X_cjs.a(p),r=new i;return r.setLocale(e.keywordMap,chunk77KI7AKJ_cjs.c),r.setUnits(chunkJ4LSAHCY_cjs.a),r.build()}Object.defineProperty(exports,"Lexer",{enumerable:true,get:function(){return chunkBMXYR5LI_cjs.b}});Object.defineProperty(exports,"LexerState",{enumerable:true,get:function(){return chunkBMXYR5LI_cjs.a}});Object.defineProperty(exports,"sharedLexer",{enumerable:true,get:function(){return chunkBMXYR5LI_cjs.c}});Object.defineProperty(exports,"ExpressionLexer",{enumerable:true,get:function(){return chunk77KI7AKJ_cjs.b}});Object.defineProperty(exports,"LexerToken",{enumerable:true,get:function(){return chunk77KI7AKJ_cjs.a}});Object.defineProperty(exports,"TokenTypes",{enumerable:true,get:function(){return chunk5IJD5L3O_cjs.a}});Object.defineProperty(exports,"registerAllTokenTypes",{enumerable:true,get:function(){return chunk5IJD5L3O_cjs.e}});Object.defineProperty(exports,"registerTokenType",{enumerable:true,get:function(){return chunk5IJD5L3O_cjs.b}});Object.defineProperty(exports,"tokenTypeId",{enumerable:true,get:function(){return chunk5IJD5L3O_cjs.c}});Object.defineProperty(exports,"tokenTypeName",{enumerable:true,get:function(){return chunk5IJD5L3O_cjs.d}});Object.defineProperty(exports,"knownUnits",{enumerable:true,get:function(){return chunkJ4LSAHCY_cjs.a}});exports.buildTokenLookup=m;//# sourceMappingURL=lexer.cjs.map
|
|
2
2
|
//# sourceMappingURL=lexer.cjs.map
|
package/dist/lexer.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"lexer.cjs"}
|
|
1
|
+
{"version":3,"sources":["../src/lexer/TokenClassRegistry.ts","../src/lexer/tokenRegistration.ts"],"names":["TokenClassRegistry","tokenClass","tokenType","c","keywordMap","phraseMap","unitNames","keywordToType","keyword","sorted","a","b","tc","phraseTrie","phraseStartWords","root","phrase","words","node","word","startWords","first","buildTokenLookup","localeCode","locale","getLocale","registry","BUILTIN_PHRASES","knownUnits"],"mappings":"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","file":"lexer.cjs","sourcesContent":["/**\n * TokenClass, Plugin-extensible keyword registration for the Lexer.\n *\n * Providers call `registry.register(tokenClass)` to teach the lexer about\n * their keywords. The registry merges locale keywords, provider keywords,\n * phrase mappings, and unit names into an optimized TokenLookup structure\n * consumed by the Lexer.\n *\n * @example\n * registry.register({\n * tokenType: 'CARET',\n * keywords: {},\n * phrases: { 'to the power of': true, 'power of': true },\n * priority: 10,\n * description: 'Exponentiation operators (x^y)',\n * });\n */\nexport interface TokenClass {\n /** The token type string produced by the lexer (e.g., \"FUNC\", \"PI\", \"CARET\").\n * Must match a token type that a ParseletRegistry has a parselet for. */\n tokenType: string;\n\n /** Single-word keywords (case-insensitive). The lexer lowercases input\n * before lookup, so these should be lowercase. Example:\n * { sqrt: true, abs: true, sin: true, cos: true } for tokenType \"FUNC\" */\n keywords: Record<string, boolean>;\n\n /** Multi-word phrases (case-insensitive). Matched by the built-in PhraseMatcher\n * via the phrase trie. Example:\n * { \"to the power of\": true, \"power of\": true } for tokenType \"CARET\" */\n phrases?: Record<string, boolean>;\n\n /** Priority for conflict resolution. When two TokenClasses register\n * the same keyword, the higher-priority class wins. Locale keywords\n * have priority 0 (set via setLocale). Providers should use\n * priority >= 10 to override locale defaults. Default: 0 */\n priority?: number;\n\n /** Human-readable description for debugging and introspection */\n description?: string;\n}\n\n// ── Phrase Trie ──────────────────────────────────────────────────────────────\n\n/** Trie node for multi-word phrase matching. */\nexport interface PhraseNode {\n /** Complete phrase token type (null = intermediate node) */\n type?: string;\n children: Map<string, PhraseNode>;\n}\n\n// ── TokenLookup, Optimized lookup structure for the Lexer ──────────────────\n\n/**\n * The optimized lookup structure built by TokenClassRegistry.build().\n * Consumed by the Lexer for O(1) keyword → token type lookups and\n * O(word-count) phrase matching.\n */\nexport interface TokenLookup {\n /** Lowercase keyword → token type. O(1) Map lookup. */\n keywordToType: Map<string, string>;\n\n /** Phrase trie for multi-word matching. Root node with children maps.\n * Null if no phrases registered. */\n phraseTrie: PhraseNode | null;\n\n /** Set of lowercase first-words of all registered phrases.\n * Used by the lexer to emit IDENT (not a phrase keyword) for words\n * that start multi-word phrases, deferring to the PhraseMatcher.\n *\n * Example: \"to\" is in phraseStartWords because \"to the power of\" is a phrase.\n * When the lexer sees \"to\", it emits IDENT and lets the phrase matcher\n * combine \"to the power of\" into a single CARET token.\n *\n * This prevents plugins from accidentally overriding phrase-start words.\n */\n phraseStartWords: Set<string>;\n\n /** Case-sensitive unit names for UNIT fallback after keyword lookup fails. */\n unitNames: ReadonlySet<string>;\n}\n\n// ── TokenClassRegistry ───────────────────────────────────────────────────────\n\n/**\n * Central registry for keyword→token-type mappings.\n *\n * Providers register TokenClasses; locales provide keyword maps;\n * units provide a name set. `build()` merges all sources into an\n * optimized TokenLookup consumed by the Lexer.\n *\n * Merge order (later overrides earlier):\n * 1. Locale keywords (priority 0)\n * 2. Provider keywords (sorted by priority ascending, higher priority wins)\n *\n * Unit names are stored separately (checked AFTER keyword lookup fails).\n * Phrases are stored in a trie for O(phrase-length) matching.\n */\nexport class TokenClassRegistry {\n private classes: TokenClass[] = [];\n private localeKeywordMap: Record<string, string> | null = null;\n private localePhraseMap: Record<string, string> | null = null;\n private unitNames: ReadonlySet<string> | null = null;\n\n /**\n * Register a provider's TokenClass. Must be called BEFORE build().\n * Can be called multiple times to add more entries.\n *\n * Built-in token types CANNOT be overridden, throws a EngineError\n * if the TokenClass attempts to register a keyword that conflicts\n * with an already-registered token type.\n */\n register(tokenClass: TokenClass): void {\n this.classes.push(tokenClass);\n }\n\n /**\n * Unregister all TokenClasses for a given token type.\n * Useful for plugin unload. Requires rebuild() to take effect.\n */\n unregister(tokenType: string): void {\n this.classes = this.classes.filter(c => c.tokenType !== tokenType);\n }\n\n /**\n * Set the locale's keyword→type map and optional phrase map.\n * Called on locale change. Priority 0 (cannot override providers with higher priority).\n */\n setLocale(keywordMap: Record<string, string>, phraseMap?: Record<string, string>): void {\n this.localeKeywordMap = keywordMap;\n this.localePhraseMap = phraseMap ?? null;\n }\n\n /**\n * Set the unit name set. Called when unit list changes.\n * Units are stored separately (checked AFTER keyword lookup fails).\n *\n * Takes a ReadonlySet because the caller's set is derived from the\n * conversion tables and must not be mutated; this class only ever reads it.\n */\n setUnits(unitNames: ReadonlySet<string>): void {\n this.unitNames = unitNames;\n }\n\n /**\n * Build the optimized TokenLookup from all registered sources.\n *\n * Merge order (later overrides earlier):\n * 1. Locale keywords (priority 0)\n * 2. Provider classes (sorted by priority ascending)\n *\n * Returns a frozen TokenLookup that the Lexer consumes.\n * Call build() again after register()/setLocale()/setUnits() changes.\n */\n build(): TokenLookup {\n const keywordToType = new Map<string, string>();\n\n // Layer 1: Locale keywords (priority 0, lowest)\n if (this.localeKeywordMap) {\n for (const [keyword, tokenType] of Object.entries(this.localeKeywordMap)) {\n keywordToType.set(keyword.toLowerCase(), tokenType);\n }\n }\n\n // Layer 2: Provider keywords (sorted by priority ascending, higher wins)\n const sorted = [...this.classes].sort((a, b) => (a.priority ?? 0) - (b.priority ?? 0));\n for (const tc of sorted) {\n for (const keyword of Object.keys(tc.keywords)) {\n keywordToType.set(keyword.toLowerCase(), tc.tokenType);\n }\n }\n\n // Build phrase trie from locale + provider phrases\n const phraseTrie = this.buildPhraseTrie();\n\n // Build phraseStartWords set (first word of every phrase)\n const phraseStartWords = this.buildPhraseStartWords();\n\n return {\n keywordToType,\n phraseTrie,\n phraseStartWords,\n unitNames: this.unitNames ?? new Set(),\n };\n }\n\n // ── Private helpers ─────────────────────────────────────────────────────\n\n private buildPhraseTrie(): PhraseNode | null {\n const root: PhraseNode = { children: new Map() };\n\n // Layer 1: Locale phrases\n if (this.localePhraseMap) {\n for (const [phrase, tokenType] of Object.entries(this.localePhraseMap)) {\n this.insertPhrase(root, phrase.toLowerCase(), tokenType);\n }\n }\n\n // Layer 2: Provider phrases\n for (const tc of this.classes) {\n if (!tc.phrases) continue;\n for (const phrase of Object.keys(tc.phrases)) {\n this.insertPhrase(root, phrase.toLowerCase(), tc.tokenType);\n }\n }\n\n return root.children.size > 0 ? root : null;\n }\n\n private insertPhrase(root: PhraseNode, phrase: string, tokenType: string): void {\n const words = phrase.split(' ');\n let node = root;\n for (const word of words) {\n if (!node.children.has(word)) {\n node.children.set(word, { children: new Map() });\n }\n node = node.children.get(word)!;\n }\n // Only set type if not already set, first-registered (locale) wins\n if (!node.type) {\n node.type = tokenType;\n }\n }\n\n private buildPhraseStartWords(): Set<string> {\n const startWords = new Set<string>();\n\n // Locale phrase first words\n if (this.localePhraseMap) {\n for (const phrase of Object.keys(this.localePhraseMap)) {\n const first = phrase.split(' ')[0].toLowerCase();\n startWords.add(first);\n }\n }\n\n // Provider phrase first words\n for (const tc of this.classes) {\n if (!tc.phrases) continue;\n for (const phrase of Object.keys(tc.phrases)) {\n const first = phrase.split(' ')[0].toLowerCase();\n startWords.add(first);\n }\n }\n\n return startWords;\n }\n}","/**\n * tokenRegistration.ts, Bootstrap for building TokenLookup from locale, units, and phrases.\n *\n * This module centralizes the assembly of the TokenLookup consumed by ExpressionLexer.\n * It merges:\n * 1. Locale keywords (from ILocale.keywordMap)\n * 2. Built-in phrase patterns (to the power of, increase by, etc.)\n * 3. Known unit names (from units.ts)\n *\n * The resulting TokenLookup is frozen. Nothing in the engine consumes it any\n * more (see the deprecation on {@link buildTokenLookup}).\n */\nimport { TokenClassRegistry } from '@solve-js/lexer/TokenClassRegistry';\nimport type { TokenLookup } from '@solve-js/lexer/TokenClassRegistry';\nimport { getLocale, type ILocale } from '@solve-js/constants/locales';\nimport { knownUnits } from '@solve-js/lexer/units';\n// The multi-word expressions handled as compound tokens, matched by the\n// PhraseMatcher (trie-based) in ExpressionLexer.tryMatchPhrase(). The same\n// table the normalizer's phrase trie reads, so the two cannot drift.\nimport { BUILTIN_PHRASES } from '@solve-js/lexer/BuiltinPhrases';\n\n/**\n * Build a TokenLookup from locale keywords, known units, and built-in phrases.\n *\n * Merge order (later overrides earlier):\n * 1. Locale keywords (priority 0, lowest, can be overridden by providers)\n * 2. Built-in phrases (via locale phraseMap)\n * 3. Known units (checked AFTER keyword lookup fails, via unitNames set)\n *\n * @param localeCode - The locale code (e.g., \"en\", \"de\"). Defaults to \"en\".\n * @returns A frozen TokenLookup.\n * @deprecated The lexer never read the lookup it was handed: its keyword, unit\n * and phrase tables are built from the locale and the packages registered\n * with it, and the engine no longer builds one at construction. Kept for\n * callers that build their own; removed in 3.0.\n */\nexport function buildTokenLookup(localeCode = 'en'): TokenLookup {\n const locale: ILocale = getLocale(localeCode);\n const registry = new TokenClassRegistry();\n\n // Layer 1: Locale keywords (priority 0, lowest)\n registry.setLocale(locale.keywordMap, BUILTIN_PHRASES);\n\n // Layer 2: Known units (checked after keyword lookup)\n registry.setUnits(knownUnits);\n\n // Build and return the lookup\n return registry.build();\n}\n"]}
|
package/dist/lexer.d.cts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { T as TokenLookup } from './Lexer-
|
|
2
|
-
export { E as ExpressionLexer, I as InlineSolveSpan, L as Lexer, a as LexerState, b as LexerToken, c as LexerVocabulary, d as LineClassification, M as MarkdownLineType, S as ScanLineResult, s as sharedLexer } from './Lexer-
|
|
1
|
+
import { T as TokenLookup } from './Lexer-aB95pjoX.cjs';
|
|
2
|
+
export { E as ExpressionLexer, I as InlineSolveSpan, L as Lexer, a as LexerState, b as LexerToken, c as LexerVocabulary, d as LineClassification, M as MarkdownLineType, S as ScanLineResult, s as sharedLexer } from './Lexer-aB95pjoX.cjs';
|
|
3
3
|
export { T as Token, a as TokenType, b as TokenTypes, r as registerAllTokenTypes, c as registerTokenType, t as tokenTypeId, d as tokenTypeName } from './Token-CbP_OutD.cjs';
|
|
4
|
+
import './EngineError-fR1K1rvx.cjs';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* The set of unit identifiers the lexer will turn into a UNIT token.
|
|
@@ -44,12 +45,12 @@ declare const knownUnits: ReadonlySet<string>;
|
|
|
44
45
|
* 2. Built-in phrases (via locale phraseMap)
|
|
45
46
|
* 3. Known units (checked AFTER keyword lookup fails, via unitNames set)
|
|
46
47
|
*
|
|
47
|
-
* The resulting TokenLookup replaces the internal keyword map, unit set,
|
|
48
|
-
* phrase trie, and phraseStartWords in ExpressionLexer when set via
|
|
49
|
-
* ExpressionLexer.configuredLookup.
|
|
50
|
-
*
|
|
51
48
|
* @param localeCode - The locale code (e.g., "en", "de"). Defaults to "en".
|
|
52
|
-
* @returns A frozen TokenLookup
|
|
49
|
+
* @returns A frozen TokenLookup.
|
|
50
|
+
* @deprecated The lexer never read the lookup it was handed: its keyword, unit
|
|
51
|
+
* and phrase tables are built from the locale and the packages registered
|
|
52
|
+
* with it, and the engine no longer builds one at construction. Kept for
|
|
53
|
+
* callers that build their own; removed in 3.0.
|
|
53
54
|
*/
|
|
54
55
|
declare function buildTokenLookup(localeCode?: string): TokenLookup;
|
|
55
56
|
|
package/dist/lexer.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { T as TokenLookup } from './Lexer-
|
|
2
|
-
export { E as ExpressionLexer, I as InlineSolveSpan, L as Lexer, a as LexerState, b as LexerToken, c as LexerVocabulary, d as LineClassification, M as MarkdownLineType, S as ScanLineResult, s as sharedLexer } from './Lexer-
|
|
1
|
+
import { T as TokenLookup } from './Lexer-Bmctxl0n.js';
|
|
2
|
+
export { E as ExpressionLexer, I as InlineSolveSpan, L as Lexer, a as LexerState, b as LexerToken, c as LexerVocabulary, d as LineClassification, M as MarkdownLineType, S as ScanLineResult, s as sharedLexer } from './Lexer-Bmctxl0n.js';
|
|
3
3
|
export { T as Token, a as TokenType, b as TokenTypes, r as registerAllTokenTypes, c as registerTokenType, t as tokenTypeId, d as tokenTypeName } from './Token-CbP_OutD.js';
|
|
4
|
+
import './EngineError-fR1K1rvx.js';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* The set of unit identifiers the lexer will turn into a UNIT token.
|
|
@@ -44,12 +45,12 @@ declare const knownUnits: ReadonlySet<string>;
|
|
|
44
45
|
* 2. Built-in phrases (via locale phraseMap)
|
|
45
46
|
* 3. Known units (checked AFTER keyword lookup fails, via unitNames set)
|
|
46
47
|
*
|
|
47
|
-
* The resulting TokenLookup replaces the internal keyword map, unit set,
|
|
48
|
-
* phrase trie, and phraseStartWords in ExpressionLexer when set via
|
|
49
|
-
* ExpressionLexer.configuredLookup.
|
|
50
|
-
*
|
|
51
48
|
* @param localeCode - The locale code (e.g., "en", "de"). Defaults to "en".
|
|
52
|
-
* @returns A frozen TokenLookup
|
|
49
|
+
* @returns A frozen TokenLookup.
|
|
50
|
+
* @deprecated The lexer never read the lookup it was handed: its keyword, unit
|
|
51
|
+
* and phrase tables are built from the locale and the packages registered
|
|
52
|
+
* with it, and the engine no longer builds one at construction. Kept for
|
|
53
|
+
* callers that build their own; removed in 3.0.
|
|
53
54
|
*/
|
|
54
55
|
declare function buildTokenLookup(localeCode?: string): TokenLookup;
|
|
55
56
|
|
package/dist/lexer.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{b as Lexer,a as LexerState,
|
|
1
|
+
export{b as Lexer,a as LexerState,c as sharedLexer}from'./chunk-7DP57BA7.js';import'./chunk-JPFCXLJV.js';import {c}from'./chunk-OB2VX4IL.js';export{b as ExpressionLexer,a as LexerToken}from'./chunk-OB2VX4IL.js';export{a as TokenTypes,e as registerAllTokenTypes,b as registerTokenType,c as tokenTypeId,d as tokenTypeName}from'./chunk-IJMNVBIS.js';import {a}from'./chunk-LHLW7JLS.js';import {a as a$1}from'./chunk-CHVGFTO3.js';export{a as knownUnits}from'./chunk-CHVGFTO3.js';import'./chunk-PRSXXDTA.js';import'./chunk-57PSJQQW.js';var i=class{constructor(){this.classes=[];this.localeKeywordMap=null;this.localePhraseMap=null;this.unitNames=null;}register(e){this.classes.push(e);}unregister(e){this.classes=this.classes.filter(r=>r.tokenType!==e);}setLocale(e,r){this.localeKeywordMap=e,this.localePhraseMap=r??null;}setUnits(e){this.unitNames=e;}build(){let e=new Map;if(this.localeKeywordMap)for(let[s,t]of Object.entries(this.localeKeywordMap))e.set(s.toLowerCase(),t);let r=[...this.classes].sort((s,t)=>(s.priority??0)-(t.priority??0));for(let s of r)for(let t of Object.keys(s.keywords))e.set(t.toLowerCase(),s.tokenType);let o=this.buildPhraseTrie(),n=this.buildPhraseStartWords();return {keywordToType:e,phraseTrie:o,phraseStartWords:n,unitNames:this.unitNames??new Set}}buildPhraseTrie(){let e={children:new Map};if(this.localePhraseMap)for(let[r,o]of Object.entries(this.localePhraseMap))this.insertPhrase(e,r.toLowerCase(),o);for(let r of this.classes)if(r.phrases)for(let o of Object.keys(r.phrases))this.insertPhrase(e,o.toLowerCase(),r.tokenType);return e.children.size>0?e:null}insertPhrase(e,r,o){let n=r.split(" "),s=e;for(let t of n)s.children.has(t)||s.children.set(t,{children:new Map}),s=s.children.get(t);s.type||(s.type=o);}buildPhraseStartWords(){let e=new Set;if(this.localePhraseMap)for(let r of Object.keys(this.localePhraseMap)){let o=r.split(" ")[0].toLowerCase();e.add(o);}for(let r of this.classes)if(r.phrases)for(let o of Object.keys(r.phrases)){let n=o.split(" ")[0].toLowerCase();e.add(n);}return e}};function m(p="en"){let e=a(p),r=new i;return r.setLocale(e.keywordMap,c),r.setUnits(a$1),r.build()}export{m as buildTokenLookup};//# sourceMappingURL=lexer.js.map
|
|
2
2
|
//# sourceMappingURL=lexer.js.map
|
package/dist/lexer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"lexer.js"}
|
|
1
|
+
{"version":3,"sources":["../src/lexer/TokenClassRegistry.ts","../src/lexer/tokenRegistration.ts"],"names":["TokenClassRegistry","tokenClass","tokenType","c","keywordMap","phraseMap","unitNames","keywordToType","keyword","sorted","a","b","tc","phraseTrie","phraseStartWords","root","phrase","words","node","word","startWords","first","buildTokenLookup","localeCode","locale","getLocale","registry","BUILTIN_PHRASES","knownUnits"],"mappings":"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","file":"lexer.js","sourcesContent":["/**\n * TokenClass, Plugin-extensible keyword registration for the Lexer.\n *\n * Providers call `registry.register(tokenClass)` to teach the lexer about\n * their keywords. The registry merges locale keywords, provider keywords,\n * phrase mappings, and unit names into an optimized TokenLookup structure\n * consumed by the Lexer.\n *\n * @example\n * registry.register({\n * tokenType: 'CARET',\n * keywords: {},\n * phrases: { 'to the power of': true, 'power of': true },\n * priority: 10,\n * description: 'Exponentiation operators (x^y)',\n * });\n */\nexport interface TokenClass {\n /** The token type string produced by the lexer (e.g., \"FUNC\", \"PI\", \"CARET\").\n * Must match a token type that a ParseletRegistry has a parselet for. */\n tokenType: string;\n\n /** Single-word keywords (case-insensitive). The lexer lowercases input\n * before lookup, so these should be lowercase. Example:\n * { sqrt: true, abs: true, sin: true, cos: true } for tokenType \"FUNC\" */\n keywords: Record<string, boolean>;\n\n /** Multi-word phrases (case-insensitive). Matched by the built-in PhraseMatcher\n * via the phrase trie. Example:\n * { \"to the power of\": true, \"power of\": true } for tokenType \"CARET\" */\n phrases?: Record<string, boolean>;\n\n /** Priority for conflict resolution. When two TokenClasses register\n * the same keyword, the higher-priority class wins. Locale keywords\n * have priority 0 (set via setLocale). Providers should use\n * priority >= 10 to override locale defaults. Default: 0 */\n priority?: number;\n\n /** Human-readable description for debugging and introspection */\n description?: string;\n}\n\n// ── Phrase Trie ──────────────────────────────────────────────────────────────\n\n/** Trie node for multi-word phrase matching. */\nexport interface PhraseNode {\n /** Complete phrase token type (null = intermediate node) */\n type?: string;\n children: Map<string, PhraseNode>;\n}\n\n// ── TokenLookup, Optimized lookup structure for the Lexer ──────────────────\n\n/**\n * The optimized lookup structure built by TokenClassRegistry.build().\n * Consumed by the Lexer for O(1) keyword → token type lookups and\n * O(word-count) phrase matching.\n */\nexport interface TokenLookup {\n /** Lowercase keyword → token type. O(1) Map lookup. */\n keywordToType: Map<string, string>;\n\n /** Phrase trie for multi-word matching. Root node with children maps.\n * Null if no phrases registered. */\n phraseTrie: PhraseNode | null;\n\n /** Set of lowercase first-words of all registered phrases.\n * Used by the lexer to emit IDENT (not a phrase keyword) for words\n * that start multi-word phrases, deferring to the PhraseMatcher.\n *\n * Example: \"to\" is in phraseStartWords because \"to the power of\" is a phrase.\n * When the lexer sees \"to\", it emits IDENT and lets the phrase matcher\n * combine \"to the power of\" into a single CARET token.\n *\n * This prevents plugins from accidentally overriding phrase-start words.\n */\n phraseStartWords: Set<string>;\n\n /** Case-sensitive unit names for UNIT fallback after keyword lookup fails. */\n unitNames: ReadonlySet<string>;\n}\n\n// ── TokenClassRegistry ───────────────────────────────────────────────────────\n\n/**\n * Central registry for keyword→token-type mappings.\n *\n * Providers register TokenClasses; locales provide keyword maps;\n * units provide a name set. `build()` merges all sources into an\n * optimized TokenLookup consumed by the Lexer.\n *\n * Merge order (later overrides earlier):\n * 1. Locale keywords (priority 0)\n * 2. Provider keywords (sorted by priority ascending, higher priority wins)\n *\n * Unit names are stored separately (checked AFTER keyword lookup fails).\n * Phrases are stored in a trie for O(phrase-length) matching.\n */\nexport class TokenClassRegistry {\n private classes: TokenClass[] = [];\n private localeKeywordMap: Record<string, string> | null = null;\n private localePhraseMap: Record<string, string> | null = null;\n private unitNames: ReadonlySet<string> | null = null;\n\n /**\n * Register a provider's TokenClass. Must be called BEFORE build().\n * Can be called multiple times to add more entries.\n *\n * Built-in token types CANNOT be overridden, throws a EngineError\n * if the TokenClass attempts to register a keyword that conflicts\n * with an already-registered token type.\n */\n register(tokenClass: TokenClass): void {\n this.classes.push(tokenClass);\n }\n\n /**\n * Unregister all TokenClasses for a given token type.\n * Useful for plugin unload. Requires rebuild() to take effect.\n */\n unregister(tokenType: string): void {\n this.classes = this.classes.filter(c => c.tokenType !== tokenType);\n }\n\n /**\n * Set the locale's keyword→type map and optional phrase map.\n * Called on locale change. Priority 0 (cannot override providers with higher priority).\n */\n setLocale(keywordMap: Record<string, string>, phraseMap?: Record<string, string>): void {\n this.localeKeywordMap = keywordMap;\n this.localePhraseMap = phraseMap ?? null;\n }\n\n /**\n * Set the unit name set. Called when unit list changes.\n * Units are stored separately (checked AFTER keyword lookup fails).\n *\n * Takes a ReadonlySet because the caller's set is derived from the\n * conversion tables and must not be mutated; this class only ever reads it.\n */\n setUnits(unitNames: ReadonlySet<string>): void {\n this.unitNames = unitNames;\n }\n\n /**\n * Build the optimized TokenLookup from all registered sources.\n *\n * Merge order (later overrides earlier):\n * 1. Locale keywords (priority 0)\n * 2. Provider classes (sorted by priority ascending)\n *\n * Returns a frozen TokenLookup that the Lexer consumes.\n * Call build() again after register()/setLocale()/setUnits() changes.\n */\n build(): TokenLookup {\n const keywordToType = new Map<string, string>();\n\n // Layer 1: Locale keywords (priority 0, lowest)\n if (this.localeKeywordMap) {\n for (const [keyword, tokenType] of Object.entries(this.localeKeywordMap)) {\n keywordToType.set(keyword.toLowerCase(), tokenType);\n }\n }\n\n // Layer 2: Provider keywords (sorted by priority ascending, higher wins)\n const sorted = [...this.classes].sort((a, b) => (a.priority ?? 0) - (b.priority ?? 0));\n for (const tc of sorted) {\n for (const keyword of Object.keys(tc.keywords)) {\n keywordToType.set(keyword.toLowerCase(), tc.tokenType);\n }\n }\n\n // Build phrase trie from locale + provider phrases\n const phraseTrie = this.buildPhraseTrie();\n\n // Build phraseStartWords set (first word of every phrase)\n const phraseStartWords = this.buildPhraseStartWords();\n\n return {\n keywordToType,\n phraseTrie,\n phraseStartWords,\n unitNames: this.unitNames ?? new Set(),\n };\n }\n\n // ── Private helpers ─────────────────────────────────────────────────────\n\n private buildPhraseTrie(): PhraseNode | null {\n const root: PhraseNode = { children: new Map() };\n\n // Layer 1: Locale phrases\n if (this.localePhraseMap) {\n for (const [phrase, tokenType] of Object.entries(this.localePhraseMap)) {\n this.insertPhrase(root, phrase.toLowerCase(), tokenType);\n }\n }\n\n // Layer 2: Provider phrases\n for (const tc of this.classes) {\n if (!tc.phrases) continue;\n for (const phrase of Object.keys(tc.phrases)) {\n this.insertPhrase(root, phrase.toLowerCase(), tc.tokenType);\n }\n }\n\n return root.children.size > 0 ? root : null;\n }\n\n private insertPhrase(root: PhraseNode, phrase: string, tokenType: string): void {\n const words = phrase.split(' ');\n let node = root;\n for (const word of words) {\n if (!node.children.has(word)) {\n node.children.set(word, { children: new Map() });\n }\n node = node.children.get(word)!;\n }\n // Only set type if not already set, first-registered (locale) wins\n if (!node.type) {\n node.type = tokenType;\n }\n }\n\n private buildPhraseStartWords(): Set<string> {\n const startWords = new Set<string>();\n\n // Locale phrase first words\n if (this.localePhraseMap) {\n for (const phrase of Object.keys(this.localePhraseMap)) {\n const first = phrase.split(' ')[0].toLowerCase();\n startWords.add(first);\n }\n }\n\n // Provider phrase first words\n for (const tc of this.classes) {\n if (!tc.phrases) continue;\n for (const phrase of Object.keys(tc.phrases)) {\n const first = phrase.split(' ')[0].toLowerCase();\n startWords.add(first);\n }\n }\n\n return startWords;\n }\n}","/**\n * tokenRegistration.ts, Bootstrap for building TokenLookup from locale, units, and phrases.\n *\n * This module centralizes the assembly of the TokenLookup consumed by ExpressionLexer.\n * It merges:\n * 1. Locale keywords (from ILocale.keywordMap)\n * 2. Built-in phrase patterns (to the power of, increase by, etc.)\n * 3. Known unit names (from units.ts)\n *\n * The resulting TokenLookup is frozen. Nothing in the engine consumes it any\n * more (see the deprecation on {@link buildTokenLookup}).\n */\nimport { TokenClassRegistry } from '@solve-js/lexer/TokenClassRegistry';\nimport type { TokenLookup } from '@solve-js/lexer/TokenClassRegistry';\nimport { getLocale, type ILocale } from '@solve-js/constants/locales';\nimport { knownUnits } from '@solve-js/lexer/units';\n// The multi-word expressions handled as compound tokens, matched by the\n// PhraseMatcher (trie-based) in ExpressionLexer.tryMatchPhrase(). The same\n// table the normalizer's phrase trie reads, so the two cannot drift.\nimport { BUILTIN_PHRASES } from '@solve-js/lexer/BuiltinPhrases';\n\n/**\n * Build a TokenLookup from locale keywords, known units, and built-in phrases.\n *\n * Merge order (later overrides earlier):\n * 1. Locale keywords (priority 0, lowest, can be overridden by providers)\n * 2. Built-in phrases (via locale phraseMap)\n * 3. Known units (checked AFTER keyword lookup fails, via unitNames set)\n *\n * @param localeCode - The locale code (e.g., \"en\", \"de\"). Defaults to \"en\".\n * @returns A frozen TokenLookup.\n * @deprecated The lexer never read the lookup it was handed: its keyword, unit\n * and phrase tables are built from the locale and the packages registered\n * with it, and the engine no longer builds one at construction. Kept for\n * callers that build their own; removed in 3.0.\n */\nexport function buildTokenLookup(localeCode = 'en'): TokenLookup {\n const locale: ILocale = getLocale(localeCode);\n const registry = new TokenClassRegistry();\n\n // Layer 1: Locale keywords (priority 0, lowest)\n registry.setLocale(locale.keywordMap, BUILTIN_PHRASES);\n\n // Layer 2: Known units (checked after keyword lookup)\n registry.setUnits(knownUnits);\n\n // Build and return the lookup\n return registry.build();\n}\n"]}
|
package/dist/normalizer.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';require('./chunk-NGBBNL4K.cjs');var
|
|
1
|
+
'use strict';require('./chunk-NGBBNL4K.cjs');var chunkGBCN7FNV_cjs=require('./chunk-GBCN7FNV.cjs'),chunk77KI7AKJ_cjs=require('./chunk-77KI7AKJ.cjs');require('./chunk-5IJD5L3O.cjs'),require('./chunk-S3DFU33X.cjs'),require('./chunk-J4LSAHCY.cjs'),require('./chunk-EZKR44MA.cjs'),require('./chunk-YBQPEWT7.cjs');Object.defineProperty(exports,"PhraseTrie",{enumerable:true,get:function(){return chunkGBCN7FNV_cjs.a}});Object.defineProperty(exports,"TokenNormalizer",{enumerable:true,get:function(){return chunkGBCN7FNV_cjs.c}});Object.defineProperty(exports,"createBuiltinNormalizerRules",{enumerable:true,get:function(){return chunkGBCN7FNV_cjs.f}});Object.defineProperty(exports,"createFusedToken",{enumerable:true,get:function(){return chunkGBCN7FNV_cjs.b}});Object.defineProperty(exports,"implicitMultiplyRule",{enumerable:true,get:function(){return chunkGBCN7FNV_cjs.d}});Object.defineProperty(exports,"BUILTIN_PHRASES",{enumerable:true,get:function(){return chunk77KI7AKJ_cjs.c}});//# sourceMappingURL=normalizer.cjs.map
|
|
2
2
|
//# sourceMappingURL=normalizer.cjs.map
|
package/dist/normalizer.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { N as NormalizerMatch, a as NormalizerRule } from './TokenNormalizer-
|
|
2
|
-
export { b as NormalizerOptions, T as TokenFusion, c as TokenNormalizer, d as createFusedToken } from './TokenNormalizer-
|
|
1
|
+
import { N as NormalizerMatch, a as NormalizerRule } from './TokenNormalizer-CjTDmHgB.cjs';
|
|
2
|
+
export { b as NormalizerOptions, T as TokenFusion, c as TokenNormalizer, d as createFusedToken } from './TokenNormalizer-CjTDmHgB.cjs';
|
|
3
3
|
import { T as Token } from './Token-CbP_OutD.cjs';
|
|
4
4
|
|
|
5
5
|
/**
|
package/dist/normalizer.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { N as NormalizerMatch, a as NormalizerRule } from './TokenNormalizer-
|
|
2
|
-
export { b as NormalizerOptions, T as TokenFusion, c as TokenNormalizer, d as createFusedToken } from './TokenNormalizer-
|
|
1
|
+
import { N as NormalizerMatch, a as NormalizerRule } from './TokenNormalizer-CLBtiE8M.js';
|
|
2
|
+
export { b as NormalizerOptions, T as TokenFusion, c as TokenNormalizer, d as createFusedToken } from './TokenNormalizer-CLBtiE8M.js';
|
|
3
3
|
import { T as Token } from './Token-CbP_OutD.js';
|
|
4
4
|
|
|
5
5
|
/**
|
package/dist/normalizer.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import'./chunk-2RWAXT6O.js';export{a as PhraseTrie,c as TokenNormalizer,f as createBuiltinNormalizerRules,b as createFusedToken,d as implicitMultiplyRule}from'./chunk-
|
|
1
|
+
import'./chunk-2RWAXT6O.js';export{a as PhraseTrie,c as TokenNormalizer,f as createBuiltinNormalizerRules,b as createFusedToken,d as implicitMultiplyRule}from'./chunk-72PYPENZ.js';export{c as BUILTIN_PHRASES}from'./chunk-OB2VX4IL.js';import'./chunk-IJMNVBIS.js';import'./chunk-LHLW7JLS.js';import'./chunk-CHVGFTO3.js';import'./chunk-PRSXXDTA.js';import'./chunk-57PSJQQW.js';//# sourceMappingURL=normalizer.js.map
|
|
2
2
|
//# sourceMappingURL=normalizer.js.map
|