solve-engine 1.0.1 → 1.1.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-B0xskcv5.d.cts → BytecodeBuilder-Bp9xeTmX.d.cts} +4 -0
- package/dist/{BytecodeBuilder-B0xskcv5.d.ts → BytecodeBuilder-Bp9xeTmX.d.ts} +4 -0
- package/dist/{Configuration-B-G5gTRn.d.cts → Configuration-C9W8tJv_.d.cts} +53 -1
- package/dist/{Configuration-B-G5gTRn.d.ts → Configuration-C9W8tJv_.d.ts} +53 -1
- package/dist/{EngineError-LU7W7AgI.d.cts → EngineError-B61GS1jp.d.cts} +14 -0
- package/dist/{EngineError-LU7W7AgI.d.ts → EngineError-B61GS1jp.d.ts} +14 -0
- package/dist/FormattingSettings-CJHyxcYu.d.cts +27 -0
- package/dist/FormattingSettings-CJHyxcYu.d.ts +27 -0
- package/dist/{Lexer-D78E2yDW.d.cts → Lexer-BOs7euZe.d.cts} +58 -1
- package/dist/{Lexer-BN5mt30n.d.ts → Lexer-CSI_lwbW.d.ts} +58 -1
- package/dist/PackageCompatibility-B-7rK1TD.d.cts +76 -0
- package/dist/PackageCompatibility-Dh59eF-X.d.ts +76 -0
- package/dist/{PackageRegistry-B37mRvvz.d.cts → PackageRegistry-BHWJP83F.d.cts} +449 -11
- package/dist/{PackageRegistry-DCUEzbQt.d.ts → PackageRegistry-_8rDlvxI.d.ts} +449 -11
- package/dist/{Parselet-BaySkMV3.d.ts → Parselet-BBT8riYh.d.ts} +12 -3
- package/dist/{Parselet-DuI1Pjiq.d.cts → Parselet-BHcgK9S7.d.cts} +12 -3
- package/dist/{ScopeManager-B6GzdhVG.d.cts → ScopeManager-8vf02dwj.d.cts} +56 -5
- package/dist/{ScopeManager-udv4Twwq.d.ts → ScopeManager-CxA24W5n.d.ts} +56 -5
- package/dist/{Token-BzG5G4ja.d.cts → Token-B1hdkedD.d.cts} +9 -0
- package/dist/{Token-BzG5G4ja.d.ts → Token-B1hdkedD.d.ts} +9 -0
- package/dist/{TokenNormalizer-t_GotBxr.d.ts → TokenNormalizer-C6VzZgHa.d.ts} +1 -1
- package/dist/{TokenNormalizer-DGVa24Q-.d.cts → TokenNormalizer-DRc1Js1V.d.cts} +1 -1
- package/dist/{VMCheckpoints-DwLjivM7.d.cts → VMCheckpoints-ELYqITdF.d.cts} +3 -3
- package/dist/{VMCheckpoints-BiaIlOOY.d.ts → VMCheckpoints-MK--EBH2.d.ts} +3 -3
- package/dist/{Value-CXJqDH9J.d.cts → Value-BUi1RA3S.d.cts} +124 -5
- package/dist/{Value-CXJqDH9J.d.ts → Value-BUi1RA3S.d.ts} +124 -5
- package/dist/WorkerError-_-RkoQ5P.d.ts +75 -0
- package/dist/WorkerError-gzmaopj2.d.cts +75 -0
- package/dist/{chunk-GQCOSXMG.js → chunk-267JPOTF.js} +43 -5
- package/dist/chunk-267JPOTF.js.map +1 -0
- package/dist/{chunk-JMXUNXQS.cjs → chunk-2TZKENDH.cjs} +51 -8
- package/dist/chunk-2TZKENDH.cjs.map +1 -0
- package/dist/chunk-3OWCDIPN.js +215 -0
- package/dist/chunk-3OWCDIPN.js.map +1 -0
- package/dist/{chunk-VB37OC6I.js → chunk-4D6NIHE2.js} +40 -3
- package/dist/chunk-4D6NIHE2.js.map +1 -0
- package/dist/{chunk-TY3TLZAW.cjs → chunk-536WPM2V.cjs} +18 -2
- package/dist/chunk-536WPM2V.cjs.map +1 -0
- package/dist/chunk-5HRB36DK.js +405 -0
- package/dist/chunk-5HRB36DK.js.map +1 -0
- package/dist/chunk-5ON7PUAZ.js +12 -0
- package/dist/chunk-5ON7PUAZ.js.map +1 -0
- package/dist/{chunk-KV7UW6T6.js → chunk-7KYSUDQO.js} +12 -5
- package/dist/chunk-7KYSUDQO.js.map +1 -0
- package/dist/{chunk-6WFMPTGB.cjs → chunk-7ZX6B7SY.cjs} +774 -528
- package/dist/chunk-7ZX6B7SY.cjs.map +1 -0
- package/dist/chunk-ALYRJ72W.cjs +434 -0
- package/dist/chunk-ALYRJ72W.cjs.map +1 -0
- package/dist/{chunk-5KMIY374.cjs → chunk-B4HBEFTB.cjs} +17 -2
- package/dist/chunk-B4HBEFTB.cjs.map +1 -0
- package/dist/chunk-B7NLZMQ3.cjs +74 -0
- package/dist/chunk-B7NLZMQ3.cjs.map +1 -0
- package/dist/{chunk-UQ3UIZJC.js → chunk-BLI4NIQY.js} +6 -2
- package/dist/chunk-BLI4NIQY.js.map +1 -0
- package/dist/{chunk-BHTNFEGZ.cjs → chunk-C75AFGVD.cjs} +11 -11
- package/dist/{chunk-BHTNFEGZ.cjs.map → chunk-C75AFGVD.cjs.map} +1 -1
- package/dist/{chunk-G535KJEG.js → chunk-CCBZZQAE.js} +2 -2
- package/dist/{chunk-G535KJEG.js.map → chunk-CCBZZQAE.js.map} +1 -1
- package/dist/chunk-CKQMXMHR.cjs +219 -0
- package/dist/chunk-CKQMXMHR.cjs.map +1 -0
- package/dist/{chunk-PFUESQTW.cjs → chunk-EJ3ILXX6.cjs} +48 -2
- package/dist/chunk-EJ3ILXX6.cjs.map +1 -0
- package/dist/{chunk-526PMQOA.js → chunk-ENKKJYD3.js} +10 -4
- package/dist/chunk-ENKKJYD3.js.map +1 -0
- package/dist/{chunk-5X2PTP6F.cjs → chunk-ENRIK36Q.cjs} +2 -12
- package/dist/chunk-ENRIK36Q.cjs.map +1 -0
- package/dist/{chunk-3D7V24DG.js → chunk-ERCOHGXD.js} +17 -2
- package/dist/chunk-ERCOHGXD.js.map +1 -0
- package/dist/{chunk-IF532O7C.js → chunk-FD5ZZHEU.js} +3 -12
- package/dist/chunk-FD5ZZHEU.js.map +1 -0
- package/dist/{chunk-TBN7DEHO.js → chunk-G7Z4HJQA.js} +11 -5
- package/dist/chunk-G7Z4HJQA.js.map +1 -0
- package/dist/{chunk-QY25VWBF.js → chunk-GQMUHVE3.js} +142 -6
- package/dist/chunk-GQMUHVE3.js.map +1 -0
- package/dist/chunk-GUG7SNSV.js +1764 -0
- package/dist/chunk-GUG7SNSV.js.map +1 -0
- package/dist/{chunk-UM6BVY2S.cjs → chunk-HIQ5HSZL.cjs} +175 -43
- package/dist/chunk-HIQ5HSZL.cjs.map +1 -0
- package/dist/{chunk-HVQFNJKE.cjs → chunk-HVRVSI2Z.cjs} +104 -86
- package/dist/chunk-HVRVSI2Z.cjs.map +1 -0
- package/dist/{chunk-3LAEG75D.js → chunk-I4GAWIPW.js} +24 -6
- package/dist/chunk-I4GAWIPW.js.map +1 -0
- package/dist/{chunk-PA4VC73I.cjs → chunk-J45BCEZ4.cjs} +33 -27
- package/dist/chunk-J45BCEZ4.cjs.map +1 -0
- package/dist/{chunk-V5PYO44Y.js → chunk-JIPATHVY.js} +1853 -2638
- package/dist/chunk-JIPATHVY.js.map +1 -0
- package/dist/{chunk-YPPPYLSR.js → chunk-JJIXHXFQ.js} +5 -5
- package/dist/{chunk-YPPPYLSR.js.map → chunk-JJIXHXFQ.js.map} +1 -1
- package/dist/chunk-L2TE7PMO.cjs +14 -0
- package/dist/chunk-L2TE7PMO.cjs.map +1 -0
- package/dist/{chunk-B7TLZABL.cjs → chunk-MG6Q3DUO.cjs} +1962 -2746
- package/dist/chunk-MG6Q3DUO.cjs.map +1 -0
- package/dist/{chunk-R3PY4G7J.js → chunk-MVTOCRV2.js} +48 -3
- package/dist/chunk-MVTOCRV2.js.map +1 -0
- package/dist/{chunk-Y7FT4IQT.js → chunk-NKW7LKYU.js} +266 -28
- package/dist/chunk-NKW7LKYU.js.map +1 -0
- package/dist/{chunk-O3ANBHSA.js → chunk-NNQ2TYDF.js} +123 -5
- package/dist/chunk-NNQ2TYDF.js.map +1 -0
- package/dist/{chunk-5F4C26RU.js → chunk-OADDUPT3.js} +4 -4
- package/dist/{chunk-5F4C26RU.js.map → chunk-OADDUPT3.js.map} +1 -1
- package/dist/{chunk-3AFRJYP4.cjs → chunk-OTN6SZOD.cjs} +1868 -393
- package/dist/chunk-OTN6SZOD.cjs.map +1 -0
- package/dist/{chunk-5LI5EPGJ.cjs → chunk-QFTDTX6K.cjs} +40 -3
- package/dist/chunk-QFTDTX6K.cjs.map +1 -0
- package/dist/{chunk-HMOISHXR.js → chunk-RRLHC37V.js} +1530 -57
- package/dist/chunk-RRLHC37V.js.map +1 -0
- package/dist/chunk-SNHVVOJK.cjs +1768 -0
- package/dist/chunk-SNHVVOJK.cjs.map +1 -0
- package/dist/{chunk-HDP7VK3C.cjs → chunk-SRGQ72IR.cjs} +649 -349
- package/dist/chunk-SRGQ72IR.cjs.map +1 -0
- package/dist/{chunk-4B2CNWQU.cjs → chunk-SSV46KFA.cjs} +14 -7
- package/dist/chunk-SSV46KFA.cjs.map +1 -0
- package/dist/{chunk-AJA6LUI7.js → chunk-UO6BUV6K.js} +18 -2
- package/dist/chunk-UO6BUV6K.js.map +1 -0
- package/dist/chunk-WWQEY7BV.js +67 -0
- package/dist/chunk-WWQEY7BV.js.map +1 -0
- package/dist/{chunk-5WVP4YHP.js → chunk-WXEHD6TT.js} +333 -33
- package/dist/chunk-WXEHD6TT.js.map +1 -0
- package/dist/{chunk-47LRVGOT.cjs → chunk-XA4CKRML.cjs} +2 -2
- package/dist/{chunk-47LRVGOT.cjs.map → chunk-XA4CKRML.cjs.map} +1 -1
- package/dist/{chunk-6KFYJ6TD.cjs → chunk-XIYYHA65.cjs} +6 -2
- package/dist/chunk-XIYYHA65.cjs.map +1 -0
- package/dist/{chunk-KBSXGXPM.cjs → chunk-XJGJCF2R.cjs} +6 -6
- package/dist/{chunk-KBSXGXPM.cjs.map → chunk-XJGJCF2R.cjs.map} +1 -1
- package/dist/{chunk-YWQ6V4ZN.cjs → chunk-YTIYVHL7.cjs} +211 -75
- package/dist/chunk-YTIYVHL7.cjs.map +1 -0
- package/dist/{chunk-TMA4RCEN.js → chunk-Z7XGGLI2.js} +3 -3
- package/dist/{chunk-TMA4RCEN.js.map → chunk-Z7XGGLI2.js.map} +1 -1
- package/dist/{chunk-A2N2GFCG.cjs → chunk-ZVTWQLK4.cjs} +10 -10
- package/dist/{chunk-A2N2GFCG.cjs.map → chunk-ZVTWQLK4.cjs.map} +1 -1
- package/dist/{chunk-2XLQPQKI.cjs → chunk-ZXCESUJS.cjs} +15 -9
- package/dist/chunk-ZXCESUJS.cjs.map +1 -0
- package/dist/constants.cjs +5 -5
- package/dist/constants.d.cts +1 -1
- package/dist/constants.d.ts +1 -1
- package/dist/constants.js +2 -2
- package/dist/engine.cjs +52 -35
- package/dist/engine.d.cts +13 -13
- package/dist/engine.d.ts +13 -13
- package/dist/engine.js +26 -21
- package/dist/errors.cjs +44 -19
- package/dist/errors.d.cts +3 -2
- package/dist/errors.d.ts +3 -2
- package/dist/errors.js +2 -1
- package/dist/format.cjs +19 -169
- package/dist/format.cjs.map +1 -1
- package/dist/format.d.cts +18 -26
- package/dist/format.d.ts +18 -26
- package/dist/format.js +7 -171
- package/dist/format.js.map +1 -1
- package/dist/index.cjs +250 -31
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +110 -74
- package/dist/index.d.ts +110 -74
- package/dist/index.js +228 -23
- package/dist/index.js.map +1 -1
- package/dist/language.cjs +9 -9
- package/dist/language.d.cts +12 -12
- package/dist/language.d.ts +12 -12
- package/dist/language.js +3 -3
- package/dist/lexer.cjs +16 -16
- package/dist/lexer.d.cts +3 -3
- package/dist/lexer.d.ts +3 -3
- package/dist/lexer.js +5 -5
- package/dist/normalizer.cjs +10 -10
- package/dist/normalizer.d.cts +3 -3
- package/dist/normalizer.d.ts +3 -3
- package/dist/normalizer.js +4 -4
- package/dist/packages.cjs +45 -36
- package/dist/packages.d.cts +135 -31
- package/dist/packages.d.ts +135 -31
- package/dist/packages.js +14 -13
- package/dist/parser.cjs +16 -16
- package/dist/parser.d.cts +6 -5
- package/dist/parser.d.ts +6 -5
- package/dist/parser.js +6 -6
- package/dist/{pipeline-BEb3hujr.d.cts → pipeline-CtfJtPQc.d.cts} +3 -3
- package/dist/{pipeline-B6k5lCB7.d.ts → pipeline-DCd5M6Gk.d.ts} +3 -3
- package/dist/resolvers.d.cts +3 -3
- package/dist/resolvers.d.ts +3 -3
- package/dist/testing.cjs +478 -0
- package/dist/testing.cjs.map +1 -0
- package/dist/testing.d.cts +271 -0
- package/dist/testing.d.ts +271 -0
- package/dist/testing.js +470 -0
- package/dist/testing.js.map +1 -0
- package/dist/uom.cjs +16 -16
- package/dist/uom.d.cts +3 -3
- package/dist/uom.d.ts +3 -3
- package/dist/uom.js +6 -6
- package/dist/utilities.cjs +6 -5
- package/dist/utilities.js +2 -1
- package/dist/vm.cjs +34 -34
- package/dist/vm.d.cts +8 -8
- package/dist/vm.d.ts +8 -8
- package/dist/vm.js +9 -9
- package/dist/worker.cjs +493 -0
- package/dist/worker.cjs.map +1 -0
- package/dist/worker.d.cts +509 -0
- package/dist/worker.d.ts +509 -0
- package/dist/worker.js +484 -0
- package/dist/worker.js.map +1 -0
- package/package.json +21 -1
- package/dist/chunk-2XLQPQKI.cjs.map +0 -1
- package/dist/chunk-3AFRJYP4.cjs.map +0 -1
- package/dist/chunk-3D7V24DG.js.map +0 -1
- package/dist/chunk-3LAEG75D.js.map +0 -1
- package/dist/chunk-4B2CNWQU.cjs.map +0 -1
- package/dist/chunk-526PMQOA.js.map +0 -1
- package/dist/chunk-5KMIY374.cjs.map +0 -1
- package/dist/chunk-5LI5EPGJ.cjs.map +0 -1
- package/dist/chunk-5WVP4YHP.js.map +0 -1
- package/dist/chunk-5X2PTP6F.cjs.map +0 -1
- package/dist/chunk-6KFYJ6TD.cjs.map +0 -1
- package/dist/chunk-6WFMPTGB.cjs.map +0 -1
- package/dist/chunk-AJA6LUI7.js.map +0 -1
- package/dist/chunk-B7TLZABL.cjs.map +0 -1
- package/dist/chunk-GQCOSXMG.js.map +0 -1
- package/dist/chunk-HDP7VK3C.cjs.map +0 -1
- package/dist/chunk-HMOISHXR.js.map +0 -1
- package/dist/chunk-HVQFNJKE.cjs.map +0 -1
- package/dist/chunk-IF532O7C.js.map +0 -1
- package/dist/chunk-JMXUNXQS.cjs.map +0 -1
- package/dist/chunk-KV7UW6T6.js.map +0 -1
- package/dist/chunk-O3ANBHSA.js.map +0 -1
- package/dist/chunk-PA4VC73I.cjs.map +0 -1
- package/dist/chunk-PFUESQTW.cjs.map +0 -1
- package/dist/chunk-QY25VWBF.js.map +0 -1
- package/dist/chunk-R3PY4G7J.js.map +0 -1
- package/dist/chunk-TBN7DEHO.js.map +0 -1
- package/dist/chunk-TY3TLZAW.cjs.map +0 -1
- package/dist/chunk-UM6BVY2S.cjs.map +0 -1
- package/dist/chunk-UQ3UIZJC.js.map +0 -1
- package/dist/chunk-V5PYO44Y.js.map +0 -1
- package/dist/chunk-VB37OC6I.js.map +0 -1
- package/dist/chunk-Y7FT4IQT.js.map +0 -1
- package/dist/chunk-YWQ6V4ZN.cjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/errors/EngineError.ts","../src/errors/Result.ts","../src/errors/ErrorCode.ts"],"names":["ErrorCategory"],"mappings":";;;AA6BO,IAAK,aAAA,qBAAAA,cAAAA,KAAL;AAEL,EAAAA,eAAA,SAAA,CAAA,GAAU,SAAA;AAEV,EAAAA,eAAA,WAAA,CAAA,GAAY,WAAA;AAEZ,EAAAA,eAAA,YAAA,CAAA,GAAa,YAAA;AAEb,EAAAA,eAAA,UAAA,CAAA,GAAW,UAAA;AAEX,EAAAA,eAAA,UAAA,CAAA,GAAW,UAAA;AAEX,EAAAA,eAAA,QAAA,CAAA,GAAS,QAAA;AAZC,EAAA,OAAAA,cAAAA;AAAA,CAAA,EAAA,aAAA,IAAA,EAAA;AAmEL,IAAM,WAAA,GAAN,MAAM,YAAA,SAAoB,KAAA,CAAM;AAAA,EAsBrC,WAAA,CAAY,UAAyB,IAAA,EAAuB;AAC1D,IAAA,KAAA,CAAM,KAAK,OAAO,CAAA;AAClB,IAAA,IAAA,CAAK,IAAA,GAAO,aAAA;AACZ,IAAA,IAAA,CAAK,QAAA,GAAW,QAAA;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ent":["/**\n * The engine's structured error type, the \"Rust/Go-style, verbose, easy to\n * tell the issue\" half of the error-handling redesign (the other half is\n * `Result.ts`).\n *\n * Historical note: an earlier version of this class (`UnifiedErrorFramework.ts`,\n * still the import path most of the codebase uses. See that file, now a\n * pure re-export barrel) had a much larger field set (`severity`,\n * `recovery`, a 5-value enum, `ErrorRecoveryManager`) that was almost\n * entirely dead: nothing downstream ever read `.severity`/`.recovery`,\n * only `.message` reliably survived to a caller. This version is smaller\n * and deliberately keeps only fields something actually consumes.\n */\n\nimport type { ErrorCode } from \"@solve-js/errors/ErrorCode\";\n\n/** A character-offset (and optional line/col) span into the original expression text, for a future \"underline the offending token\" UI, not yet wired to one. */\nexport interface SourceSpan {\n start: number;\n end: number;\n line?: number;\n col?: number;\n}\n\n/**\n * Error classification, kept from the original framework, now actually\n * consulted: it's the `format()` header and lets host code group errors\n * by pipeline stage without string-matching `.code`.\n */\nexport enum ErrorCategory {\n /** Errors during expression parsing. */\n PARSING = \"PARSING\",\n /** Errors during bytecode execution. */\n EXECUTION = \"EXECUTION\",\n /** Errors from input validation (safety limits, config). */\n VALIDATION = \"VALIDATION\",\n /** Errors from external services/APIs (currency rates, weather, stocks). */\n EXTERNAL = \"EXTERNAL\",\n /** Internal engine invariant violations. See `recoverable`'s doc comment. */\n INTERNAL = \"INTERNAL\",\n /** Configuration errors. */\n CONFIG = \"CONFIG\",\n}\n\n/** Fields accepted when constructing an {@link EngineError}. */\nexport interface EngineErrorInit {\n /** Catalog code. See `errors/ErrorCode.ts`. Not a free string: every code used by a BUILT-IN package should be registered there so `ErrorCodeCatalog.spec.ts` can catch collisions/typos. Third-party packages may still use any string here, `EngineError.code`'s runtime type is `string`. */\n code: ErrorCode | (string & {});\n /** Short, single-line, `Error.message`-compatible. Existing `.toThrow(/pattern/)`/`.message` assertions keep working against this field, richer detail goes in `expected`/`found`/`suggestion`, not crammed into this string. */\n message: string;\n /** What the parser/validator/VM expected to see, in plain words, e.g. \"a city name\", \"a 4-digit year\", \"end of expression\". */\n expected?: string;\n /** What was actually found instead, e.g. \"end of expression\", `NUMBER \"5\"`, the offending token's literal text. */\n found?: string;\n /** An actionable, worked-example fix, e.g. `e.g. \"weather in London\"`. Mirrors this codebase's best existing messages (`WEATHER_EXPECTED_CITY`, `AS_CONVERTER_EXPECTED_NAME`). */\n suggestion?: string;\n /**\n * Whether this engine instance is still usable. `true` for everything that\n * went wrong on ONE line, whether the line's fault (bad syntax, an unknown\n * variable, a safety limit exceeded), the environment's (an external API\n * down), or the engine's own (corrupted bytecode, a stack underflow from a\n * buggy plugin). `false` is for the far rarer case where there is no working\n * engine to go on with: a configuration or package-registration failure,\n * which is what `ErrorFactory.config()` is for and the only factory method\n * that still defaults to it.\n *\n * The category answers a different question, and the two used to be answered\n * as one. Category INTERNAL says whose fault this is, the engine's, worth\n * reporting as a bug. `recoverable` says whether the host may carry on, and\n * after an internal slip on one line it may:\n * `__tests__/hardening/RobustnessEngineLifecycle.spec.ts` alternates a\n * throwing line with a good one five hundred times and every answer stays\n * correct. Reporting that as `isFatal()` told a host the opposite, and a host\n * that honours the name would tear a document down over one bad line.\n *\n * This has never gated \"does evaluation of the rest of the document\n * continue\"; with this engine's per-line containment it always does, even for\n * a `recoverable: false` error (see `ARCHITECTURE.md`'s async-batcher/Tier-2\n * hardening notes). It gates what a host is TOLD. See\n * {@link EngineError.isFatal}.\n */\n recoverable?: boolean;\n /** Character-offset span into the source expression, when available. Not yet threaded through every call site, populate opportunistically, don't block on retrofitting every existing throw site. */\n span?: SourceSpan;\n /** Free-form structured context. The one field the pre-existing framework's real consumer (`ThreeTierEvaluator.ts`'s DAG-preservation-on-compile-error path) actually reads, kept name- and shape-compatible on purpose. */\n context?: Record<string, unknown>;\n /** The underlying error this one wraps, if any, passed straight through to native `Error.cause` (ES2022), so Node's default printer, most loggers, and `instanceof Error` tooling understand the chain for free. */\n cause?: unknown;\n}\n\n/**\n * The engine's structured error type. Still a real `Error` subclass (so\n * `throw`/`catch`/`instanceof Error` all keep working exactly as before),\n * but now every field except the removed `severity`/`recovery` pair is\n * something real code reads.\n */\nexport class EngineError extends Error {\n readonly category: ErrorCategory;\n readonly code: string;\n readonly expected?: string;\n readonly found?: string;\n readonly suggestion?: string;\n readonly recoverable: boolean;\n readonly span?: SourceSpan;\n readonly context?: Record<string, unknown>;\n readonly timestamp: Date;\n /**\n * Set explicitly (not via `super(message, {cause})`). This repo's\n * `tsconfig.json` targets ES6/ES5-ES7 lib, which predates TypeScript's\n * ES2022 `Error` constructor `cause`-option overload. `Error.prototype.cause`\n * is still a real runtime feature in every target this engine actually\n * runs in (Node 16.9+, all evergreen browsers, Electron/Obsidian's\n * bundled Chromium) regardless of the TS lib target used to type-check\n * against it, assigning it directly gets the same Node-printer/logger\n * interop with no build-config change needed.\n */\n readonly cause?: unknown;\n\n constructor(category: ErrorCategory, init: EngineErrorInit) {\n super(init.message);\n this.name = \"EngineError\";\n this.category = category;\n this.code = init.code;\n this.expected = init.expected;\n this.found = init.found;\n this.suggestion = init.suggestion;\n this.recoverable = init.recoverable ?? true;\n this.span = init.span;\n this.context = init.context;\n this.cause = init.cause;\n this.timestamp = new Date();\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, EngineError);\n }\n }\n\n /** `!recoverable`. See `EngineErrorInit.recoverable`'s doc comment for what this actually gates (message framing/telemetry, not whether evaluation continues). */\n isFatal(): boolean {\n return !this.recoverable;\n }\n\n /** Walk `.cause` repeatedly, collecting the full chain (this error first). */\n causeChain(): unknown[] {\n const chain: unknown[] = [this];\n let current: unknown = this.cause;\n while (current !== undefined && current !== null) {\n chain.push(current);\n current = current instanceof Error ? (current as Error & { cause?: unknown }).cause : undefined;\n }\n return chain;\n }\n\n /**\n * Rust/Go-style multi-line renderer, the NEW thing a host/CLI/test\n * reaches for when it wants the full, verbose picture, as distinct from\n * `.message` (kept short and stable for existing assertions). Example:\n *\n * ```\n * error[WEATHER_EXPECTED_CITY]: Expected a city name after \"weather in\"\n * expected: a city name\n * found: end of expression\n * suggestion: e.g. \"weather in London\"\n * ```\n */\n format(): string {\n const lines = [`error[${this.code}]: ${this.message}`];\n if (this.expected) lines.push(` expected: ${this.expected}`);\n if (this.found) lines.push(` found: ${this.found}`);\n if (this.suggestion) lines.push(` suggestion: ${this.suggestion}`);\n return lines.join(\"\\n\");\n }\n\n toJSON(): Record<string, unknown> {\n return {\n name: this.name,\n category: this.category,\n code: this.code,\n message: this.message,\n expected: this.expected,\n found: this.found,\n suggestion: this.suggestion,\n recoverable: this.recoverable,\n span: this.span,\n context: this.context,\n timestamp: this.timestamp.toISOString(),\n };\n }\n}\n\n/**\n * Factory for creating classified `EngineError`s. Every method accepts\n * EITHER the original, minimal 3-arg shape (`code, message, context?`\n * every existing call site across the codebase keeps compiling unchanged)\n * OR the richer `EngineErrorInit` object (for `expected`/`found`/\n * `suggestion`/`recoverable`/`span`/`cause`), upgrade a call site to the\n * richer form only when you're already touching it, no separate churn\n * pass required.\n */\nexport class ErrorFactory {\n private static build(\n category: ErrorCategory,\n defaultRecoverable: boolean,\n codeOrInit: string | EngineErrorInit,\n message?: string,\n context?: Record<string, unknown>,\n ): EngineError {\n const init: EngineErrorInit =\n typeof codeOrInit === \"string\"\n ? { code: codeOrInit, message: message!, context }\n : codeOrInit;\n return new EngineError(category, { recoverable: defaultRecoverable, ...init });\n }\n\n static validation(code: string, message: string, context?: Record<string, unknown>): EngineError;\n static validation(init: EngineErrorInit): EngineError;\n static validation(codeOrInit: string | EngineErrorInit, message?: string, context?: Record<string, unknown>): EngineError {\n return ErrorFactory.build(ErrorCategory.VALIDATION, true, codeOrInit, message, context);\n }\n\n static parsing(code: string, message: string, context?: Record<string, unknown>): EngineError;\n static parsing(init: EngineErrorInit): EngineError;\n static parsing(codeOrInit: string | EngineErrorInit, message?: string, context?: Record<string, unknown>): EngineError {\n return ErrorFactory.build(ErrorCategory.PARSING, true, codeOrInit, message, context);\n }\n\n static execution(code: string, message: string, context?: Record<string, unknown>): EngineError;\n static execution(init: EngineErrorInit): EngineError;\n static execution(codeOrInit: string | EngineErrorInit, message?: string, context?: Record<string, unknown>): EngineError {\n return ErrorFactory.build(ErrorCategory.EXECUTION, true, codeOrInit, message, context);\n }\n\n static external(code: string, message: string, context?: Record<string, unknown>): EngineError;\n static external(init: EngineErrorInit): EngineError;\n static external(codeOrInit: string | EngineErrorInit, message?: string, context?: Record<string, unknown>): EngineError {\n return ErrorFactory.build(ErrorCategory.EXTERNAL, true, codeOrInit, message, context);\n }\n\n /**\n * Reserve for genuine engine-internal invariant violations (corrupted\n * bytecode, a stack underflow from a buggy plugin, an \"impossible\" state),\n * not for user-input errors: the category is a bug report.\n *\n * Defaults `recoverable: true` all the same, because every one of these sites\n * is an invariant that failed on ONE line and none of them leaves the engine\n * unusable. This used to default to `false`, which conflated \"the engine's\n * fault\" with \"the engine is finished\" and told a host to tear a document\n * down over a line it could simply have shown an error against. A site that\n * has looked at its own case and concluded the instance really is gone can\n * still pass `recoverable: false` explicitly. See {@link\n * EngineErrorInit.recoverable}.\n */\n static internal(code: string, message: string, context?: Record<string, unknown>): EngineError;\n static internal(init: EngineErrorInit): EngineError;\n static internal(codeOrInit: string | EngineErrorInit, message?: string, context?: Record<string, unknown>): EngineError {\n return ErrorFactory.build(ErrorCategory.INTERNAL, true, codeOrInit, message, context);\n }\n\n /** Defaults `recoverable: false`, and is now the only method that does: a configuration or package-registration failure is the one class that leaves no working engine to carry on with, rather than one bad line in a document. */\n static config(code: string, message: string, context?: Record<string, unknown>): EngineError;\n static config(init: EngineErrorInit): EngineError;\n static config(codeOrInit: string | EngineErrorInit, message?: string, context?: Record<string, unknown>): EngineError {\n return ErrorFactory.build(ErrorCategory.CONFIG, false, codeOrInit, message, context);\n }\n}\n\n/**\n * Normalize any thrown value into an `EngineError`, an `EngineError`\n * passes through as-is; a plain `Error` gets wrapped (message preserved,\n * original attached via `cause`); anything else becomes a generic\n * \"unknown error\" wrapping the stringified value. Used at every\n * throw-space/Result-space boundary (`Result.tryCatch`'s default\n * `normalize`, the VM's outer execution try/catch, `AsyncResolutionBatcher`'s\n * per-line containment) so a raw `TypeError` from a genuine engine bug\n * still surfaces as a structured, catalogued error instead of an opaque\n * uncaught exception.\n *\n * Both branches state RECOVERABLE explicitly, while keeping the INTERNAL\n * category. The two fields answer different questions and were previously\n * answering the same one:\n *\n * category INTERNAL whose fault is this? The engine's. Worth reporting.\n * recoverable is this engine instance still usable? Yes.\n *\n * Everything reaching here is by definition something the engine did not\n * anticipate on ONE line, and per-line containment means the next line\n * evaluates normally, which `__tests__/hardening/RobustnessEngineLifecycle`\n * demonstrates over hundreds of alternating failure/success pairs. Reporting\n * that as `isFatal()` told a host the opposite, and a host that honours the\n * name would tear a document down over a single bad line. The \"this is an\n * engine bug rather than your syntax\" signal a caller wants for telemetry is\n * the CATEGORY, which is unchanged.\n *\n * The flag is written out here rather than inherited from\n * `ErrorFactory.internal()`, which now defaults the same way, so that this\n * function's contract survives a future change to that default.\n */\nexport function normalizeUnknownError(error: unknown): EngineError {\n if (error instanceof EngineError) return error;\n if (error instanceof Error) {\n return ErrorFactory.internal({\n code: \"UNEXPECTED_ERROR\",\n message: error.message,\n context: { originalErrorName: error.name },\n cause: error,\n recoverable: true,\n });\n }\n return ErrorFactory.internal({\n code: \"UNKNOWN_ERROR\",\n message: \"An unknown error occurred\",\n context: { error: String(error) },\n recoverable: true,\n });\n}\n","import { type EngineError, normalizeUnknownError } from \"@solve-js/errors/EngineError\";\n\n/**\n * A Rust-style `Result<T, E>`, the value half of this engine's error-handling\n * redesign. `E` defaults to `EngineError` (this engine's structured error\n * type) but every combinator here is generic over `E`, so `Result` works\n * equally well for a domain that isn't `EngineError`-shaped.\n *\n * This exact shape used to live in `errors/UnifiedErrorFramework.ts` (kept\n * there as a barrel re-export for backward compatibility), moved here as\n * its own module because it's genuinely generic (no dependency on\n * `EngineError` beyond the default type parameter) and because the engine\n * is migrating callers to it incrementally: parsing/VM/package code that\n * expects \"a failure is a possibility, not an exception\" returns\n * `Result<T, EngineError>` instead of throwing; two explicit adapters\n * {@link throwIfErr} and {@link tryCatch}, are the sanctioned way to cross\n * the boundary between Result-based code and still-throw-based code during\n * the migration (and permanently, at the public API boundary. See\n * `ExpressionEngine.evaluateExpression()`'s documented throw contract).\n */\nexport type Result<T, E = EngineError> =\n | { ok: true; value: T }\n | { ok: false; error: E };\n\n/** Wrap a successful value. */\nexport function ok<T>(value: T): Result<T, never> {\n return { ok: true, value };\n}\n\n/** Wrap a failure. */\nexport function err<E>(error: E): Result<never, E> {\n return { ok: false, error };\n}\n\n/**\n * Narrow a {@link Result} to its success arm.\n *\n * @param r - The result to test.\n * @returns True when it succeeded, narrowing `r` so `r.value` is reachable.\n */\nexport function isOk<T, E>(r: Result<T, E>): r is { ok: true; value: T } {\n return r.ok;\n}\n\n/**\n * Narrow a {@link Result} to its failure arm.\n *\n * @param r - The result to test.\n * @returns True when it failed, narrowing `r` so `r.error` is reachable.\n */\nexport function isErr<T, E>(r: Result<T, E>): r is { ok: false; error: E } {\n return !r.ok;\n}\n\n/** Transform the success value; a failure passes through untouched. */\nexport function map<T, U, E>(r: Result<T, E>, fn: (value: T) => U): Result<U, E> {\n return r.ok ? ok(fn(r.value)) : r;\n}\n\n/** Transform the error; a success passes through untouched. */\nexport function mapErr<T, E, F>(r: Result<T, E>, fn: (error: E) => F): Result<T, F> {\n return r.ok ? r : err(fn(r.error));\n}\n\n/** Chain a Result-returning operation onto a success (a.k.a. flatMap/bind). */\nexport function andThen<T, U, E>(r: Result<T, E>, fn: (value: T) => Result<U, E>): Result<U, E> {\n return r.ok ? fn(r.value) : r;\n}\n\n/** Unwrap a success, or return `fallback` for a failure. Never throws. */\nexport function unwrapOr<T, E>(r: Result<T, E>, fallback: T): T {\n return r.ok ? r.value : fallback;\n}\n\n/** Exhaustive pattern-match, the `match`/`switch` a Rust enum gets for free. */\nexport function match<T, E, R>(r: Result<T, E>, arms: { ok: (value: T) => R; err: (error: E) => R }): R {\n return r.ok ? arms.ok(r.value) : arms.err(r.error);\n}\n\n/**\n * Combine several Results into one, succeeds with a tuple of all values\n * iff every input succeeded; otherwise fails with the FIRST error\n * encountered (left-to-right), matching this codebase's existing\n * fail-fast convention elsewhere (e.g. `BytecodeBuilder`'s constant-pool\n * limit checks).\n */\nexport function combine<T extends readonly unknown[], E>(\n results: { [K in keyof T]: Result<T[K], E> },\n): Result<T, E> {\n const values: unknown[] = [];\n for (const r of results as readonly Result<unknown, E>[]) {\n if (!r.ok) return r;\n values.push(r.value);\n }\n return ok(values as unknown as T);\n}\n\n/**\n * Cross from Result-space back to throw-space, the sanctioned boundary\n * adapter for callers (public API surface, older not-yet-migrated code,\n * tests) that still want exception-based control flow. Throws `r.error`\n * as-is (an `EngineError` is already a real `Error` subclass, so this\n * needs no wrapping).\n */\nexport function throwIfErr<T, E>(r: Result<T, E>): T {\n if (r.ok) return r.value;\n throw r.error;\n}\n\n/**\n * Cross from throw-space into Result-space, runs `fn`, converting any\n * thrown value into a Result via `normalize` (defaults to\n * {@link normalizeUnknownError}). The inverse of {@link throwIfErr}; the\n * pairing that lets Result-based and throw-based code interoperate during\n * an incremental migration instead of requiring a single flag-day rewrite.\n */\nexport function tryCatch<T>(\n fn: () => T,\n normalize: (e: unknown) => EngineError = normalizeUnknownError,\n): Result<T, EngineError> {\n try {\n return ok(fn());\n } catch (e) {\n return err(normalize(e));\n }\n}\n\n/** Async sibling of {@link tryCatch}. */\nexport async function tryCatchAsync<T>(\n fn: () => Promise<T>,\n normalize: (e: unknown) => EngineError = normalizeUnknownError,\n): Promise<Result<T, EngineError>> {\n try {\n return ok(await fn());\n } catch (e) {\n return err(normalize(e));\n }\n}\n","/**\n * The built-in error-code catalog, one typed const object per domain\n * unioned together here for autocomplete/exhaustiveness in core engine\n * code. Deliberately NOT one central enum: `IEnginePackage` is documented\n * public SDK surface for third-party packages (see `api/PackageRegistry.ts`),\n * and a closed enum would block an external package author from defining\n * their own codes without editing this file. `EngineError.code`'s runtime\n * type stays `string` for exactly that reason. This catalog is for the\n * codes THIS repo owns and wants collision/typo checking on (see\n * `__tests__/errors/ErrorCodeCatalog.spec.ts`), not a hard runtime\n * whitelist.\n *\n * As each package migrates to `Result<void, EngineError>` (see this\n * session's error-handling-refactor plan, Phase 5), it should export its\n * own small `XxxErrorCodes` const object co-located with its parselets\n * exactly like `CoreErrorCodes` below, just scoped to one domain, and get\n * unioned into `ErrorCode` here. Until a package migrates, its existing\n * free-string codes keep working (ErrorFactory accepts any string); they\n * just aren't caught by the catalog's uniqueness/orphan checks yet.\n */\n\n/**\n * Codes used directly by the parser/VM/engine/errors layers themselves\n * confirmed against the current source, not aspirational. Grouped by\n * pipeline stage via the comments, not a naming prefix (these predate any\n * naming convention and renaming them is out of scope for introducing the\n * catalog, only NEW codes need to follow a scoped/prefixed style, see\n * `STACK_UNDERFLOW` etc. below).\n */\nexport const CoreErrorCodes = {\n // ── Parser (parser/PrecedenceParser.ts, parser/BytecodeBuilder.ts, parser/PhrasePattern.ts) ──\n INVALID_NUMBER_LITERAL: \"INVALID_NUMBER_LITERAL\",\n /** A `\"` that never meets its closing partner (`lexer/ExpressionLexer.ts`'s `tokenizeString()`). Previously the tokenizer ran off the end of the input and returned what it had, so `\"abc` lexed to an ordinary String and an unterminated literal was indistinguishable from a terminated one. */\n UNTERMINATED_STRING: \"UNTERMINATED_STRING\",\n NO_PREFIX_PARSELET: \"NO_PREFIX_PARSELET\",\n UNEXPECTED_END_OF_INPUT: \"UNEXPECTED_END_OF_INPUT\",\n UNEXPECTED_TOKEN_TYPE: \"UNEXPECTED_TOKEN_TYPE\",\n NESTING_DEPTH_EXCEEDED: \"NESTING_DEPTH_EXCEEDED\",\n UNEXPECTED_END: \"UNEXPECTED_END\",\n UNEXPECTED_TRAILING_TOKEN: \"UNEXPECTED_TRAILING_TOKEN\",\n PARSE_ERROR: \"PARSE_ERROR\",\n TOO_MANY_NUMERIC_CONSTANTS: \"TOO_MANY_NUMERIC_CONSTANTS\",\n TOO_MANY_STRING_CONSTANTS: \"TOO_MANY_STRING_CONSTANTS\",\n NO_MATCHING_PHRASE_ALTERNATIVE: \"NO_MATCHING_PHRASE_ALTERNATIVE\",\n INVALID_PHRASE_PATTERN: \"INVALID_PHRASE_PATTERN\",\n PHRASE_KEYWORD_MISMATCH: \"PHRASE_KEYWORD_MISMATCH\",\n /** User-defined-function definition parsing (`f(x, y) = ...`), an invalid token where a parameter name was expected. */\n USER_FUNCTION_INVALID_PARAM_NAME: \"USER_FUNCTION_INVALID_PARAM_NAME\",\n /** `f() = ...` with zero parameters, indistinguishable from a plain no-arg function call, so rejected at definition time. */\n USER_FUNCTION_NO_PARAMS: \"USER_FUNCTION_NO_PARAMS\",\n /** A user-defined function body calling an async plugin (weather/stocks/currency/...), rejected at definition time; v1 scope excludes async function bodies. */\n FUNCTION_BODY_MUST_BE_SYNCHRONOUS: \"FUNCTION_BODY_MUST_BE_SYNCHRONOUS\",\n /** `BytecodeBuilder`'s `userFunctionBodies` side-table exceeding its capacity. Same class as `TOO_MANY_NUMERIC_CONSTANTS`/`TOO_MANY_STRING_CONSTANTS` below. */\n TOO_MANY_FUNCTION_DEFINITIONS: \"TOO_MANY_FUNCTION_DEFINITIONS\",\n /** `BytecodeBuilder`'s `anonymousBodies` side-table (map/reduce inline transform bodies) exceeding its capacity. Same class as `TOO_MANY_FUNCTION_DEFINITIONS` above. */\n TOO_MANY_ANONYMOUS_BODIES: \"TOO_MANY_ANONYMOUS_BODIES\",\n\n // ── VM (vm/VM.ts, vm/OpRegistry.ts, vm/VMBuiltins.ts) ──\n EVALUATION_ERROR: \"EVALUATION_ERROR\",\n INSTRUCTION_LIMIT_EXCEEDED: \"INSTRUCTION_LIMIT_EXCEEDED\",\n STACK_LIMIT_EXCEEDED: \"STACK_LIMIT_EXCEEDED\",\n /** One evaluation asking for more elements (collection Values, matrix cells) than `vm.maxAllocatedElements` allows. The counter the two limits above cannot be: both are checked between opcodes, so neither can see what a single opcode allocates inside a loop of its own. See `vm/AllocationBudget.ts`. Recoverable, since it describes this expression rather than the engine. */\n ALLOCATION_LIMIT_EXCEEDED: \"ALLOCATION_LIMIT_EXCEEDED\",\n /** New this phase. See `VM.ts`'s `safePop()`: a stack-underflow (corrupted bytecode, a buggy plugin) is now a controlled EngineError instead of a raw TypeError. Category INTERNAL, since it is an engine or plugin fault rather than a typed line, but recoverable: it happened on one line and the engine is still usable. */\n STACK_UNDERFLOW: \"STACK_UNDERFLOW\",\n UNDEFINED_VARIABLE: \"UNDEFINED_VARIABLE\",\n /** New this phase, the Tier-2/`LOAD_GLOBAL_VAR` hardening: a global variable read before its async preflight resolved, surfaced as a controlled error instead of pushing `undefined`. */\n GLOBAL_VARIABLE_NOT_RESOLVED: \"GLOBAL_VARIABLE_NOT_RESOLVED\",\n UNKNOWN_FUNCTION: \"UNKNOWN_FUNCTION\",\n /** `unwrapEvalResult()`'s pending-when-expecting-value case, a caller-contract violation, not user-input. */\n UNEXPECTED_PENDING_RESULT: \"UNEXPECTED_PENDING_RESULT\",\n /** User-defined-function call/definition errors (`CALL_USER_FUNCTION`/`DEFINE_USER_FUNCTION` opcodes), calling a name with no matching definition, calling with the wrong argument count, and the deliberate v1 restriction that a function body can't itself contain async work. */\n UNDEFINED_FUNCTION: \"UNDEFINED_FUNCTION\",\n FUNCTION_ARITY_MISMATCH: \"FUNCTION_ARITY_MISMATCH\",\n /** The same mistake against a BUILT-IN rather than a user-defined function (`sqrt()`, `atan2(1)`, `sqrt(1,2,3)`). Separate from `FUNCTION_ARITY_MISMATCH` above because the two are raised by different opcodes and a host may want to word them differently. Checked at the `CALL_BUILTIN` dispatch against `vm/VMBuiltinArity.ts`; recoverable, since it is a typo in the line, not an engine fault. */\n BUILTIN_ARITY_MISMATCH: \"BUILTIN_ARITY_MISMATCH\",\n USER_FUNCTION_ASYNC_UNSUPPORTED: \"USER_FUNCTION_ASYNC_UNSUPPORTED\",\n /** A map/reduce transform body (inline expression or user-defined function) calling an async plugin. Same v1 scope restriction as `USER_FUNCTION_ASYNC_UNSUPPORTED` above, enforced both at parse time (`MAP_REDUCE_TRANSFORM_MUST_BE_SYNCHRONOUS`, packages/mapreduce/) and as a defense-in-depth runtime backstop here. */\n MAP_REDUCE_ASYNC_UNSUPPORTED: \"MAP_REDUCE_ASYNC_UNSUPPORTED\",\n /** An algebra verb's expression argument (`BIND_UNKNOWN`'s body) calling an async plugin. Same v1 scope restriction as the two above, and likewise refused at parse time first (`SYMBOLIC_ARGUMENT_MUST_BE_SYNCHRONOUS`, packages/symbolic/). */\n SYMBOLIC_ASYNC_UNSUPPORTED: \"SYMBOLIC_ASYNC_UNSUPPORTED\",\n /** `explainLine()` asked to derive a line that resolves data asynchronously (a live-data or async-plugin line). A derivation is a sequence of settled intermediate values, which a pending result has none of, so the line is refused rather than explained with a hole in it. */\n EXPLAIN_ASYNC_UNSUPPORTED: \"EXPLAIN_ASYNC_UNSUPPORTED\",\n /** `pushCallFrame()`'s recursion guard, a nested `CALL_USER_FUNCTION` re-enters `executeBytecode()`, so `maxInstructions` alone can't catch e.g. `f(x) = f(x)`; this is the dedicated backstop. `recoverable: true` (the default for `.execution()`), ordinary user-written infinite recursion, not an engine bug; the guard exists precisely so it surfaces as a clear error instead of overflowing the native call stack uncatchably. */\n FUNCTION_RECURSION_LIMIT_EXCEEDED: \"FUNCTION_RECURSION_LIMIT_EXCEEDED\",\n /** The companion to the code above, and the half it could never see: how MANY user-defined-function calls one evaluation makes, rather than how deeply they nest. A twenty-two-line doubling chain nests twenty-two deep (legal) and makes two million calls (a fatal heap abort). Counted in `vm/AllocationBudget.ts`, because the tally has to survive `executeBytecode()` re-entering itself. Recoverable. */\n FUNCTION_CALL_LIMIT_EXCEEDED: \"FUNCTION_CALL_LIMIT_EXCEEDED\",\n /** A `<date> + N workdays` offset outside `date.maxOffsetYears`/`minOffsetYears`. Workdays are the one date offset that walks the calendar a day at a time, so the one whose cost is the offset; every other one moves a Date field once. Recoverable. */\n DATE_OFFSET_LIMIT_EXCEEDED: \"DATE_OFFSET_LIMIT_EXCEEDED\",\n /** The anchor of `N working days after/before/from <expr>` was not a date (e.g. `5 working days after 3`). The grammar guarantees the count is a number, so this only fires on the anchor. Emitted as a recoverable Error value, not thrown, matching the datetime package's other type guards. See `vm/VM.ts`'s `DATE_WORKDAY_OFFSET` case. */\n WORKDAY_OFFSET_EXPECTED_DATE: \"WORKDAY_OFFSET_EXPECTED_DATE\",\n /** An endpoint of `working days between <expr> and <expr>` was not a date. Recoverable Error value. See `vm/VM.ts`'s `DATE_WORKDAYS_BETWEEN` case. */\n WORKDAYS_BETWEEN_EXPECTED_DATES: \"WORKDAYS_BETWEEN_EXPECTED_DATES\",\n /** The two endpoints of `working days between <expr> and <expr>` are further apart than `date.maxOffsetYears`/`minOffsetYears` allow the count's calendar walk to run. Recoverable Error value, the between-count's equivalent of `DATE_OFFSET_LIMIT_EXCEEDED`. See `vm/VM.ts`'s `DATE_WORKDAYS_BETWEEN` case. */\n WORKDAYS_BETWEEN_RANGE_TOO_LARGE: \"WORKDAYS_BETWEEN_RANGE_TOO_LARGE\",\n /** A `<<`/`>>` with a bigint operand whose exact result would pass `MAX_EXACT_SHIFT_BITS`, whichever operand is the bigint. Both spellings refuse as of 1.0.0: a bigint on the left used to fall through to `x * 2^n` in doubles and report a 19,870-digit integer as Infinity. See `vm/VM.ts`'s `bigIntShift()`. Recoverable. */\n BIGINT_SHIFT_LIMIT_EXCEEDED: \"BIGINT_SHIFT_LIMIT_EXCEEDED\",\n /** The same ceiling for `^`, the operator it was written for: `2n ^ 100000` asks for the same 100,001-bit integer `1n << 100000` does, so the two spellings answer the same way. Also new in 1.0.0, and for the same reason: this used to fall through to the double path and answer Infinity. A fractional or negative exponent (`4n ^ 0.5`, `2n ^ -1`) has no exact answer to bound and still uses the double path. See `vm/VM.ts`'s `MAX_EXACT_POW_BITS`. Recoverable. */\n BIGINT_POW_LIMIT_EXCEEDED: \"BIGINT_POW_LIMIT_EXCEEDED\",\n /** An operand with no whole-number form (a fraction, an infinity, a NaN) meeting a bigint: `1n + 0.5`, `1n & 1.5`, `5n/pi`. `BigInt()` answers those with a raw RangeError, which the VM relabelled UNEXPECTED_ERROR, so a typo in the line was reported as an engine fault. Recoverable; see `vm/VMConversion.ts`'s `toBigIntOperand()`. */\n BIGINT_INEXACT_OPERAND: \"BIGINT_INEXACT_OPERAND\",\n /** `10n / 0n` and `10n mod 0n`. Deliberately NOT what `1 / 0` does, which is Infinity: a bigint division is exact integer division (`7n / 2n` is 3n), and integer division by zero has no answer, exactly as it has none in C, Java, Python or JavaScript's own BigInt. Previously V8's own RangeError, relabelled UNEXPECTED_ERROR. Recoverable; see `vm/VMConversion.ts`'s `bigIntDivisionByZero()`. */\n BIGINT_DIVISION_BY_ZERO: \"BIGINT_DIVISION_BY_ZERO\",\n /** `DEFINE_USER_FUNCTION`'s body-index lookup failing, a compiler/VM invariant violation (the opcode stream referenced a `userFunctionBodies` slot that doesn't exist), never a user-input error. */\n INTERNAL_MISSING_FUNCTION_BODY: \"INTERNAL_MISSING_FUNCTION_BODY\",\n /** `MAP_INVOKE`/`REDUCE_INVOKE`'s anonymous-body-index lookup failing. Same class as `INTERNAL_MISSING_FUNCTION_BODY` above, for the `anonymousBodies` side-table instead of `userFunctionBodies`. */\n INTERNAL_MISSING_ANONYMOUS_BODY: \"INTERNAL_MISSING_ANONYMOUS_BODY\",\n\n // ── Malformed bytecode on the public `./vm` surface (vm/VM.ts) ──\n //\n // `executeBytecode` is exported, so a bytecode program is caller input in\n // the same sense an expression string is, and these five say so. They are\n // VALIDATION rather than INTERNAL for exactly that reason: before they\n // existed, every one of these cases reached a raw TypeError (`BigInt(undefined)`,\n // `code.toUpperCase()` on a boolean, destructuring a program that was not\n // there), which normalised to UNEXPECTED_ERROR and told the caller the\n // engine was broken when their eleven bytes were. Reachable from ordinary\n // source only through a compiler bug, which is why the messages name the\n // opcode and the operand rather than the user's line.\n /** An operand byte read past the end of the stream: the program ends in the middle of an instruction. */\n MALFORMED_BYTECODE_TRUNCATED: \"MALFORMED_BYTECODE_TRUNCATED\",\n /** A constant-pool operand indexing a `numbers`/`strings` entry that does not exist, or that is not of the pool's type. */\n MALFORMED_BYTECODE_CONSTANT_INDEX: \"MALFORMED_BYTECODE_CONSTANT_INDEX\",\n /** A unit or converter name read off the value stack that is not a string. Distinct from the pool case above: the operand is a Value another opcode pushed, not a pool entry. */\n MALFORMED_BYTECODE_OPERAND_TYPE: \"MALFORMED_BYTECODE_OPERAND_TYPE\",\n /** `MAP_INVOKE`/`REDUCE_INVOKE` carrying a body kind other than 0/1/2. Used to fall through every arm with no body and recurse into `executeBytecode(undefined)`. */\n MALFORMED_BYTECODE_BODY_KIND: \"MALFORMED_BYTECODE_BODY_KIND\",\n /** A `PUSH_BIGINT` pool entry that is not a whole number, e.g. `\"1.000\"`. `BigInt()` answers that with a raw SyntaxError. */\n MALFORMED_BYTECODE_BIGINT_LITERAL: \"MALFORMED_BYTECODE_BIGINT_LITERAL\",\n /** `executeBytecode()` called with something that is not a runnable program at all. Checked before the destructure that used to throw outside the function's own try/catch. */\n MALFORMED_BYTECODE_PROGRAM: \"MALFORMED_BYTECODE_PROGRAM\",\n\n // ── Symbolic algebra (symbolic/, vm/SymbolicOps.ts) ──\n /** A coefficient grew past `RATIONAL_MAX_BITS`, e.g. repeated exact elimination multiplying denominators together. */\n SYMBOLIC_RATIONAL_OVERFLOW: \"SYMBOLIC_RATIONAL_OVERFLOW\",\n /** `NaN` or `±Infinity` reaching a symbolic expression, neither of which has an exact rational value. */\n SYMBOLIC_NONFINITE_OPERAND: \"SYMBOLIC_NONFINITE_OPERAND\",\n /** Division by an exactly-zero rational. Exact, unlike the double comparison it replaced, which could not distinguish a true zero from `5.551e-17`. */\n SYMBOLIC_DIVISION_BY_ZERO: \"SYMBOLIC_DIVISION_BY_ZERO\",\n /** A tree exceeding `SYMBOLIC_MAX_NODES` entering the simplifier. */\n SYMBOLIC_NODE_LIMIT_EXCEEDED: \"SYMBOLIC_NODE_LIMIT_EXCEEDED\",\n /** A builtin with no symbolic reading (`min`, `random`, the finance block, ...) applied to an expression still containing an unknown. Returned rather than computing against `toNumber()`'s placeholder zero. */\n SYMBOLIC_UNSUPPORTED_FUNCTION: \"SYMBOLIC_UNSUPPORTED_FUNCTION\",\n /** The rational-root search exceeding `FACTOR_MAX_ROOT_CANDIDATES`. The candidate set is the product of two divisor sets, so a highly-composite coefficient escapes quickly. */\n SYMBOLIC_FACTOR_LIMIT_EXCEEDED: \"SYMBOLIC_FACTOR_LIMIT_EXCEEDED\",\n /** An equation outside what the solver attempts: not a polynomial, above the degree ceiling, or non-linear in the unknown while another unknown is present. */\n SYMBOLIC_SOLVE_UNSUPPORTED: \"SYMBOLIC_SOLVE_UNSUPPORTED\",\n /** Some but not all of an equation's roots were found. Reported rather than returned, because a partial list of roots looks exactly like a complete one. */\n SYMBOLIC_SOLVE_INCOMPLETE: \"SYMBOLIC_SOLVE_INCOMPLETE\",\n /** `solve`'s second argument not being a bare name. */\n SOLVE_REQUIRES_VARIABLE_NAME: \"SOLVE_REQUIRES_VARIABLE_NAME\",\n /** A derivative order outside 0..`DERIVATIVE_MAX_ORDER`. */\n SYMBOLIC_DERIVATIVE_ORDER_LIMIT: \"SYMBOLIC_DERIVATIVE_ORDER_LIMIT\",\n /** An expression with no known elementary antiderivative. Reported rather than approximated, since a wrong integral is indistinguishable from a right one at the point of use. */\n SYMBOLIC_INTEGRAL_UNSUPPORTED: \"SYMBOLIC_INTEGRAL_UNSUPPORTED\",\n /** A Taylor degree outside 0..`TAYLOR_MAX_DEGREE`. */\n SYMBOLIC_TAYLOR_DEGREE_LIMIT: \"SYMBOLIC_TAYLOR_DEGREE_LIMIT\",\n /** A Taylor coefficient that does not reduce to an exact number at the expansion point. */\n SYMBOLIC_TAYLOR_INEXACT: \"SYMBOLIC_TAYLOR_INEXACT\",\n /** An algebra verb's variable-name argument not being a bare name. */\n SYMBOLIC_REQUIRES_VARIABLE_NAME: \"SYMBOLIC_REQUIRES_VARIABLE_NAME\",\n /** `jacobian` called with expressions containing no unknown to differentiate against. */\n SYMBOLIC_JACOBIAN_NO_VARIABLES: \"SYMBOLIC_JACOBIAN_NO_VARIABLES\",\n /** A finite number whose decimal form could not be read back, which the regex covering every `Number.prototype.toString` output should make unreachable. */\n INTERNAL_RATIONAL_PARSE: \"INTERNAL_RATIONAL_PARSE\",\n\n // ── Engine (engine/ExpressionEngine.ts, engine/ExpressionEngineSafety.ts, engine/AsyncResolutionBatcher.ts) ──\n EXPRESSION_TOO_LONG: \"EXPRESSION_TOO_LONG\",\n EXPRESSION_TOO_COMPLEX: \"EXPRESSION_TOO_COMPLEX\",\n /** A document with more lines than `performance.maxDocumentLines`. The per-line limits above bound what one line may ask for and say nothing about how many lines there are; two hundred thousand of `1 + 1` exhausted the heap on the line records alone. Recoverable. */\n DOCUMENT_TOO_LARGE: \"DOCUMENT_TOO_LARGE\",\n NORMALIZED_TOKEN_LIMIT_EXCEEDED: \"NORMALIZED_TOKEN_LIMIT_EXCEEDED\",\n /** `\"=>\"` with nothing before it, needs an expression or variable name to solve/simplify. */\n THEREFORE_REQUIRES_EXPRESSION: \"THEREFORE_REQUIRES_EXPRESSION\",\n /** A `\"=>\"`-triggered expression called an async plugin (weather/stocks/currency). Same v1 scope restriction as user-function/map-reduce bodies. */\n THEREFORE_ASYNC_UNSUPPORTED: \"THEREFORE_ASYNC_UNSUPPORTED\",\n /** Colon-separated numbers that are not a time any clock can show (\"24:00\", \"9:60\", \"100:5\"). Raised by the labeled-line fallback, which used to answer them with whatever stood after the colon. */\n INVALID_TIME_LITERAL: \"INVALID_TIME_LITERAL\",\n\n // ── Snapshot / restore (engine/EngineSnapshot.ts, engine/ExpressionEngine.ts) ──\n /** `fromJSON()` handed an object that is not a snapshot at all, or whose serialised-shape version does not match this engine's reader. The versioning gate that refuses an incompatible snapshot clearly rather than restoring it wrongly. See `engine/EngineSnapshot.ts`'s `assertRestorable()`. */\n SNAPSHOT_VERSION_MISMATCH: \"SNAPSHOT_VERSION_MISMATCH\",\n /** A snapshot with the right envelope but internally inconsistent contents (an unrecognised number sentinel, an unknown value tag). Distinct from a version mismatch: the format is right, the payload is not. */\n SNAPSHOT_MALFORMED: \"SNAPSHOT_MALFORMED\",\n /** A value the v1 snapshot format cannot yet represent (a symbolic/algebra value, a symbolic matrix cell). Deferred to a follow-up; refused by name rather than dropped silently. */\n SNAPSHOT_UNSUPPORTED_VALUE: \"SNAPSHOT_UNSUPPORTED_VALUE\",\n\n // ── Config (constants/Configuration.ts) ──\n CONFIG_PATH_NOT_FOUND: \"CONFIG_PATH_NOT_FOUND\",\n INVALID_CONFIG_PATH: \"INVALID_CONFIG_PATH\",\n CONFIG_SECTION_NOT_FOUND: \"CONFIG_SECTION_NOT_FOUND\",\n CONFIG_PROPERTY_NOT_FOUND: \"CONFIG_PROPERTY_NOT_FOUND\",\n\n // ── Package/lexer registration-time collisions (lexer/ExpressionLexer.ts) ──\n PLUGIN_OPERATOR_COLLISION: \"PLUGIN_OPERATOR_COLLISION\",\n PLUGIN_KEYWORD_COLLISION: \"PLUGIN_KEYWORD_COLLISION\",\n PLUGIN_UNIT_COLLISION: \"PLUGIN_UNIT_COLLISION\",\n /** A package's declared `IEnginePackage.engineVersion` semver range doesn't satisfy the running engine's ENGINE_VERSION. See api/EngineVersionCompatibility.ts. */\n PACKAGE_ENGINE_VERSION_MISMATCH: \"PACKAGE_ENGINE_VERSION_MISMATCH\",\n /** A package's declared `IEnginePackage.engineVersion` isn't a parseable semver range at all (a typo in the package's own descriptor). */\n PACKAGE_ENGINE_VERSION_INVALID_RANGE: \"PACKAGE_ENGINE_VERSION_INVALID_RANGE\",\n /** `OpRegistry.allocateOpcode()`'s dynamic opcode pool (started at 201) exhausted, too many packages calling it. */\n OPCODE_POOL_EXHAUSTED: \"OPCODE_POOL_EXHAUSTED\",\n /** `VMBuiltins.allocatePluginFunctionIndex()`'s 0-255 index pool (a single opcode-stream byte) exhausted. */\n PLUGIN_FUNCTION_INDEX_POOL_EXHAUSTED: \"PLUGIN_FUNCTION_INDEX_POOL_EXHAUSTED\",\n\n // ── vm/Value.ts caller-contract violations (check isRateUnit()/isTimecodeUnit() first) ──\n INVALID_RATE_UNIT: \"INVALID_RATE_UNIT\",\n INVALID_TIMECODE_UNIT: \"INVALID_TIMECODE_UNIT\",\n\n // ── errors/EngineError.ts's own fallback normalization ──\n UNEXPECTED_ERROR: \"UNEXPECTED_ERROR\",\n UNKNOWN_ERROR: \"UNKNOWN_ERROR\",\n} as const;\n\n/** Every error code the engine's own layers can produce, from {@link CoreErrorCodes}. */\nexport type CoreErrorCode = (typeof CoreErrorCodes)[keyof typeof CoreErrorCodes];\n\n/**\n * The aggregated catalog type. Currently just `CoreErrorCode`, union in\n * each package's own code-object type here as Phase 5 converts it, e.g.\n * `CoreErrorCode | WeatherErrorCode | StocksErrorCode | ...`.\n */\nexport type ErrorCode = CoreErrorCode;\n"]}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkB4HBEFTB_cjs = require('./chunk-B4HBEFTB.cjs');
|
|
4
|
+
|
|
5
|
+
// src/errors/WorkerError.ts
|
|
6
|
+
var WorkerErrorCodes = {
|
|
7
|
+
/** The caller aborted the request through its `AbortSignal`. */
|
|
8
|
+
WORKER_CANCELLED: "WORKER_CANCELLED",
|
|
9
|
+
/** The worker engine was torn down while a request was still in flight. */
|
|
10
|
+
WORKER_TERMINATED: "WORKER_TERMINATED",
|
|
11
|
+
/** The transport failed or the worker exited before answering. */
|
|
12
|
+
WORKER_TRANSPORT_FAILED: "WORKER_TRANSPORT_FAILED",
|
|
13
|
+
/** A request named a method the runtime does not expose. */
|
|
14
|
+
WORKER_UNKNOWN_METHOD: "WORKER_UNKNOWN_METHOD",
|
|
15
|
+
/** A request arrived before the runtime finished building its engine. */
|
|
16
|
+
WORKER_NOT_INITIALISED: "WORKER_NOT_INITIALISED",
|
|
17
|
+
/** An init named a package the runtime could not resolve. */
|
|
18
|
+
WORKER_UNKNOWN_PACKAGE: "WORKER_UNKNOWN_PACKAGE"
|
|
19
|
+
};
|
|
20
|
+
function serializeEngineError(error) {
|
|
21
|
+
const dto = {
|
|
22
|
+
name: error.name,
|
|
23
|
+
category: error.category,
|
|
24
|
+
code: error.code,
|
|
25
|
+
message: error.message,
|
|
26
|
+
recoverable: error.recoverable
|
|
27
|
+
};
|
|
28
|
+
if (error.expected !== void 0) dto.expected = error.expected;
|
|
29
|
+
if (error.found !== void 0) dto.found = error.found;
|
|
30
|
+
if (error.suggestion !== void 0) dto.suggestion = error.suggestion;
|
|
31
|
+
if (error.span !== void 0) dto.span = error.span;
|
|
32
|
+
return dto;
|
|
33
|
+
}
|
|
34
|
+
function deserializeEngineError(dto) {
|
|
35
|
+
const category = Object.values(chunkB4HBEFTB_cjs.ErrorCategory).includes(dto.category) ? dto.category : "INTERNAL" /* INTERNAL */;
|
|
36
|
+
return new chunkB4HBEFTB_cjs.EngineError(category, {
|
|
37
|
+
code: dto.code,
|
|
38
|
+
message: dto.message,
|
|
39
|
+
expected: dto.expected,
|
|
40
|
+
found: dto.found,
|
|
41
|
+
suggestion: dto.suggestion,
|
|
42
|
+
recoverable: dto.recoverable,
|
|
43
|
+
span: dto.span
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
function workerCancelledError(method) {
|
|
47
|
+
return chunkB4HBEFTB_cjs.ErrorFactory.execution(
|
|
48
|
+
WorkerErrorCodes.WORKER_CANCELLED,
|
|
49
|
+
method ? `The worker request "${method}" was cancelled` : "The worker request was cancelled",
|
|
50
|
+
method ? { method } : void 0
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
function workerTerminatedError() {
|
|
54
|
+
return chunkB4HBEFTB_cjs.ErrorFactory.execution(
|
|
55
|
+
WorkerErrorCodes.WORKER_TERMINATED,
|
|
56
|
+
"The worker engine was terminated before this request completed"
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
function workerTransportError(detail) {
|
|
60
|
+
return chunkB4HBEFTB_cjs.ErrorFactory.external(
|
|
61
|
+
WorkerErrorCodes.WORKER_TRANSPORT_FAILED,
|
|
62
|
+
`The worker transport failed: ${detail}`,
|
|
63
|
+
{ detail }
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
exports.WorkerErrorCodes = WorkerErrorCodes;
|
|
68
|
+
exports.deserializeEngineError = deserializeEngineError;
|
|
69
|
+
exports.serializeEngineError = serializeEngineError;
|
|
70
|
+
exports.workerCancelledError = workerCancelledError;
|
|
71
|
+
exports.workerTerminatedError = workerTerminatedError;
|
|
72
|
+
exports.workerTransportError = workerTransportError;
|
|
73
|
+
//# sourceMappingURL=chunk-B7NLZMQ3.cjs.map
|
|
74
|
+
//# sourceMappingURL=chunk-B7NLZMQ3.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/errors/WorkerError.ts"],"names":["ErrorCategory","EngineError","ErrorFactory"],"mappings":";;;;;AAoBO,IAAM,gBAAA,GAAmB;AAAA;AAAA,EAE/B,gBAAA,EAAkB,kBAAA;AAAA;AAAA,EAElB,iBAAA,EAAmB,mBAAA;AAAA;AAAA,EAEnB,uBAAA,EAAyB,yBAAA;AAAA;AAAA,EAEzB,qBAAA,EAAuB,uBAAA;AAAA;AAAA,EAEvB,sBAAA,EAAwB,wBAAA;AAAA;AAAA,EAExB,sBAAA,EAAwB;AACzB;AAyBO,SAAS,qBAAqB,KAAA,EAA2C;AAC/E,EAAA,MAAM,GAAA,GAA6B;AAAA,IAClC,MAAM,KAAA,CAAM,IAAA;AAAA,IACZ,UAAU,KAAA,CAAM,QAAA;AAAA,IAChB,MAAM,KAAA,CAAM,IAAA;AAAA,IACZ,SAAS,KAAA,CAAM,OAAA;AAAA,IACf,aAAa,KAAA,CAAM;AAAA,GACpB;AAIA,EAAA,IAAI,KAAA,CAAM,QAAA,KAAa,MAAA,EAAW,GAAA,CAAI,WAAW,KAAA,CAAM,QAAA;AACvD,EAAA,IAAI,KAAA,CAAM,KAAA,KAAU,MAAA,EA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gC,MAAM,CAAA,CAAA;AAAA,IACtC,EAAE,MAAA;AAAO,GACV;AACD","file":"chunk-B7NLZMQ3.cjs","sourcesContent":["/**\n * Structured errors for the off-main-thread worker harness, and the pair of\n * functions that carry an {@link EngineError} across a `postMessage` boundary.\n *\n * A worker runs in another thread, so a failure there cannot be `throw`n back\n * into the caller's stack. It has to be encoded, posted, and rebuilt on the\n * main side, and it must arrive as a real structured error rather than a lost\n * promise or an opaque string. {@link serializeEngineError} projects an\n * `EngineError` onto a plain, clone-safe object; {@link deserializeEngineError}\n * rebuilds one from that object so the main-side `catch` sees the same\n * `code`/`category`/`message` it would have seen in-process.\n */\n\nimport { EngineError, ErrorCategory, ErrorFactory, type SourceSpan } from \"./EngineError\";\n\n/**\n * Codes the worker harness owns, co-located here rather than unioned into the\n * core catalog, matching the convention `errors/ErrorCode.ts` documents for a\n * domain that keeps its own small code object.\n */\nexport const WorkerErrorCodes = {\n\t/** The caller aborted the request through its `AbortSignal`. */\n\tWORKER_CANCELLED: \"WORKER_CANCELLED\",\n\t/** The worker engine was torn down while a request was still in flight. */\n\tWORKER_TERMINATED: \"WORKER_TERMINATED\",\n\t/** The transport failed or the worker exited before answering. */\n\tWORKER_TRANSPORT_FAILED: \"WORKER_TRANSPORT_FAILED\",\n\t/** A request named a method the runtime does not expose. */\n\tWORKER_UNKNOWN_METHOD: \"WORKER_UNKNOWN_METHOD\",\n\t/** A request arrived before the runtime finished building its engine. */\n\tWORKER_NOT_INITIALISED: \"WORKER_NOT_INITIALISED\",\n\t/** An init named a package the runtime could not resolve. */\n\tWORKER_UNKNOWN_PACKAGE: \"WORKER_UNKNOWN_PACKAGE\",\n} as const;\n\n/**\n * A structured error flattened for transport.\n *\n * Every field is a string, a boolean, or an object of numbers, so the whole\n * thing survives both `structuredClone` (what `postMessage` uses) and\n * `JSON.stringify` (what a host may log). `context`, `cause` and `timestamp`\n * are deliberately dropped rather than posted: a context can hold a value that\n * is not clone-safe, and none of the three is part of what a main-side handler\n * branches on.\n */\nexport interface SerializedEngineError {\n\tname: string;\n\tcategory: ErrorCategory;\n\tcode: string;\n\tmessage: string;\n\texpected?: string;\n\tfound?: string;\n\tsuggestion?: string;\n\trecoverable: boolean;\n\tspan?: SourceSpan;\n}\n\n/** Flatten an {@link EngineError} into a clone-safe {@link SerializedEngineError}. */\nexport function serializeEngineError(error: EngineError): SerializedEngineError {\n\tconst dto: SerializedEngineError = {\n\t\tname: error.name,\n\t\tcategory: error.category,\n\t\tcode: error.code,\n\t\tmessage: error.message,\n\t\trecoverable: error.recoverable,\n\t};\n\t// Only the optional string fields that were actually set cross the wire, so\n\t// a rebuilt error has `undefined` exactly where the original did rather than\n\t// an explicit `undefined` property a deep-equal would trip on.\n\tif (error.expected !== undefined) dto.expected = error.expected;\n\tif (error.found !== undefined) dto.found = error.found;\n\tif (error.suggestion !== undefined) dto.suggestion = error.suggestion;\n\t// A span is character offsets (plain numbers), so it is safe to carry and\n\t// useful for a host that highlights the failing range.\n\tif (error.span !== undefined) dto.span = error.span;\n\treturn dto;\n}\n\n/**\n * Rebuild an {@link EngineError} from its transported form.\n *\n * The category string round-trips straight back into the `ErrorCategory` enum\n * (its members ARE their own string values), so a main-side `catch` reads the\n * same category the worker raised. A malformed category (a message that was not\n * produced by {@link serializeEngineError}) falls back to `INTERNAL` rather than\n * constructing an error with an invalid category.\n */\nexport function deserializeEngineError(dto: SerializedEngineError): EngineError {\n\tconst category = Object.values(ErrorCategory).includes(dto.category)\n\t\t? dto.category\n\t\t: ErrorCategory.INTERNAL;\n\treturn new EngineError(category, {\n\t\tcode: dto.code,\n\t\tmessage: dto.message,\n\t\texpected: dto.expected,\n\t\tfound: dto.found,\n\t\tsuggestion: dto.suggestion,\n\t\trecoverable: dto.recoverable,\n\t\tspan: dto.span,\n\t});\n}\n\n/** The error a request rejects with when its caller aborts through an `AbortSignal`. */\nexport function workerCancelledError(method?: string): EngineError {\n\treturn ErrorFactory.execution(\n\t\tWorkerErrorCodes.WORKER_CANCELLED,\n\t\tmethod\n\t\t\t? `The worker request \"${method}\" was cancelled`\n\t\t\t: \"The worker request was cancelled\",\n\t\tmethod ? { method } : undefined,\n\t);\n}\n\n/** The error every pending request rejects with when the worker engine is terminated. */\nexport function workerTerminatedError(): EngineError {\n\treturn ErrorFactory.execution(\n\t\tWorkerErrorCodes.WORKER_TERMINATED,\n\t\t\"The worker engine was terminated before this request completed\",\n\t);\n}\n\n/** The error a request rejects with when the transport fails or the worker exits early. */\nexport function workerTransportError(detail: string): EngineError {\n\treturn ErrorFactory.external(\n\t\tWorkerErrorCodes.WORKER_TRANSPORT_FAILED,\n\t\t`The worker transport failed: ${detail}`,\n\t\t{ detail },\n\t);\n}\n"]}
|
|
@@ -10,6 +10,7 @@ var OpCode = /* @__PURE__ */ ((OpCode2) => {
|
|
|
10
10
|
OpCode2[OpCode2["PUSH_STRING"] = 13] = "PUSH_STRING";
|
|
11
11
|
OpCode2[OpCode2["PUSH_BOOLEAN"] = 14] = "PUSH_BOOLEAN";
|
|
12
12
|
OpCode2[OpCode2["PUSH_VARIABLE"] = 15] = "PUSH_VARIABLE";
|
|
13
|
+
OpCode2[OpCode2["PUSH_DECIMAL"] = 16] = "PUSH_DECIMAL";
|
|
13
14
|
OpCode2[OpCode2["ADD"] = 20] = "ADD";
|
|
14
15
|
OpCode2[OpCode2["SUB"] = 21] = "SUB";
|
|
15
16
|
OpCode2[OpCode2["MUL"] = 22] = "MUL";
|
|
@@ -18,6 +19,7 @@ var OpCode = /* @__PURE__ */ ((OpCode2) => {
|
|
|
18
19
|
OpCode2[OpCode2["EXP"] = 25] = "EXP";
|
|
19
20
|
OpCode2[OpCode2["NEG"] = 26] = "NEG";
|
|
20
21
|
OpCode2[OpCode2["POS"] = 27] = "POS";
|
|
22
|
+
OpCode2[OpCode2["MAKE_UNCERTAIN"] = 28] = "MAKE_UNCERTAIN";
|
|
21
23
|
OpCode2[OpCode2["LSHIFT"] = 30] = "LSHIFT";
|
|
22
24
|
OpCode2[OpCode2["RSHIFT"] = 31] = "RSHIFT";
|
|
23
25
|
OpCode2[OpCode2["URSHIFT"] = 32] = "URSHIFT";
|
|
@@ -53,6 +55,8 @@ var OpCode = /* @__PURE__ */ ((OpCode2) => {
|
|
|
53
55
|
OpCode2[OpCode2["DATE_NEXT_WEEKDAY"] = 93] = "DATE_NEXT_WEEKDAY";
|
|
54
56
|
OpCode2[OpCode2["DATE_LAST_WEEKDAY"] = 94] = "DATE_LAST_WEEKDAY";
|
|
55
57
|
OpCode2[OpCode2["DATE_LITERAL"] = 95] = "DATE_LITERAL";
|
|
58
|
+
OpCode2[OpCode2["DATE_WORKDAY_OFFSET"] = 96] = "DATE_WORKDAY_OFFSET";
|
|
59
|
+
OpCode2[OpCode2["DATE_WORKDAYS_BETWEEN"] = 97] = "DATE_WORKDAYS_BETWEEN";
|
|
56
60
|
OpCode2[OpCode2["RATE_DIV"] = 110] = "RATE_DIV";
|
|
57
61
|
OpCode2[OpCode2["RATE_MUL"] = 111] = "RATE_MUL";
|
|
58
62
|
OpCode2[OpCode2["RATE_CONVERT"] = 112] = "RATE_CONVERT";
|
|
@@ -90,5 +94,5 @@ function getOpCodeName(op) {
|
|
|
90
94
|
}
|
|
91
95
|
|
|
92
96
|
export { OpCode, getOpCodeName };
|
|
93
|
-
//# sourceMappingURL=chunk-
|
|
94
|
-
//# sourceMappingURL=chunk-
|
|
97
|
+
//# sourceMappingURL=chunk-BLI4NIQY.js.map
|
|
98
|
+
//# sourceMappingURL=chunk-BLI4NIQY.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/parser/OpCode.ts"],"names":["OpCode"],"mappings":";AAcO,IAAK,MAAA,qBAAAA,OAAAA,KAAL;AAEN,EAAAA,OAAAA,CAAAA,OAAAA,CAAA,SAAM,CAAA,CAAA,GAAN,KAAA;AACA,EAAAA,OAAAA,CAAAA,OAAAA,CAAA,UAAO,CAAA,CAAA,GAAP,MAAA;AACA,EAAAA,OAAAA,CAAAA,OAAAA,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AA,wBAAqB,GAAA,CAAA,GAArB,oBAAA;AAMA,EAAAA,OAAAA,CAAAA,OAAAA,CAAA,aAAU,GAAA,CAAA,GAAV,SAAA;AACA,EAAAA,OAAAA,CAAAA,OAAAA,CAAA,gBAAa,GAAA,CAAA,GAAb,YAAA;AACA,EAAAA,OAAAA,CAAAA,OAAAA,CAAA,gBAAa,GAAA,CAAA,GAAb,YAAA;AACA,EAAAA,OAAAA,CAAAA,OAAAA,CAAA,eAAY,GAAA,CAAA,GAAZ,WAAA;AACA,EAAAA,OAAAA,CAAAA,OAAAA,CAAA,eAAY,GAAA,CAAA,GAAZ,WAAA;AACA,EAAAA,OAAAA,CAAAA,OAAAA,CAAA,gBAAa,GAAA,CAAA,GAAb,YAAA;AACA,EAAAA,OAAAA,CAAAA,OAAAA,CAAA,mBAAgB,GAAA,CAAA,GAAhB,eAAA;AAOA,EAAAA,OAAAA,CAAAA,OAAAA,CAAA,kBAAe,GAAA,CAAA,GAAf,cAAA;AArJW,EAAA,OAAAA,OAAAA;AAAA,CAAA,EAAA,MAAA,IAAA,EAAA;AAsKZ,IAAM,iBAA8C,MAAM;AACzD,EAAA,MAAM,GAAA,uBAAU,GAAA,EAAoB;AACpC,EAAA,KAAA,MAAW,CAAC,GAAA,EAAK,KAAK,KAAK,MAAA,CAAO,OAAA,CAAQ,MAAM,CAAA,EAAG;AAClD,IAAA,IAAI,OAAO,KAAA,KAAU,QAAA,EAAU,GAAA,CAAI,GAAA,CAAI,OAAO,GAAG,CAAA;AAAA,EAClD;AACA,EAAA,OAAO,GAAA;AACR,CAAA,GAAG;AAOI,SAAS,cAAc,EAAA,EAAoB;AACjD,EAAA,OAAO,aAAA,CAAc,GAAA,CAAI,EAAE,CAAA,IAAK,WAAW,EAAE,CAAA,CAAA;AAC9C","file":"chunk-BLI4NIQY.js","sourcesContent":["/**\n * The VM's bytecode instruction set.\n *\n * Emitted by parselets (via {@link BytecodeBuilder}) during parsing and\n * consumed by the VM's dispatch loop during execution. Values are grouped\n * into numeric bands by category (0-9 stack ops, 10-19 push-literal, 20-29\n * arithmetic, ...) purely for readability, the VM dispatches on the exact\n * numeric value, not the band.\n *\n * Third-party packages emit `CALL_PLUGIN` (with a plugin-function index\n * from {@link allocatePluginFunctionIndex}) to invoke their own logic\n * see `IEnginePackage.pluginFunctions`. The other opcodes are used\n * internally by the built-in packages' parselets.\n */\nexport enum OpCode {\n\t// Stack operations\n\tNOP = 0,\n\tHALT = 1,\n\tSWAP = 2,\n\tDUP = 3,\n\n\t// Push literals\n\tPUSH_NUMBER = 10,\n\tPUSH_BIGINT = 11,\n\tPUSH_HEX = 12,\n\tPUSH_STRING = 13,\n\tPUSH_BOOLEAN = 14,\n\tPUSH_VARIABLE = 15,\n\t// A decimal-point literal, pushed with the exact base-ten value it was\n\t// written as alongside the nearest double. The operand is a string-pool\n\t// index holding the normalized \".\" decimal text (thousands grouping already\n\t// stripped), read back into a Number-typed Value whose `exact` sidecar makes\n\t// money that combines with it exact. See vm/Value.ts's numberValueExact().\n\tPUSH_DECIMAL = 16,\n\n\t// Arithmetic (BinaryOperator)\n\tADD = 20,\n\tSUB = 21,\n\tMUL = 22,\n\tDIV = 23,\n\tMOD = 24,\n\tEXP = 25,\n\tNEG = 26,\n\tPOS = 27,\n\t// `a ± b` (or the ASCII `a +/- b`): pops the spread then the center off the\n\t// stack and pushes a Number carrying a one-sigma uncertainty (`vm/Value.ts`'s\n\t// numberValueUncertain). Takes no operand byte, like the other arithmetic\n\t// ops. See packages/uncertainty/ for the parselet that emits it and\n\t// vm/VMConversion.ts's uncertainOp for how the four arithmetic ops propagate.\n\tMAKE_UNCERTAIN = 28,\n\n\t// Bitwise\n\tLSHIFT = 30,\n\tRSHIFT = 31,\n\tURSHIFT = 32,\n\tBIT_AND = 33,\n\tBIT_OR = 34,\n\tBIT_XOR = 35,\n\tBIT_NOT = 36,\n\n\t// Comparison\n\tEQ = 40,\n\tNEQ = 41,\n\tLT = 42,\n\tLTE = 43,\n\tGT = 44,\n\tGTE = 45,\n\n\t// Functions\n\tCALL_PLUGIN = 50, // Plugin-registered functions (may be async — pre-resolved by orchestrator)\n\tCALL_BUILTIN = 51, // Sync built-in functions (sqrt, sin, diceRoll, matmul)\n\tRETURN = 52, // Reserved for future user-defined functions\n\n\t// Variables\n\tLOAD_VAR = 60,\n\tSTORE_VAR = 61,\n\tLOAD_GLOBAL_VAR = 62, // Reads from the process-wide GlobalVariableStore, not the VM's local scope\n\tSTORE_GLOBAL_VAR = 63, // Writes to the process-wide GlobalVariableStore, visible to every document\n\n\t// Type conversion\n\tTO_NUMBER = 70,\n\tTO_HEX = 71,\n\tTO_PERCENTAGE = 74,\n\n\t// UoM\n\tUOM_CONVERT = 80,\n\tUOM_CONVERT_TO = 81,\n\tUOM_GET_VALUE = 82,\n\tUOM_BEST = 83,\n\tUOM_CONVERT_IN = 84,\n\tUOM_POSSIBILITIES = 85, // \"sourceUnit to ?\" — list units convertible from sourceUnit\n\n\t// Datetime\n\tDATE_NOW = 90,\n\tDATE_ADD = 91,\n\tDATE_SUB = 92,\n\tDATE_NEXT_WEEKDAY = 93, // \"next <Weekday>\" — the next occurrence strictly after now\n\tDATE_LAST_WEEKDAY = 94, // \"last <Weekday>\" — the previous occurrence strictly before now\n\tDATE_LITERAL = 95, // Push a datetime literal whose epoch-ms was already resolved at parse time (see DateLiteralParselet)\n\tDATE_WORKDAY_OFFSET = 96, // \"N working days after/before/from <date>\" — a business-day walk from the anchor date. One operand byte: 0 forward, 1 backward. Same walk as `<date> + N workdays` (vm/VM.ts's addBusinessDays). See WorkdayOffsetParselet.\n\tDATE_WORKDAYS_BETWEEN = 97, // \"working days between <date> and <date>\" — the count of working days in the inclusive span. See WorkdaysBetweenParselet and vm/BusinessDays.ts's countBusinessDaysBetween.\n\n\t// Rate, \"quantity per unit of something\" ($99/week, 30 fps). See\n\t// vm/Value.ts's rateValue()/isRateUnit()/splitRateUnit() for the\n\t// representation these opcodes operate on.\n\tRATE_DIV = 110, // Uom ÷ Uom (different measures) -> Rate — the construction op\n\tRATE_MUL = 111, // Rate × Uom (same measure as denominator) -> plain Uom (denominator cancels)\n\tRATE_CONVERT = 112, // Rate -> Rate with a rescaled denominator unit (keeps the same real-world rate)\n\n\t// Time, clock-time-of-day, lap times, video timecode (distinct from\n\t// the Datetime band's calendar-date arithmetic).\n\tCLOCK_TIME_TODAY = 120, // minutes-since-midnight -> Datetime anchored to today's calendar date\n\n\t// Conditionals, boolean logic and eager-evaluated ternary selection.\n\t// EQ/NEQ/LT/LTE/GT/GTE (40-45, above) already existed as dead opcodes\n\t// before this band was wired up; see vm/VM.ts for their handlers.\n\tLOGICAL_AND = 130, // Boolean && Boolean -> Boolean\n\tLOGICAL_OR = 131, // Boolean || Boolean -> Boolean\n\tSELECT = 132, // (thenVal, elseVal, condition) -> thenVal if condition else elseVal — EAGER (both\n\t // branches already evaluated by the time this runs; no real branching/short-circuit,\n\t // a deliberate simplification for a side-effect-free expression language, see\n\t // packages/conditionals/parselets/IfThenElseParselet.ts)\n\n\t// Converters, the general \"as <type>\" mechanism. TO_NUMBER/TO_HEX/\n\t// TO_PERCENTAGE (70/71/74, above) cover the simplest cases; these cover\n\t// the ones with no existing opcode. CALL_AS_CONVERTER is the SDK\n\t// extension point. See IEnginePackage.asConverters and\n\t// vm/VMBuiltins.ts's asConverterRegistry.\n\tTO_FRACTION = 140, // Number -> String, simplified fraction (\"0.5\" -> \"1/2\")\n\tTO_MULTIPLIER = 141, // Number -> String, \"1 + n\" growth multiplier (\"0.5\" -> \"1.5x\")\n\tTO_SCI = 142, // Number -> String, scientific notation (\"1500000\" -> \"1.5e+6\")\n\tTO_BINARY = 143, // Number -> String, base-2 display (\"10\" -> \"0b1010\")\n\tTO_OCTAL = 144, // Number -> String, base-8 display (\"10\" -> \"0o12\")\n\tCALL_AS_CONVERTER = 145, // (value, name) -> runtime asConverterRegistry lookup + call\n\n\t// User-defined, parameterized, reusable functions (f(x) = expr, then\n\t// f(5). See parser/PrecedenceParser.ts's IDENT_ID case\n\t// parser/BytecodeBuilder.ts's UserFunctionDef/emitUserFunctionBody, and\n\t// vm/VM.ts's VM.userFunctions/callFrames). Parameter references inside a\n\t// function body are ORDINARY LOAD_VAR opcodes, not a dedicated\n\t// parameter-load opcode, CALL_USER_FUNCTION binds arguments into a\n\t// name-keyed call frame at runtime, and LOAD_VAR checks the innermost\n\t// call frame before the flat variable store (see VM.getVar()).\n\tDEFINE_USER_FUNCTION = 150, // (operand = index into bytecode.userFunctionBodies) -> register name/params/program into vm.userFunctions. Registration happens at VM-EXECUTION time, not parse time, so a diagnostic/lookahead parse that compiles but never executes a definition line has no side effect on the shared registry.\n\tCALL_USER_FUNCTION = 151, // (N arg values already on stack) -> pop N args, bind by NAME into a new call frame, execute the named function's stored body (reentrant executeBytecode), push its result\n\n\t// Matrix (Calca-parity, replaces the old ARR_* vector-only opcodes\n\t// which were never emitted by any registered parselet; see\n\t// vm/MatrixOps.ts for the shared column-major storage helpers this band\n\t// operates on, and vm/Value.ts's MatrixData for the representation).\n\tMAT_NEW = 152, // (rows, cols operands; rows*cols values already on stack, ROW-MAJOR push order) -> pop rows*cols values, transpose to column-major, push a Matrix\n\tMAT_INDEX1 = 153, // (matrix, index already on stack) -> column-major single-index read `a[i]`\n\tMAT_INDEX2 = 154, // (matrix, row, col already on stack) -> `a[row, col]` read\n\tMAT_SLICE = 155, // (matrix, rowRange, colRange already on stack) -> sub-matrix via two Range values\n\tRANGE_NEW = 156, // (min, max already on stack) -> push a Range value `min:max`\n\tMAP_INVOKE = 157, // map(...) — see parser/BytecodeBuilder.ts's `anonymousBodies` side-table\n\tREDUCE_INVOKE = 158, // reduce(...) — same anonymousBodies mechanism as MAP_INVOKE\n\t// An algebra verb's expression argument, evaluated with the verb's own\n\t// named unknown bound to itself (`der(x^2, x)` reads `x` as the unknown\n\t// even where the document also has a value for it). Operand = an index\n\t// into `anonymousBodies`, whose `params[0]` carries the name to bind, the\n\t// same side-table and the same call-frame shadowing MAP_INVOKE uses for a\n\t// transform body's parameters. See vm/VM.ts's handler.\n\tBIND_UNKNOWN = 159,\n\t// 159 and 160 were THEREFORE_SOLVE and STORE_EQUATION_OR_ASSIGNMENT, declared\n\t// but never emitted by any parselet nor handled in the VM switch. Both shapes\n\t// have effects (a stored equation, a direct vm.setVar()) that a cached\n\t// bytecode program cannot represent, so engine/ExpressionEngine.ts intercepts\n\t// them before compilation and always will. 159 has since been reused above;\n\t// 160 is still free.\n}\n\n// Reverse lookup built once at module load, getOpCodeName() is called once\n// per VM instruction whenever a diagnostic collector is attached (VM.ts's\n// trace path), so a per-call linear scan of every enum entry (TS numeric\n// enums are bidirectional at runtime, so Object.entries(OpCode) yields both\n// \"NOP\" -> 0 and \"0\" -> \"NOP\" style entries) would otherwise redo the same\n// scan every single traced instruction. Only the numeric-valued entries are\n// kept, the string-valued reverse entries TS also generates aren't needed\n// here.\nconst OP_CODE_NAMES: ReadonlyMap<number, string> = (() => {\n\tconst map = new Map<number, string>();\n\tfor (const [key, value] of Object.entries(OpCode)) {\n\t\tif (typeof value === \"number\") map.set(value, key);\n\t}\n\treturn map;\n})();\n\n/**\n * Gets the name of an OpCode as a string.\n * @param op The OpCode value\n * @returns The enum name as a string, or \"UNKNOWN_<value>\" if not found\n */\nexport function getOpCodeName(op: number): string {\n\treturn OP_CODE_NAMES.get(op) ?? `UNKNOWN_${op}`;\n}\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
3
|
+
var chunkYTIYVHL7_cjs = require('./chunk-YTIYVHL7.cjs');
|
|
4
|
+
var chunkQFTDTX6K_cjs = require('./chunk-QFTDTX6K.cjs');
|
|
5
|
+
var chunkB4HBEFTB_cjs = require('./chunk-B4HBEFTB.cjs');
|
|
6
6
|
|
|
7
7
|
// src/normalizer/TokenNormalizer.ts
|
|
8
8
|
var DEFAULT_OPTIONS = {
|
|
@@ -14,9 +14,9 @@ var DEFAULT_OPTIONS = {
|
|
|
14
14
|
function createFusedToken(type, text, sourceTokens) {
|
|
15
15
|
const first = sourceTokens[0];
|
|
16
16
|
const last = sourceTokens[sourceTokens.length - 1];
|
|
17
|
-
const token = new
|
|
17
|
+
const token = new chunkYTIYVHL7_cjs.LexerToken(
|
|
18
18
|
type,
|
|
19
|
-
|
|
19
|
+
chunkQFTDTX6K_cjs.tokenTypeId(type),
|
|
20
20
|
text,
|
|
21
21
|
text,
|
|
22
22
|
first.offset,
|
|
@@ -61,7 +61,7 @@ var NON_WORD_NAMES = [
|
|
|
61
61
|
"NEWLINE"
|
|
62
62
|
];
|
|
63
63
|
var NON_WORD_TABLE = (() => {
|
|
64
|
-
const ids = NON_WORD_NAMES.map((n) =>
|
|
64
|
+
const ids = NON_WORD_NAMES.map((n) => chunkQFTDTX6K_cjs.tokenTypeId(n));
|
|
65
65
|
const len = Math.max(...ids) + 1;
|
|
66
66
|
const table = new Uint8Array(len);
|
|
67
67
|
for (const id of ids) table[id] = 1;
|
|
@@ -280,7 +280,7 @@ var TokenNormalizer = class {
|
|
|
280
280
|
}
|
|
281
281
|
}
|
|
282
282
|
if (result.length > maxTokens) {
|
|
283
|
-
throw
|
|
283
|
+
throw chunkB4HBEFTB_cjs.ErrorFactory.validation(
|
|
284
284
|
"NORMALIZED_TOKEN_LIMIT_EXCEEDED",
|
|
285
285
|
`Normalized token count (${result.length}) exceeds safety limit (${maxTokens})`,
|
|
286
286
|
{ tokenCount: result.length, maxTokens }
|
|
@@ -444,9 +444,9 @@ function implicitMultiplyRule(priority = 50, canStart) {
|
|
|
444
444
|
if (RATE_DENOMINATOR_WORDS.has(nextValue) && tokens[pos + 2]?.type === "UNIT") return null;
|
|
445
445
|
const triggers = (t.type === "NUMBER" || t.type === "RPAREN") && (next.type === "IDENT" || next.type === "LPAREN" || next.type === "PI" || next.type === "E");
|
|
446
446
|
if (!triggers) return null;
|
|
447
|
-
const starToken = new
|
|
447
|
+
const starToken = new chunkYTIYVHL7_cjs.LexerToken(
|
|
448
448
|
"STAR",
|
|
449
|
-
|
|
449
|
+
chunkQFTDTX6K_cjs.tokenTypeId("STAR"),
|
|
450
450
|
"*",
|
|
451
451
|
"*",
|
|
452
452
|
next.offset,
|
|
@@ -503,5 +503,5 @@ exports.createBuiltinNormalizerRules = createBuiltinNormalizerRules;
|
|
|
503
503
|
exports.createFusedToken = createFusedToken;
|
|
504
504
|
exports.implicitMultiplyRule = implicitMultiplyRule;
|
|
505
505
|
exports.isInsideRangeContext = isInsideRangeContext;
|
|
506
|
-
//# sourceMappingURL=chunk-
|
|
507
|
-
//# sourceMappingURL=chunk-
|
|
506
|
+
//# sourceMappingURL=chunk-C75AFGVD.cjs.map
|
|
507
|
+
//# sourceMappingURL=chunk-C75AFGVD.cjs.map
|