solve-engine 1.1.0 → 1.2.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/{EngineError-B61GS1jp.d.cts → EngineError-CNA_rHY-.d.cts} +6 -0
- package/dist/{EngineError-B61GS1jp.d.ts → EngineError-CNA_rHY-.d.ts} +6 -0
- package/dist/{Lexer-BOs7euZe.d.cts → Lexer-B4C1qHXu.d.cts} +1 -1
- package/dist/{Lexer-CSI_lwbW.d.ts → Lexer-DKMlj7Sy.d.ts} +1 -1
- package/dist/{PackageCompatibility-B-7rK1TD.d.cts → PackageCompatibility-B6NX9IaN.d.cts} +1 -1
- package/dist/{PackageCompatibility-Dh59eF-X.d.ts → PackageCompatibility-Ceg5XdAp.d.ts} +1 -1
- package/dist/{PackageRegistry-BHWJP83F.d.cts → PackageRegistry-DnJYVw9G.d.cts} +55 -8
- package/dist/{PackageRegistry-_8rDlvxI.d.ts → PackageRegistry-DrCPQNyy.d.ts} +55 -8
- package/dist/{Parselet-BBT8riYh.d.ts → Parselet-Bhf7d0_W.d.ts} +2 -2
- package/dist/{Parselet-BHcgK9S7.d.cts → Parselet-Cv7S7KRt.d.cts} +2 -2
- package/dist/{ScopeManager-CxA24W5n.d.ts → ScopeManager-Bzq87GfA.d.ts} +10 -3
- package/dist/{ScopeManager-8vf02dwj.d.cts → ScopeManager-DRDBVfan.d.cts} +10 -3
- package/dist/{Token-B1hdkedD.d.cts → Token-CbP_OutD.d.cts} +9 -0
- package/dist/{Token-B1hdkedD.d.ts → Token-CbP_OutD.d.ts} +9 -0
- package/dist/{TokenNormalizer-C6VzZgHa.d.ts → TokenNormalizer-DCWdZjGz.d.ts} +1 -1
- package/dist/{TokenNormalizer-DRc1Js1V.d.cts → TokenNormalizer-DnlL7_8c.d.cts} +1 -1
- package/dist/{VMCheckpoints-MK--EBH2.d.ts → VMCheckpoints-C6c17Hbo.d.ts} +2 -2
- package/dist/{VMCheckpoints-ELYqITdF.d.cts → VMCheckpoints-dZxSMGHG.d.cts} +2 -2
- package/dist/{Value-BUi1RA3S.d.cts → Value-DZNQ_PU7.d.cts} +32 -5
- package/dist/{Value-BUi1RA3S.d.ts → Value-DZNQ_PU7.d.ts} +32 -5
- package/dist/{WorkerError-_-RkoQ5P.d.ts → WorkerError-B7t7R2-m.d.ts} +1 -1
- package/dist/{WorkerError-gzmaopj2.d.cts → WorkerError-Djd7GGGa.d.cts} +1 -1
- package/dist/{chunk-SSV46KFA.cjs → chunk-4K5W7EH2.cjs} +6 -6
- package/dist/{chunk-SSV46KFA.cjs.map → chunk-4K5W7EH2.cjs.map} +1 -1
- package/dist/{chunk-267JPOTF.js → chunk-5EFKSKMA.js} +11 -4
- package/dist/chunk-5EFKSKMA.js.map +1 -0
- package/dist/{chunk-536WPM2V.cjs → chunk-7AXJNQMF.cjs} +17 -3
- package/dist/chunk-7AXJNQMF.cjs.map +1 -0
- package/dist/{chunk-GUG7SNSV.js → chunk-7JM3F4KL.js} +39 -8
- package/dist/chunk-7JM3F4KL.js.map +1 -0
- package/dist/{chunk-XJGJCF2R.cjs → chunk-7USV76HV.cjs} +6 -6
- package/dist/{chunk-XJGJCF2R.cjs.map → chunk-7USV76HV.cjs.map} +1 -1
- package/dist/{chunk-HIQ5HSZL.cjs → chunk-A2DZ5BEJ.cjs} +53 -46
- package/dist/{chunk-HIQ5HSZL.cjs.map → chunk-A2DZ5BEJ.cjs.map} +1 -1
- package/dist/{chunk-CKQMXMHR.cjs → chunk-AKNGX4TZ.cjs} +28 -11
- package/dist/chunk-AKNGX4TZ.cjs.map +1 -0
- package/dist/{chunk-I4GAWIPW.js → chunk-AOH6UR2L.js} +6 -6
- package/dist/{chunk-I4GAWIPW.js.map → chunk-AOH6UR2L.js.map} +1 -1
- package/dist/{chunk-MG6Q3DUO.cjs → chunk-BESTLPRK.cjs} +326 -214
- package/dist/chunk-BESTLPRK.cjs.map +1 -0
- package/dist/{chunk-Z7XGGLI2.js → chunk-BSPXMGIS.js} +3 -3
- package/dist/{chunk-Z7XGGLI2.js.map → chunk-BSPXMGIS.js.map} +1 -1
- package/dist/{chunk-SRGQ72IR.cjs → chunk-C2OMO3WN.cjs} +376 -370
- package/dist/chunk-C2OMO3WN.cjs.map +1 -0
- package/dist/{chunk-G7Z4HJQA.js → chunk-CSDQMDU2.js} +4 -4
- package/dist/{chunk-G7Z4HJQA.js.map → chunk-CSDQMDU2.js.map} +1 -1
- package/dist/{chunk-7KYSUDQO.js → chunk-F4UB4XIL.js} +4 -4
- package/dist/{chunk-7KYSUDQO.js.map → chunk-F4UB4XIL.js.map} +1 -1
- package/dist/{chunk-WXEHD6TT.js → chunk-FE4RC37D.js} +15 -9
- package/dist/chunk-FE4RC37D.js.map +1 -0
- package/dist/{chunk-7ZX6B7SY.cjs → chunk-FR7RNOPT.cjs} +637 -556
- package/dist/chunk-FR7RNOPT.cjs.map +1 -0
- package/dist/{chunk-QFTDTX6K.cjs → chunk-G2YPPLGX.cjs} +29 -2
- package/dist/chunk-G2YPPLGX.cjs.map +1 -0
- package/dist/{chunk-HVRVSI2Z.cjs → chunk-GDEU72RG.cjs} +86 -86
- package/dist/{chunk-HVRVSI2Z.cjs.map → chunk-GDEU72RG.cjs.map} +1 -1
- package/dist/{chunk-OTN6SZOD.cjs → chunk-HKTQCQ4Z.cjs} +860 -489
- package/dist/chunk-HKTQCQ4Z.cjs.map +1 -0
- package/dist/{chunk-XA4CKRML.cjs → chunk-HWHU642X.cjs} +2 -2
- package/dist/{chunk-XA4CKRML.cjs.map → chunk-HWHU642X.cjs.map} +1 -1
- package/dist/{chunk-C75AFGVD.cjs → chunk-ICEKS6YC.cjs} +11 -11
- package/dist/{chunk-C75AFGVD.cjs.map → chunk-ICEKS6YC.cjs.map} +1 -1
- package/dist/{chunk-JIPATHVY.js → chunk-IJGOFP2J.js} +138 -26
- package/dist/chunk-IJGOFP2J.js.map +1 -0
- package/dist/{chunk-ENKKJYD3.js → chunk-IQJGDZOP.js} +4 -4
- package/dist/{chunk-ENKKJYD3.js.map → chunk-IQJGDZOP.js.map} +1 -1
- package/dist/{chunk-2TZKENDH.cjs → chunk-IT74O4BE.cjs} +15 -7
- package/dist/chunk-IT74O4BE.cjs.map +1 -0
- package/dist/{chunk-ZVTWQLK4.cjs → chunk-KXDQKVNX.cjs} +10 -10
- package/dist/{chunk-ZVTWQLK4.cjs.map → chunk-KXDQKVNX.cjs.map} +1 -1
- package/dist/{chunk-JJIXHXFQ.js → chunk-L5YHV6BQ.js} +5 -5
- package/dist/{chunk-JJIXHXFQ.js.map → chunk-L5YHV6BQ.js.map} +1 -1
- package/dist/{chunk-ZXCESUJS.cjs → chunk-LO7HU5WB.cjs} +8 -8
- package/dist/{chunk-ZXCESUJS.cjs.map → chunk-LO7HU5WB.cjs.map} +1 -1
- package/dist/{chunk-UO6BUV6K.js → chunk-LSALB3IN.js} +17 -3
- package/dist/chunk-LSALB3IN.js.map +1 -0
- package/dist/{chunk-J45BCEZ4.cjs → chunk-MI7OTUHL.cjs} +27 -27
- package/dist/{chunk-J45BCEZ4.cjs.map → chunk-MI7OTUHL.cjs.map} +1 -1
- package/dist/{chunk-B4HBEFTB.cjs → chunk-MIGXCBXT.cjs} +8 -2
- package/dist/chunk-MIGXCBXT.cjs.map +1 -0
- package/dist/{chunk-ERCOHGXD.js → chunk-N7OA4WPJ.js} +8 -2
- package/dist/chunk-N7OA4WPJ.js.map +1 -0
- package/dist/{chunk-4D6NIHE2.js → chunk-NAWZATKT.js} +29 -2
- package/dist/chunk-NAWZATKT.js.map +1 -0
- package/dist/{chunk-GQMUHVE3.js → chunk-ORM7CHYZ.js} +36 -5
- package/dist/chunk-ORM7CHYZ.js.map +1 -0
- package/dist/{chunk-B7NLZMQ3.cjs → chunk-PCZVMMWU.cjs} +8 -8
- package/dist/{chunk-B7NLZMQ3.cjs.map → chunk-PCZVMMWU.cjs.map} +1 -1
- package/dist/{chunk-OADDUPT3.js → chunk-RNKDIXDV.js} +4 -4
- package/dist/{chunk-OADDUPT3.js.map → chunk-RNKDIXDV.js.map} +1 -1
- package/dist/{chunk-SNHVVOJK.cjs → chunk-TC6BTUSU.cjs} +55 -24
- package/dist/chunk-TC6BTUSU.cjs.map +1 -0
- package/dist/{chunk-RRLHC37V.js → chunk-TPOK3UNI.js} +387 -17
- package/dist/chunk-TPOK3UNI.js.map +1 -0
- package/dist/{chunk-CCBZZQAE.js → chunk-UF6JG5SG.js} +2 -2
- package/dist/{chunk-CCBZZQAE.js.map → chunk-UF6JG5SG.js.map} +1 -1
- package/dist/{chunk-NKW7LKYU.js → chunk-WMQRJTAO.js} +88 -7
- package/dist/chunk-WMQRJTAO.js.map +1 -0
- package/dist/{chunk-YTIYVHL7.cjs → chunk-YJHY7CMN.cjs} +108 -77
- package/dist/chunk-YJHY7CMN.cjs.map +1 -0
- package/dist/{chunk-3OWCDIPN.js → chunk-YNIWOYW6.js} +21 -4
- package/dist/chunk-YNIWOYW6.js.map +1 -0
- package/dist/{chunk-WWQEY7BV.js → chunk-ZN6YYPIW.js} +3 -3
- package/dist/{chunk-WWQEY7BV.js.map → chunk-ZN6YYPIW.js.map} +1 -1
- package/dist/{chunk-NNQ2TYDF.js → chunk-ZNFFTYWH.js} +11 -5
- package/dist/chunk-ZNFFTYWH.js.map +1 -0
- package/dist/constants.cjs +5 -5
- package/dist/constants.js +2 -2
- package/dist/engine.cjs +33 -33
- package/dist/engine.d.cts +27 -11
- package/dist/engine.d.ts +27 -11
- package/dist/engine.js +20 -20
- package/dist/errors.cjs +26 -26
- package/dist/errors.d.cts +3 -3
- package/dist/errors.d.ts +3 -3
- package/dist/errors.js +2 -2
- package/dist/format.cjs +7 -7
- package/dist/format.d.cts +1 -1
- package/dist/format.d.ts +1 -1
- package/dist/format.js +4 -4
- package/dist/index.cjs +48 -48
- package/dist/index.d.cts +11 -11
- package/dist/index.d.ts +11 -11
- package/dist/index.js +21 -21
- package/dist/language.cjs +7 -7
- package/dist/language.d.cts +10 -10
- package/dist/language.d.ts +10 -10
- package/dist/language.js +2 -2
- 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 +40 -36
- package/dist/packages.d.cts +37 -11
- package/dist/packages.d.ts +37 -11
- package/dist/packages.js +11 -11
- package/dist/parser.cjs +13 -13
- package/dist/parser.d.cts +4 -4
- package/dist/parser.d.ts +4 -4
- package/dist/parser.js +5 -5
- package/dist/{pipeline-CtfJtPQc.d.cts → pipeline-D-PS9gVw.d.ts} +3 -3
- package/dist/{pipeline-DCd5M6Gk.d.ts → pipeline-DtSBJ8TS.d.cts} +3 -3
- package/dist/resolvers.d.cts +2 -2
- package/dist/resolvers.d.ts +2 -2
- package/dist/testing.cjs +26 -26
- package/dist/testing.d.cts +10 -10
- package/dist/testing.d.ts +10 -10
- package/dist/testing.js +19 -19
- package/dist/uom.cjs +8 -8
- package/dist/uom.d.cts +2 -2
- package/dist/uom.d.ts +2 -2
- package/dist/uom.js +4 -4
- package/dist/vm.cjs +32 -32
- package/dist/vm.d.cts +7 -7
- package/dist/vm.d.ts +7 -7
- package/dist/vm.js +7 -7
- package/dist/worker.cjs +38 -38
- package/dist/worker.d.cts +10 -10
- package/dist/worker.d.ts +10 -10
- package/dist/worker.js +20 -20
- package/package.json +1 -1
- package/dist/chunk-267JPOTF.js.map +0 -1
- package/dist/chunk-2TZKENDH.cjs.map +0 -1
- package/dist/chunk-3OWCDIPN.js.map +0 -1
- package/dist/chunk-4D6NIHE2.js.map +0 -1
- package/dist/chunk-536WPM2V.cjs.map +0 -1
- package/dist/chunk-7ZX6B7SY.cjs.map +0 -1
- package/dist/chunk-B4HBEFTB.cjs.map +0 -1
- package/dist/chunk-CKQMXMHR.cjs.map +0 -1
- package/dist/chunk-ERCOHGXD.js.map +0 -1
- package/dist/chunk-GQMUHVE3.js.map +0 -1
- package/dist/chunk-GUG7SNSV.js.map +0 -1
- package/dist/chunk-JIPATHVY.js.map +0 -1
- package/dist/chunk-MG6Q3DUO.cjs.map +0 -1
- package/dist/chunk-NKW7LKYU.js.map +0 -1
- package/dist/chunk-NNQ2TYDF.js.map +0 -1
- package/dist/chunk-OTN6SZOD.cjs.map +0 -1
- package/dist/chunk-QFTDTX6K.cjs.map +0 -1
- package/dist/chunk-RRLHC37V.js.map +0 -1
- package/dist/chunk-SNHVVOJK.cjs.map +0 -1
- package/dist/chunk-SRGQ72IR.cjs.map +0 -1
- package/dist/chunk-UO6BUV6K.js.map +0 -1
- package/dist/chunk-WXEHD6TT.js.map +0 -1
- package/dist/chunk-YTIYVHL7.cjs.map +0 -1
|
@@ -154,6 +154,12 @@ declare const CoreErrorCodes: {
|
|
|
154
154
|
readonly THEREFORE_REQUIRES_EXPRESSION: "THEREFORE_REQUIRES_EXPRESSION";
|
|
155
155
|
/** A `"=>"`-triggered expression called an async plugin (weather/stocks/currency). Same v1 scope restriction as user-function/map-reduce bodies. */
|
|
156
156
|
readonly THEREFORE_ASYNC_UNSUPPORTED: "THEREFORE_ASYNC_UNSUPPORTED";
|
|
157
|
+
/** A compound assignment (`name += expr` / `name -= expr`) with nothing on the right, a line half-typed on the way to `total += 5`. */
|
|
158
|
+
readonly COMPOUND_ASSIGN_REQUIRES_EXPRESSION: "COMPOUND_ASSIGN_REQUIRES_EXPRESSION";
|
|
159
|
+
/** A running total (`+= / -=`) whose right-hand side calls an async plugin (weather/stocks/currency). The same v1 scope restriction as the `"=>"` and user-function bodies. */
|
|
160
|
+
readonly COMPOUND_ASSIGN_ASYNC_UNSUPPORTED: "COMPOUND_ASSIGN_ASYNC_UNSUPPORTED";
|
|
161
|
+
/** A savings-goal contribution period that is not one of daily/weekly/monthly/yearly (`how long to save $X at $Y <period>`). Names the accepted set. */
|
|
162
|
+
readonly UNKNOWN_SAVINGS_PERIOD: "UNKNOWN_SAVINGS_PERIOD";
|
|
157
163
|
/** 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. */
|
|
158
164
|
readonly INVALID_TIME_LITERAL: "INVALID_TIME_LITERAL";
|
|
159
165
|
/** `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()`. */
|
|
@@ -154,6 +154,12 @@ declare const CoreErrorCodes: {
|
|
|
154
154
|
readonly THEREFORE_REQUIRES_EXPRESSION: "THEREFORE_REQUIRES_EXPRESSION";
|
|
155
155
|
/** A `"=>"`-triggered expression called an async plugin (weather/stocks/currency). Same v1 scope restriction as user-function/map-reduce bodies. */
|
|
156
156
|
readonly THEREFORE_ASYNC_UNSUPPORTED: "THEREFORE_ASYNC_UNSUPPORTED";
|
|
157
|
+
/** A compound assignment (`name += expr` / `name -= expr`) with nothing on the right, a line half-typed on the way to `total += 5`. */
|
|
158
|
+
readonly COMPOUND_ASSIGN_REQUIRES_EXPRESSION: "COMPOUND_ASSIGN_REQUIRES_EXPRESSION";
|
|
159
|
+
/** A running total (`+= / -=`) whose right-hand side calls an async plugin (weather/stocks/currency). The same v1 scope restriction as the `"=>"` and user-function bodies. */
|
|
160
|
+
readonly COMPOUND_ASSIGN_ASYNC_UNSUPPORTED: "COMPOUND_ASSIGN_ASYNC_UNSUPPORTED";
|
|
161
|
+
/** A savings-goal contribution period that is not one of daily/weekly/monthly/yearly (`how long to save $X at $Y <period>`). Names the accepted set. */
|
|
162
|
+
readonly UNKNOWN_SAVINGS_PERIOD: "UNKNOWN_SAVINGS_PERIOD";
|
|
157
163
|
/** 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. */
|
|
158
164
|
readonly INVALID_TIME_LITERAL: "INVALID_TIME_LITERAL";
|
|
159
165
|
/** `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()`. */
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { a as PrecedenceParser, b as PrefixParselet, I as InfixParselet } from './Parselet-
|
|
2
|
-
import { V as Value, b as ValueType } from './Value-
|
|
1
|
+
import { a as PrecedenceParser, b as PrefixParselet, I as InfixParselet } from './Parselet-Cv7S7KRt.cjs';
|
|
2
|
+
import { V as Value, b as ValueType } from './Value-DZNQ_PU7.cjs';
|
|
3
3
|
import { IVariableSource } from './variables.cjs';
|
|
4
|
-
import { M as MarkdownLineType, L as Lexer, e as TokenCategory, c as LexerVocabulary } from './Lexer-
|
|
4
|
+
import { M as MarkdownLineType, L as Lexer, e as TokenCategory, c as LexerVocabulary } from './Lexer-B4C1qHXu.cjs';
|
|
5
5
|
import { IAsyncResolver } from './resolvers.cjs';
|
|
6
|
-
import { T as TokenFusion, c as TokenNormalizer, a as NormalizerRule } from './TokenNormalizer-
|
|
7
|
-
import { a as DependencyGraph, V as VM, D as DagSnapshot, b as EngineContext, S as ScopeManager, L as LineExecutionContext } from './ScopeManager-
|
|
6
|
+
import { T as TokenFusion, c as TokenNormalizer, a as NormalizerRule } from './TokenNormalizer-DnlL7_8c.cjs';
|
|
7
|
+
import { a as DependencyGraph, V as VM, D as DagSnapshot, b as EngineContext, S as ScopeManager, L as LineExecutionContext } from './ScopeManager-DRDBVfan.cjs';
|
|
8
8
|
import { a as BytecodeProgram } from './BytecodeBuilder-Bp9xeTmX.cjs';
|
|
9
9
|
import { QueryClient } from '@tanstack/query-core';
|
|
10
|
-
import { E as EngineError } from './EngineError-
|
|
11
|
-
import { a as DiagnosticReportJSON, D as DiagnosticPipeline } from './pipeline-
|
|
12
|
-
import { T as Token } from './Token-
|
|
10
|
+
import { E as EngineError } from './EngineError-CNA_rHY-.cjs';
|
|
11
|
+
import { a as DiagnosticReportJSON, D as DiagnosticPipeline } from './pipeline-DtSBJ8TS.cjs';
|
|
12
|
+
import { T as Token } from './Token-CbP_OutD.cjs';
|
|
13
13
|
import { D as DEFAULT_CONFIG, E as EngineConfig } from './Configuration-C9W8tJv_.cjs';
|
|
14
14
|
|
|
15
15
|
/**
|
|
@@ -1522,6 +1522,14 @@ interface LineEvaluation {
|
|
|
1522
1522
|
declare class ExpressionEngine {
|
|
1523
1523
|
private dag;
|
|
1524
1524
|
private lineCache;
|
|
1525
|
+
/**
|
|
1526
|
+
* Names ever used as a running-total target (`total += 5`). A document is
|
|
1527
|
+
* re-parsed top-to-bottom on every keystroke, so each accumulator is reset
|
|
1528
|
+
* to undefined at the start of a batch pass and re-seeds from its opening
|
|
1529
|
+
* `+=`/`-=` this pass, rather than reading its own previous pass's value
|
|
1530
|
+
* (which grew the total without bound). See {@link tryCompoundAssignment}.
|
|
1531
|
+
*/
|
|
1532
|
+
private accumulatorNames;
|
|
1525
1533
|
private scopeManager;
|
|
1526
1534
|
private lexer;
|
|
1527
1535
|
private registry;
|
|
@@ -1993,6 +2001,45 @@ declare class ExpressionEngine {
|
|
|
1993
2001
|
* tolerated and skipped.
|
|
1994
2002
|
*/
|
|
1995
2003
|
private tryDefineUserUnit;
|
|
2004
|
+
/**
|
|
2005
|
+
* `name += expr` / `name -= expr`, a running total. The accumulator reads
|
|
2006
|
+
* its current value, adds or subtracts the right-hand side, stores the
|
|
2007
|
+
* result, and answers with the new value, so a note becomes a live ledger
|
|
2008
|
+
* where each line adjusts a balance in place. Returns null to decline
|
|
2009
|
+
* anything that is not the compound shape.
|
|
2010
|
+
*
|
|
2011
|
+
* Handled here, in the same effectful, cache-bypassing channel as
|
|
2012
|
+
* {@link tryDefineUserUnit} and the bare `count = 10` assignment (see
|
|
2013
|
+
* {@link trySymbolicGrammar}), rather than as a parselet: a bare identifier
|
|
2014
|
+
* is a Tier-1 prefix that emits `LOAD_VAR name` before any infix parselet on
|
|
2015
|
+
* `+=` could run, and that pre-emitted load throws UNDEFINED_VARIABLE for a
|
|
2016
|
+
* first-use accumulator. Seeding 0 for a first `+=`/`-=` is a one-line
|
|
2017
|
+
* `getVar`/`setVar` here where it cannot be from a parselet, a deliberate
|
|
2018
|
+
* departure from a plain reference, which still reports the undefined name.
|
|
2019
|
+
*
|
|
2020
|
+
* The right-hand side is parenthesised and run through the ORDINARY (not
|
|
2021
|
+
* symbolic-tolerant) path, so `bal += 3 * 4` is `bal + 12`, a genuine typo in
|
|
2022
|
+
* it (`total += nope`) is a real UNDEFINED_VARIABLE, and the accumulation
|
|
2023
|
+
* goes through the VM's own ADD/SUB: money stays money, a unit stays its
|
|
2024
|
+
* unit, and the seed 0 added to a typed right-hand side takes that type on
|
|
2025
|
+
* first use. The colon (`:name`) and `global :name` grammars are untouched:
|
|
2026
|
+
* they lex their own leading token, never IDENT/UNIT, so they decline here.
|
|
2027
|
+
*/
|
|
2028
|
+
private tryCompoundAssignment;
|
|
2029
|
+
/**
|
|
2030
|
+
* Reset every running-total accumulator (`total += 5`) to undefined, and
|
|
2031
|
+
* return their names.
|
|
2032
|
+
*
|
|
2033
|
+
* An accumulator seeds 0 only while its name is undefined, then reads that
|
|
2034
|
+
* value on each `+=`/`-=`. A document is re-evaluated top-to-bottom on
|
|
2035
|
+
* every keystroke, so unless the name is cleared first the total reads its
|
|
2036
|
+
* own previous evaluation's value and grows without bound. The batch
|
|
2037
|
+
* document pass (`parseDocument`/`evaluateLines`) calls this at the start
|
|
2038
|
+
* of each pass; the incremental {@link ThreeTierEvaluator} calls it and
|
|
2039
|
+
* then marks the lines that touch each name dirty, since it re-runs lines
|
|
2040
|
+
* selectively rather than replaying the whole document.
|
|
2041
|
+
*/
|
|
2042
|
+
resetAccumulators(): ReadonlySet<string>;
|
|
1996
2043
|
private trySymbolicGrammar;
|
|
1997
2044
|
/**
|
|
1998
2045
|
* Stores a general scalar equation (`x^2 - 4 = 0`) keyed by its unknown, or
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { a as PrecedenceParser, b as PrefixParselet, I as InfixParselet } from './Parselet-
|
|
2
|
-
import { V as Value, b as ValueType } from './Value-
|
|
1
|
+
import { a as PrecedenceParser, b as PrefixParselet, I as InfixParselet } from './Parselet-Bhf7d0_W.js';
|
|
2
|
+
import { V as Value, b as ValueType } from './Value-DZNQ_PU7.js';
|
|
3
3
|
import { IVariableSource } from './variables.js';
|
|
4
|
-
import { M as MarkdownLineType, L as Lexer, e as TokenCategory, c as LexerVocabulary } from './Lexer-
|
|
4
|
+
import { M as MarkdownLineType, L as Lexer, e as TokenCategory, c as LexerVocabulary } from './Lexer-DKMlj7Sy.js';
|
|
5
5
|
import { IAsyncResolver } from './resolvers.js';
|
|
6
|
-
import { T as TokenFusion, c as TokenNormalizer, a as NormalizerRule } from './TokenNormalizer-
|
|
7
|
-
import { a as DependencyGraph, V as VM, D as DagSnapshot, b as EngineContext, S as ScopeManager, L as LineExecutionContext } from './ScopeManager-
|
|
6
|
+
import { T as TokenFusion, c as TokenNormalizer, a as NormalizerRule } from './TokenNormalizer-DCWdZjGz.js';
|
|
7
|
+
import { a as DependencyGraph, V as VM, D as DagSnapshot, b as EngineContext, S as ScopeManager, L as LineExecutionContext } from './ScopeManager-Bzq87GfA.js';
|
|
8
8
|
import { a as BytecodeProgram } from './BytecodeBuilder-Bp9xeTmX.js';
|
|
9
9
|
import { QueryClient } from '@tanstack/query-core';
|
|
10
|
-
import { E as EngineError } from './EngineError-
|
|
11
|
-
import { a as DiagnosticReportJSON, D as DiagnosticPipeline } from './pipeline-
|
|
12
|
-
import { T as Token } from './Token-
|
|
10
|
+
import { E as EngineError } from './EngineError-CNA_rHY-.js';
|
|
11
|
+
import { a as DiagnosticReportJSON, D as DiagnosticPipeline } from './pipeline-D-PS9gVw.js';
|
|
12
|
+
import { T as Token } from './Token-CbP_OutD.js';
|
|
13
13
|
import { D as DEFAULT_CONFIG, E as EngineConfig } from './Configuration-C9W8tJv_.js';
|
|
14
14
|
|
|
15
15
|
/**
|
|
@@ -1522,6 +1522,14 @@ interface LineEvaluation {
|
|
|
1522
1522
|
declare class ExpressionEngine {
|
|
1523
1523
|
private dag;
|
|
1524
1524
|
private lineCache;
|
|
1525
|
+
/**
|
|
1526
|
+
* Names ever used as a running-total target (`total += 5`). A document is
|
|
1527
|
+
* re-parsed top-to-bottom on every keystroke, so each accumulator is reset
|
|
1528
|
+
* to undefined at the start of a batch pass and re-seeds from its opening
|
|
1529
|
+
* `+=`/`-=` this pass, rather than reading its own previous pass's value
|
|
1530
|
+
* (which grew the total without bound). See {@link tryCompoundAssignment}.
|
|
1531
|
+
*/
|
|
1532
|
+
private accumulatorNames;
|
|
1525
1533
|
private scopeManager;
|
|
1526
1534
|
private lexer;
|
|
1527
1535
|
private registry;
|
|
@@ -1993,6 +2001,45 @@ declare class ExpressionEngine {
|
|
|
1993
2001
|
* tolerated and skipped.
|
|
1994
2002
|
*/
|
|
1995
2003
|
private tryDefineUserUnit;
|
|
2004
|
+
/**
|
|
2005
|
+
* `name += expr` / `name -= expr`, a running total. The accumulator reads
|
|
2006
|
+
* its current value, adds or subtracts the right-hand side, stores the
|
|
2007
|
+
* result, and answers with the new value, so a note becomes a live ledger
|
|
2008
|
+
* where each line adjusts a balance in place. Returns null to decline
|
|
2009
|
+
* anything that is not the compound shape.
|
|
2010
|
+
*
|
|
2011
|
+
* Handled here, in the same effectful, cache-bypassing channel as
|
|
2012
|
+
* {@link tryDefineUserUnit} and the bare `count = 10` assignment (see
|
|
2013
|
+
* {@link trySymbolicGrammar}), rather than as a parselet: a bare identifier
|
|
2014
|
+
* is a Tier-1 prefix that emits `LOAD_VAR name` before any infix parselet on
|
|
2015
|
+
* `+=` could run, and that pre-emitted load throws UNDEFINED_VARIABLE for a
|
|
2016
|
+
* first-use accumulator. Seeding 0 for a first `+=`/`-=` is a one-line
|
|
2017
|
+
* `getVar`/`setVar` here where it cannot be from a parselet, a deliberate
|
|
2018
|
+
* departure from a plain reference, which still reports the undefined name.
|
|
2019
|
+
*
|
|
2020
|
+
* The right-hand side is parenthesised and run through the ORDINARY (not
|
|
2021
|
+
* symbolic-tolerant) path, so `bal += 3 * 4` is `bal + 12`, a genuine typo in
|
|
2022
|
+
* it (`total += nope`) is a real UNDEFINED_VARIABLE, and the accumulation
|
|
2023
|
+
* goes through the VM's own ADD/SUB: money stays money, a unit stays its
|
|
2024
|
+
* unit, and the seed 0 added to a typed right-hand side takes that type on
|
|
2025
|
+
* first use. The colon (`:name`) and `global :name` grammars are untouched:
|
|
2026
|
+
* they lex their own leading token, never IDENT/UNIT, so they decline here.
|
|
2027
|
+
*/
|
|
2028
|
+
private tryCompoundAssignment;
|
|
2029
|
+
/**
|
|
2030
|
+
* Reset every running-total accumulator (`total += 5`) to undefined, and
|
|
2031
|
+
* return their names.
|
|
2032
|
+
*
|
|
2033
|
+
* An accumulator seeds 0 only while its name is undefined, then reads that
|
|
2034
|
+
* value on each `+=`/`-=`. A document is re-evaluated top-to-bottom on
|
|
2035
|
+
* every keystroke, so unless the name is cleared first the total reads its
|
|
2036
|
+
* own previous evaluation's value and grows without bound. The batch
|
|
2037
|
+
* document pass (`parseDocument`/`evaluateLines`) calls this at the start
|
|
2038
|
+
* of each pass; the incremental {@link ThreeTierEvaluator} calls it and
|
|
2039
|
+
* then marks the lines that touch each name dirty, since it re-runs lines
|
|
2040
|
+
* selectively rather than replaying the whole document.
|
|
2041
|
+
*/
|
|
2042
|
+
resetAccumulators(): ReadonlySet<string>;
|
|
1996
2043
|
private trySymbolicGrammar;
|
|
1997
2044
|
/**
|
|
1998
2045
|
* Stores a general scalar equation (`x^2 - 4 = 0`) keyed by its unknown, or
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { B as BytecodeBuilder } from './BytecodeBuilder-Bp9xeTmX.js';
|
|
2
|
-
import { T as Token } from './Token-
|
|
3
|
-
import { D as DiagnosticPipeline } from './pipeline-
|
|
2
|
+
import { T as Token } from './Token-CbP_OutD.js';
|
|
3
|
+
import { D as DiagnosticPipeline } from './pipeline-D-PS9gVw.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Dual-keyed ParseletRegistry, accepts both string token types and
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { B as BytecodeBuilder } from './BytecodeBuilder-Bp9xeTmX.cjs';
|
|
2
|
-
import { T as Token } from './Token-
|
|
3
|
-
import { D as DiagnosticPipeline } from './pipeline-
|
|
2
|
+
import { T as Token } from './Token-CbP_OutD.cjs';
|
|
3
|
+
import { D as DiagnosticPipeline } from './pipeline-DtSBJ8TS.cjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Dual-keyed ParseletRegistry, accepts both string token types and
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { V as Value } from './Value-
|
|
1
|
+
import { V as Value } from './Value-DZNQ_PU7.js';
|
|
2
2
|
import { U as UserFunctionDef, A as AnonymousBodyDef, a as BytecodeProgram } from './BytecodeBuilder-Bp9xeTmX.js';
|
|
3
|
-
import { E as EngineError } from './EngineError-
|
|
4
|
-
import { D as DiagnosticPipeline } from './pipeline-
|
|
3
|
+
import { E as EngineError } from './EngineError-CNA_rHY-.js';
|
|
4
|
+
import { D as DiagnosticPipeline } from './pipeline-D-PS9gVw.js';
|
|
5
5
|
import { VariableResolver } from './variables.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -402,6 +402,13 @@ interface VM {
|
|
|
402
402
|
*/
|
|
403
403
|
getVar(key: string): Value | undefined;
|
|
404
404
|
setVar(key: string, value: Value): void;
|
|
405
|
+
/**
|
|
406
|
+
* Remove a top-level variable binding. Used at the start of each document
|
|
407
|
+
* pass to re-seed accumulators (`total += 5`): a running total must reset
|
|
408
|
+
* to its seed each full re-parse, otherwise it reads its own previous
|
|
409
|
+
* pass's value and grows without bound on every keystroke.
|
|
410
|
+
*/
|
|
411
|
+
deleteVar(key: string): void;
|
|
405
412
|
/**
|
|
406
413
|
* User-defined-function call frame, a name-keyed `Map` of this call's
|
|
407
414
|
* bound arguments, PUSHED before `CALL_USER_FUNCTION` executes the
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { V as Value } from './Value-
|
|
1
|
+
import { V as Value } from './Value-DZNQ_PU7.cjs';
|
|
2
2
|
import { U as UserFunctionDef, A as AnonymousBodyDef, a as BytecodeProgram } from './BytecodeBuilder-Bp9xeTmX.cjs';
|
|
3
|
-
import { E as EngineError } from './EngineError-
|
|
4
|
-
import { D as DiagnosticPipeline } from './pipeline-
|
|
3
|
+
import { E as EngineError } from './EngineError-CNA_rHY-.cjs';
|
|
4
|
+
import { D as DiagnosticPipeline } from './pipeline-DtSBJ8TS.cjs';
|
|
5
5
|
import { VariableResolver } from './variables.cjs';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -402,6 +402,13 @@ interface VM {
|
|
|
402
402
|
*/
|
|
403
403
|
getVar(key: string): Value | undefined;
|
|
404
404
|
setVar(key: string, value: Value): void;
|
|
405
|
+
/**
|
|
406
|
+
* Remove a top-level variable binding. Used at the start of each document
|
|
407
|
+
* pass to re-seed accumulators (`total += 5`): a running total must reset
|
|
408
|
+
* to its seed each full re-parse, otherwise it reads its own previous
|
|
409
|
+
* pass's value and grows without bound on every keystroke.
|
|
410
|
+
*/
|
|
411
|
+
deleteVar(key: string): void;
|
|
405
412
|
/**
|
|
406
413
|
* User-defined-function call frame, a name-keyed `Map` of this call's
|
|
407
414
|
* bound arguments, PUSHED before `CALL_USER_FUNCTION` executes the
|
|
@@ -46,6 +46,8 @@ declare const TokenTypes: {
|
|
|
46
46
|
readonly IDENT: "IDENT";
|
|
47
47
|
readonly PLUS: "PLUS";
|
|
48
48
|
readonly MINUS: "MINUS";
|
|
49
|
+
readonly PLUS_EQUALS: "PLUS_EQUALS";
|
|
50
|
+
readonly MINUS_EQUALS: "MINUS_EQUALS";
|
|
49
51
|
readonly STAR: "STAR";
|
|
50
52
|
readonly SLASH: "SLASH";
|
|
51
53
|
readonly PLUS_MINUS: "PLUS_MINUS";
|
|
@@ -115,6 +117,10 @@ declare const TokenTypes: {
|
|
|
115
117
|
readonly UNTIL: "UNTIL";
|
|
116
118
|
readonly SINCE: "SINCE";
|
|
117
119
|
readonly BETWEEN: "BETWEEN";
|
|
120
|
+
readonly SPLIT: "SPLIT";
|
|
121
|
+
readonly SPLIT_WAYS: "SPLIT_WAYS";
|
|
122
|
+
readonly WAYS: "WAYS";
|
|
123
|
+
readonly PEOPLE: "PEOPLE";
|
|
118
124
|
readonly FROM: "FROM";
|
|
119
125
|
readonly INCREASE: "INCREASE";
|
|
120
126
|
readonly DECREASE: "DECREASE";
|
|
@@ -196,6 +202,7 @@ declare const TokenTypes: {
|
|
|
196
202
|
readonly INLINE_SOLVE_START: "INLINE_SOLVE_START";
|
|
197
203
|
readonly COMMENT: "COMMENT";
|
|
198
204
|
readonly HEX_COLOUR: "HEX_COLOUR";
|
|
205
|
+
readonly TAG: "TAG";
|
|
199
206
|
readonly COLOUR_CALL: "COLOUR_CALL";
|
|
200
207
|
readonly VEC2: "VEC2";
|
|
201
208
|
readonly VEC3: "VEC3";
|
|
@@ -228,6 +235,8 @@ declare const TokenTypes: {
|
|
|
228
235
|
readonly WHAT_WAS: "WHAT_WAS";
|
|
229
236
|
readonly VALUE_OF: "VALUE_OF";
|
|
230
237
|
readonly WORTH_IN: "WORTH_IN";
|
|
238
|
+
readonly SAVINGS_HOW_LONG: "SAVINGS_HOW_LONG";
|
|
239
|
+
readonly SAVINGS_HOW_MUCH: "SAVINGS_HOW_MUCH";
|
|
231
240
|
readonly ASSUMING: "ASSUMING";
|
|
232
241
|
readonly IN_YEAR_DOLLARS: "IN_YEAR_DOLLARS";
|
|
233
242
|
readonly INGREDIENT_NAME: "INGREDIENT_NAME";
|
|
@@ -46,6 +46,8 @@ declare const TokenTypes: {
|
|
|
46
46
|
readonly IDENT: "IDENT";
|
|
47
47
|
readonly PLUS: "PLUS";
|
|
48
48
|
readonly MINUS: "MINUS";
|
|
49
|
+
readonly PLUS_EQUALS: "PLUS_EQUALS";
|
|
50
|
+
readonly MINUS_EQUALS: "MINUS_EQUALS";
|
|
49
51
|
readonly STAR: "STAR";
|
|
50
52
|
readonly SLASH: "SLASH";
|
|
51
53
|
readonly PLUS_MINUS: "PLUS_MINUS";
|
|
@@ -115,6 +117,10 @@ declare const TokenTypes: {
|
|
|
115
117
|
readonly UNTIL: "UNTIL";
|
|
116
118
|
readonly SINCE: "SINCE";
|
|
117
119
|
readonly BETWEEN: "BETWEEN";
|
|
120
|
+
readonly SPLIT: "SPLIT";
|
|
121
|
+
readonly SPLIT_WAYS: "SPLIT_WAYS";
|
|
122
|
+
readonly WAYS: "WAYS";
|
|
123
|
+
readonly PEOPLE: "PEOPLE";
|
|
118
124
|
readonly FROM: "FROM";
|
|
119
125
|
readonly INCREASE: "INCREASE";
|
|
120
126
|
readonly DECREASE: "DECREASE";
|
|
@@ -196,6 +202,7 @@ declare const TokenTypes: {
|
|
|
196
202
|
readonly INLINE_SOLVE_START: "INLINE_SOLVE_START";
|
|
197
203
|
readonly COMMENT: "COMMENT";
|
|
198
204
|
readonly HEX_COLOUR: "HEX_COLOUR";
|
|
205
|
+
readonly TAG: "TAG";
|
|
199
206
|
readonly COLOUR_CALL: "COLOUR_CALL";
|
|
200
207
|
readonly VEC2: "VEC2";
|
|
201
208
|
readonly VEC3: "VEC3";
|
|
@@ -228,6 +235,8 @@ declare const TokenTypes: {
|
|
|
228
235
|
readonly WHAT_WAS: "WHAT_WAS";
|
|
229
236
|
readonly VALUE_OF: "VALUE_OF";
|
|
230
237
|
readonly WORTH_IN: "WORTH_IN";
|
|
238
|
+
readonly SAVINGS_HOW_LONG: "SAVINGS_HOW_LONG";
|
|
239
|
+
readonly SAVINGS_HOW_MUCH: "SAVINGS_HOW_MUCH";
|
|
231
240
|
readonly ASSUMING: "ASSUMING";
|
|
232
241
|
readonly IN_YEAR_DOLLARS: "IN_YEAR_DOLLARS";
|
|
233
242
|
readonly INGREDIENT_NAME: "INGREDIENT_NAME";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { V as Value } from './Value-
|
|
2
|
-
import { V as VM } from './ScopeManager-
|
|
1
|
+
import { V as Value } from './Value-DZNQ_PU7.js';
|
|
2
|
+
import { V as VM } from './ScopeManager-Bzq87GfA.js';
|
|
3
3
|
import { U as UserFunctionDef } from './BytecodeBuilder-Bp9xeTmX.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { V as Value } from './Value-
|
|
2
|
-
import { V as VM } from './ScopeManager-
|
|
1
|
+
import { V as Value } from './Value-DZNQ_PU7.cjs';
|
|
2
|
+
import { V as VM } from './ScopeManager-DRDBVfan.cjs';
|
|
3
3
|
import { U as UserFunctionDef } from './BytecodeBuilder-Bp9xeTmX.cjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -218,6 +218,31 @@ interface ColourData {
|
|
|
218
218
|
readonly format: ColourFormat;
|
|
219
219
|
readonly name?: string;
|
|
220
220
|
}
|
|
221
|
+
/**
|
|
222
|
+
* One tier of a bill split: an amount and how many people pay it. An even
|
|
223
|
+
* split is a single share; the odd-penny case is two shares (the base amount
|
|
224
|
+
* most people pay, then the base plus a cent that the remaining `count` pay),
|
|
225
|
+
* so the shares always add back to the exact total. `exact` carries the
|
|
226
|
+
* base-ten cents of a currency share so display rounds from the decimal rather
|
|
227
|
+
* than a drifted double, exactly as money does everywhere else.
|
|
228
|
+
*/
|
|
229
|
+
interface SplitShare {
|
|
230
|
+
readonly value: number;
|
|
231
|
+
readonly exact?: DecimalData;
|
|
232
|
+
readonly count: number;
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* The result of a per-person bill split (`split $180 between 4`). `unit` is the
|
|
236
|
+
* currency code when the amount was money, undefined for a bare number.
|
|
237
|
+
* `shares` is ordered base-first: `shares[0]` is the "each" amount, and a
|
|
238
|
+
* second share, when present, is the slightly larger amount the odd penny falls
|
|
239
|
+
* on. Lives in a {@link Value}'s `value` slot exactly as {@link ColourData} and
|
|
240
|
+
* {@link RangeData} do, a display-only payload the formatter renders.
|
|
241
|
+
*/
|
|
242
|
+
interface SplitData {
|
|
243
|
+
readonly unit?: string;
|
|
244
|
+
readonly shares: readonly SplitShare[];
|
|
245
|
+
}
|
|
221
246
|
/**
|
|
222
247
|
* Discriminated union tag for {@link Value} objects.
|
|
223
248
|
*
|
|
@@ -249,7 +274,9 @@ declare enum ValueType {
|
|
|
249
274
|
/** Plugin-raised error propagated through the DAG. Value stores error code, unit stores message. */
|
|
250
275
|
Error = 13,
|
|
251
276
|
/** A colour (hex/rgb/hsl/named). Value is {@link ColourData}. */
|
|
252
|
-
Colour = 14
|
|
277
|
+
Colour = 14,
|
|
278
|
+
/** A per-person bill split (`split $180 between 4`). Value is {@link SplitData}. */
|
|
279
|
+
Split = 15
|
|
253
280
|
}
|
|
254
281
|
/**
|
|
255
282
|
* Universal runtime value for the solve-js VM.
|
|
@@ -265,7 +292,7 @@ declare enum ValueType {
|
|
|
265
292
|
declare class Value {
|
|
266
293
|
private _cachedNumber;
|
|
267
294
|
type: ValueType;
|
|
268
|
-
value: number | bigint | string | boolean | MatrixData | RangeData | ColourData | SymbolicNode;
|
|
295
|
+
value: number | bigint | string | boolean | MatrixData | RangeData | ColourData | SplitData | SymbolicNode;
|
|
269
296
|
unit?: string;
|
|
270
297
|
/** Set by async resolvers when a fetch timed out, the result is a fallback (typically 0). */
|
|
271
298
|
timedOut?: boolean;
|
|
@@ -334,12 +361,12 @@ declare class Value {
|
|
|
334
361
|
* by {@link recycle} alongside the other sidecars.
|
|
335
362
|
*/
|
|
336
363
|
decimalPlaces?: number;
|
|
337
|
-
constructor(type: ValueType, value: number | bigint | string | boolean | MatrixData | RangeData | ColourData | SymbolicNode, unit?: string);
|
|
364
|
+
constructor(type: ValueType, value: number | bigint | string | boolean | MatrixData | RangeData | ColourData | SplitData | SymbolicNode, unit?: string);
|
|
338
365
|
/**
|
|
339
366
|
* Phase 5.3: Reset all fields for arena reuse.
|
|
340
367
|
* Called by ValueArena.acquire(), zero allocation, just field assignment.
|
|
341
368
|
*/
|
|
342
|
-
recycle(type: ValueType, value: number | bigint | string | boolean | MatrixData | RangeData | ColourData | SymbolicNode, unit?: string): void;
|
|
369
|
+
recycle(type: ValueType, value: number | bigint | string | boolean | MatrixData | RangeData | ColourData | SplitData | SymbolicNode, unit?: string): void;
|
|
343
370
|
isNumber(): this is Value & {
|
|
344
371
|
value: number;
|
|
345
372
|
};
|
|
@@ -414,4 +441,4 @@ declare function colVectorValue(data: readonly number[]): Value;
|
|
|
414
441
|
/** Create a Range value, a first-class integer range `min:max`, both bounds inclusive. */
|
|
415
442
|
declare function rangeValue(min: number, max: number): Value;
|
|
416
443
|
|
|
417
|
-
export { type ColourData as C, type MatrixData as M, type RangeData as R, type
|
|
444
|
+
export { type ColourData as C, type MatrixData as M, type RangeData as R, type SplitData as S, Value as V, type MatrixEntry as a, ValueType as b, bigIntValue as c, colVectorValue as d, rowVectorValue as e, type SymbolicNode as f, type ColourFormat as g, hexValue as h, matrixValue as m, numberValue as n, rangeValue as r, stringValue as s, uomValue as u };
|
|
@@ -218,6 +218,31 @@ interface ColourData {
|
|
|
218
218
|
readonly format: ColourFormat;
|
|
219
219
|
readonly name?: string;
|
|
220
220
|
}
|
|
221
|
+
/**
|
|
222
|
+
* One tier of a bill split: an amount and how many people pay it. An even
|
|
223
|
+
* split is a single share; the odd-penny case is two shares (the base amount
|
|
224
|
+
* most people pay, then the base plus a cent that the remaining `count` pay),
|
|
225
|
+
* so the shares always add back to the exact total. `exact` carries the
|
|
226
|
+
* base-ten cents of a currency share so display rounds from the decimal rather
|
|
227
|
+
* than a drifted double, exactly as money does everywhere else.
|
|
228
|
+
*/
|
|
229
|
+
interface SplitShare {
|
|
230
|
+
readonly value: number;
|
|
231
|
+
readonly exact?: DecimalData;
|
|
232
|
+
readonly count: number;
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* The result of a per-person bill split (`split $180 between 4`). `unit` is the
|
|
236
|
+
* currency code when the amount was money, undefined for a bare number.
|
|
237
|
+
* `shares` is ordered base-first: `shares[0]` is the "each" amount, and a
|
|
238
|
+
* second share, when present, is the slightly larger amount the odd penny falls
|
|
239
|
+
* on. Lives in a {@link Value}'s `value` slot exactly as {@link ColourData} and
|
|
240
|
+
* {@link RangeData} do, a display-only payload the formatter renders.
|
|
241
|
+
*/
|
|
242
|
+
interface SplitData {
|
|
243
|
+
readonly unit?: string;
|
|
244
|
+
readonly shares: readonly SplitShare[];
|
|
245
|
+
}
|
|
221
246
|
/**
|
|
222
247
|
* Discriminated union tag for {@link Value} objects.
|
|
223
248
|
*
|
|
@@ -249,7 +274,9 @@ declare enum ValueType {
|
|
|
249
274
|
/** Plugin-raised error propagated through the DAG. Value stores error code, unit stores message. */
|
|
250
275
|
Error = 13,
|
|
251
276
|
/** A colour (hex/rgb/hsl/named). Value is {@link ColourData}. */
|
|
252
|
-
Colour = 14
|
|
277
|
+
Colour = 14,
|
|
278
|
+
/** A per-person bill split (`split $180 between 4`). Value is {@link SplitData}. */
|
|
279
|
+
Split = 15
|
|
253
280
|
}
|
|
254
281
|
/**
|
|
255
282
|
* Universal runtime value for the solve-js VM.
|
|
@@ -265,7 +292,7 @@ declare enum ValueType {
|
|
|
265
292
|
declare class Value {
|
|
266
293
|
private _cachedNumber;
|
|
267
294
|
type: ValueType;
|
|
268
|
-
value: number | bigint | string | boolean | MatrixData | RangeData | ColourData | SymbolicNode;
|
|
295
|
+
value: number | bigint | string | boolean | MatrixData | RangeData | ColourData | SplitData | SymbolicNode;
|
|
269
296
|
unit?: string;
|
|
270
297
|
/** Set by async resolvers when a fetch timed out, the result is a fallback (typically 0). */
|
|
271
298
|
timedOut?: boolean;
|
|
@@ -334,12 +361,12 @@ declare class Value {
|
|
|
334
361
|
* by {@link recycle} alongside the other sidecars.
|
|
335
362
|
*/
|
|
336
363
|
decimalPlaces?: number;
|
|
337
|
-
constructor(type: ValueType, value: number | bigint | string | boolean | MatrixData | RangeData | ColourData | SymbolicNode, unit?: string);
|
|
364
|
+
constructor(type: ValueType, value: number | bigint | string | boolean | MatrixData | RangeData | ColourData | SplitData | SymbolicNode, unit?: string);
|
|
338
365
|
/**
|
|
339
366
|
* Phase 5.3: Reset all fields for arena reuse.
|
|
340
367
|
* Called by ValueArena.acquire(), zero allocation, just field assignment.
|
|
341
368
|
*/
|
|
342
|
-
recycle(type: ValueType, value: number | bigint | string | boolean | MatrixData | RangeData | ColourData | SymbolicNode, unit?: string): void;
|
|
369
|
+
recycle(type: ValueType, value: number | bigint | string | boolean | MatrixData | RangeData | ColourData | SplitData | SymbolicNode, unit?: string): void;
|
|
343
370
|
isNumber(): this is Value & {
|
|
344
371
|
value: number;
|
|
345
372
|
};
|
|
@@ -414,4 +441,4 @@ declare function colVectorValue(data: readonly number[]): Value;
|
|
|
414
441
|
/** Create a Range value, a first-class integer range `min:max`, both bounds inclusive. */
|
|
415
442
|
declare function rangeValue(min: number, max: number): Value;
|
|
416
443
|
|
|
417
|
-
export { type ColourData as C, type MatrixData as M, type RangeData as R, type
|
|
444
|
+
export { type ColourData as C, type MatrixData as M, type RangeData as R, type SplitData as S, Value as V, type MatrixEntry as a, ValueType as b, bigIntValue as c, colVectorValue as d, rowVectorValue as e, type SymbolicNode as f, type ColourFormat as g, hexValue as h, matrixValue as m, numberValue as n, rangeValue as r, stringValue as s, uomValue as u };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as ErrorCategory, S as SourceSpan, E as EngineError } from './EngineError-
|
|
1
|
+
import { c as ErrorCategory, S as SourceSpan, E as EngineError } from './EngineError-CNA_rHY-.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Structured errors for the off-main-thread worker harness, and the pair of
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as ErrorCategory, S as SourceSpan, E as EngineError } from './EngineError-
|
|
1
|
+
import { c as ErrorCategory, S as SourceSpan, E as EngineError } from './EngineError-CNA_rHY-.cjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Structured errors for the off-main-thread worker harness, and the pair of
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkKXDQKVNX_cjs = require('./chunk-KXDQKVNX.cjs');
|
|
4
|
+
var chunkIT74O4BE_cjs = require('./chunk-IT74O4BE.cjs');
|
|
5
5
|
|
|
6
6
|
// src/parser/OperandWidth.ts
|
|
7
7
|
var ONE_OPERAND = [
|
|
@@ -57,7 +57,7 @@ var CURRENCY_NS = "currency";
|
|
|
57
57
|
var CurrencyAsyncResolver = class {
|
|
58
58
|
constructor(exchange) {
|
|
59
59
|
this.namespace = CURRENCY_NS;
|
|
60
|
-
this.exchange = exchange ??
|
|
60
|
+
this.exchange = exchange ?? chunkKXDQKVNX_cjs.currencyExchangeService;
|
|
61
61
|
}
|
|
62
62
|
preflight(_tokens, bytecode, packageId, signal, queryClient) {
|
|
63
63
|
const { opcodes, strings } = bytecode;
|
|
@@ -89,7 +89,7 @@ var CurrencyAsyncResolver = class {
|
|
|
89
89
|
const resolver = queryClient.fetchQuery({
|
|
90
90
|
queryKey: cacheKey,
|
|
91
91
|
queryFn: ({ signal: qSignal }) => {
|
|
92
|
-
return this.exchange.getRate(fromUnit, toUnit, qSignal).then((rate) =>
|
|
92
|
+
return this.exchange.getRate(fromUnit, toUnit, qSignal).then((rate) => chunkIT74O4BE_cjs.numberValue(rate));
|
|
93
93
|
},
|
|
94
94
|
staleTime: 5 * 60 * 1e3
|
|
95
95
|
});
|
|
@@ -108,5 +108,5 @@ var CurrencyAsyncResolver = class {
|
|
|
108
108
|
|
|
109
109
|
exports.CurrencyAsyncResolver = CurrencyAsyncResolver;
|
|
110
110
|
exports.nextInstruction = nextInstruction;
|
|
111
|
-
//# sourceMappingURL=chunk-
|
|
112
|
-
//# sourceMappingURL=chunk-
|
|
111
|
+
//# sourceMappingURL=chunk-4K5W7EH2.cjs.map
|
|
112
|
+
//# sourceMappingURL=chunk-4K5W7EH2.cjs.map
|