solve-engine 1.0.0-beta.3 → 1.0.0-beta.4
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/{Lexer-y8uY6n6t.d.cts → Lexer-Cfm79Dak.d.cts} +1 -1
- package/dist/{Lexer-Dkt7KGaU.d.ts → Lexer-W9MBOP0V.d.ts} +1 -1
- package/dist/{PackageRegistry-wUQyVEyw.d.ts → PackageRegistry-CjDt-Jy_.d.ts} +4 -4
- package/dist/{PackageRegistry-CblRmrHc.d.cts → PackageRegistry-pHtKythi.d.cts} +4 -4
- package/dist/{Parselet-C974vhZG.d.cts → Parselet-Cu0bLSis.d.cts} +1 -1
- package/dist/{Parselet-CsmtM3It.d.ts → Parselet-DEdF9I7n.d.ts} +1 -1
- package/dist/{Token-DnU2hwFY.d.cts → Token-BzG5G4ja.d.cts} +30 -0
- package/dist/{Token-DnU2hwFY.d.ts → Token-BzG5G4ja.d.ts} +30 -0
- package/dist/{TokenNormalizer-CqBCrYkR.d.cts → TokenNormalizer-DGVa24Q-.d.cts} +1 -1
- package/dist/{TokenNormalizer-B8zmhO5X.d.ts → TokenNormalizer-t_GotBxr.d.ts} +1 -1
- package/dist/{chunk-AF5AE52C.js → chunk-2CS6OMZK.js} +7 -6
- package/dist/chunk-2CS6OMZK.js.map +1 -0
- package/dist/{chunk-XJCMXB2E.cjs → chunk-2MV4HBKC.cjs} +187 -61
- package/dist/chunk-2MV4HBKC.cjs.map +1 -0
- package/dist/{chunk-J73SJHR3.cjs → chunk-2NPS5DQ3.cjs} +558 -341
- package/dist/chunk-2NPS5DQ3.cjs.map +1 -0
- package/dist/{chunk-QWY3VEZN.js → chunk-3MNKQZ77.js} +65 -12
- package/dist/chunk-3MNKQZ77.js.map +1 -0
- package/dist/{chunk-BOAVE4FC.cjs → chunk-43G3JT2E.cjs} +1491 -218
- package/dist/chunk-43G3JT2E.cjs.map +1 -0
- package/dist/{chunk-WQTTOGXC.cjs → chunk-4AVD7NZW.cjs} +4 -4
- package/dist/{chunk-WQTTOGXC.cjs.map → chunk-4AVD7NZW.cjs.map} +1 -1
- package/dist/{chunk-HTXVVJRA.cjs → chunk-4CVLFLOB.cjs} +112 -2
- package/dist/chunk-4CVLFLOB.cjs.map +1 -0
- package/dist/{chunk-ZS6CRJZP.js → chunk-6GCKCWLB.js} +9 -3
- package/dist/chunk-6GCKCWLB.js.map +1 -0
- package/dist/{chunk-CGIDYRAX.cjs → chunk-AHCLWAM5.cjs} +18 -10
- package/dist/chunk-AHCLWAM5.cjs.map +1 -0
- package/dist/{chunk-KVILKGMS.js → chunk-AJA6LUI7.js} +36 -2
- package/dist/chunk-AJA6LUI7.js.map +1 -0
- package/dist/{chunk-EHAHVROS.cjs → chunk-CLVQBF5C.cjs} +5 -5
- package/dist/{chunk-EHAHVROS.cjs.map → chunk-CLVQBF5C.cjs.map} +1 -1
- package/dist/{chunk-34RRD7PC.js → chunk-CYFK5SY2.js} +111 -3
- package/dist/chunk-CYFK5SY2.js.map +1 -0
- package/dist/{chunk-23MFG6GG.js → chunk-DDQVZGLO.js} +12 -12
- package/dist/{chunk-23MFG6GG.js.map → chunk-DDQVZGLO.js.map} +1 -1
- package/dist/{chunk-F7G7ZFIZ.cjs → chunk-EAAHVJ4P.cjs} +3 -3
- package/dist/{chunk-F7G7ZFIZ.cjs.map → chunk-EAAHVJ4P.cjs.map} +1 -1
- package/dist/{chunk-OWXIOHQB.js → chunk-FIFQPKBA.js} +1417 -144
- package/dist/chunk-FIFQPKBA.js.map +1 -0
- package/dist/{chunk-626UW5RU.js → chunk-GPPLSM2Z.js} +61 -2
- package/dist/chunk-GPPLSM2Z.js.map +1 -0
- package/dist/{chunk-4QADQTWS.js → chunk-KHJUSHFU.js} +231 -14
- package/dist/chunk-KHJUSHFU.js.map +1 -0
- package/dist/{chunk-2R7SVDDB.cjs → chunk-M4F66R4O.cjs} +72 -72
- package/dist/{chunk-2R7SVDDB.cjs.map → chunk-M4F66R4O.cjs.map} +1 -1
- package/dist/{chunk-6NTVRDQV.cjs → chunk-M4Q47KHF.cjs} +126 -73
- package/dist/chunk-M4Q47KHF.cjs.map +1 -0
- package/dist/{chunk-LIPPNDBE.js → chunk-M5E34VG5.js} +3 -3
- package/dist/{chunk-LIPPNDBE.js.map → chunk-M5E34VG5.js.map} +1 -1
- package/dist/{chunk-53B6KDDJ.cjs → chunk-MBNQVDVC.cjs} +38 -3
- package/dist/{chunk-53B6KDDJ.cjs.map → chunk-MBNQVDVC.cjs.map} +1 -1
- package/dist/{chunk-2A3VOGVG.js → chunk-MEOHSQEH.js} +6 -5
- package/dist/chunk-MEOHSQEH.js.map +1 -0
- package/dist/{chunk-ZH2PCJ4V.cjs → chunk-MTX2KVU7.cjs} +71 -70
- package/dist/chunk-MTX2KVU7.cjs.map +1 -0
- package/dist/{chunk-QNJ4ACRT.cjs → chunk-NJTXJ5AG.cjs} +37 -15
- package/dist/chunk-NJTXJ5AG.cjs.map +1 -0
- package/dist/{chunk-EEJSQEHC.cjs → chunk-NZFKROS7.cjs} +26 -20
- package/dist/chunk-NZFKROS7.cjs.map +1 -0
- package/dist/{chunk-OJ6LW7VQ.js → chunk-OFXOTECC.js} +13 -5
- package/dist/chunk-OFXOTECC.js.map +1 -0
- package/dist/{chunk-3YNVWKR2.cjs → chunk-OUHT5Z36.cjs} +28 -5
- package/dist/chunk-OUHT5Z36.cjs.map +1 -0
- package/dist/{chunk-KFRBAXKW.js → chunk-OWRHDUJD.js} +3 -3
- package/dist/{chunk-KFRBAXKW.js.map → chunk-OWRHDUJD.js.map} +1 -1
- package/dist/{chunk-4MG4XKO2.js → chunk-PCPX42KL.js} +38 -3
- package/dist/{chunk-4MG4XKO2.js.map → chunk-PCPX42KL.js.map} +1 -1
- package/dist/{chunk-FI4WDYSL.cjs → chunk-R24DI24X.cjs} +61 -2
- package/dist/chunk-R24DI24X.cjs.map +1 -0
- package/dist/{chunk-VM5ZKDLH.js → chunk-SFQWJMKT.js} +5 -5
- package/dist/{chunk-VM5ZKDLH.js.map → chunk-SFQWJMKT.js.map} +1 -1
- package/dist/{chunk-6BKTCEUP.cjs → chunk-TY3TLZAW.cjs} +36 -2
- package/dist/chunk-TY3TLZAW.cjs.map +1 -0
- package/dist/{chunk-DM3LMRBC.js → chunk-UKPGSAZW.js} +187 -61
- package/dist/chunk-UKPGSAZW.js.map +1 -0
- package/dist/{chunk-NH2O2AUR.js → chunk-WC5FFSHB.js} +26 -4
- package/dist/chunk-WC5FFSHB.js.map +1 -0
- package/dist/{chunk-7J2Q77OH.cjs → chunk-WWOLFXTX.cjs} +11 -10
- package/dist/chunk-WWOLFXTX.cjs.map +1 -0
- package/dist/{chunk-PG2K5BL6.cjs → chunk-X2BWAZAU.cjs} +53 -53
- package/dist/{chunk-PG2K5BL6.cjs.map → chunk-X2BWAZAU.cjs.map} +1 -1
- package/dist/{chunk-GOLDJNMZ.js → chunk-XBTEO4OB.js} +28 -5
- package/dist/chunk-XBTEO4OB.js.map +1 -0
- package/dist/{chunk-EPOXXJBK.js → chunk-YU2CUNFO.js} +3 -3
- package/dist/{chunk-EPOXXJBK.js.map → chunk-YU2CUNFO.js.map} +1 -1
- package/dist/constants.cjs +4 -4
- package/dist/constants.js +1 -1
- package/dist/engine.cjs +29 -30
- package/dist/engine.d.cts +6 -6
- package/dist/engine.d.ts +6 -6
- package/dist/engine.js +19 -20
- package/dist/format.cjs +7 -8
- package/dist/format.cjs.map +1 -1
- package/dist/format.js +2 -3
- package/dist/format.js.map +1 -1
- package/dist/index.cjs +28 -29
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +20 -21
- package/dist/index.js.map +1 -1
- package/dist/language.cjs +12 -12
- package/dist/language.d.cts +6 -6
- package/dist/language.d.ts +6 -6
- package/dist/language.js +5 -5
- package/dist/lexer.cjs +19 -19
- package/dist/lexer.d.cts +3 -3
- package/dist/lexer.d.ts +3 -3
- package/dist/lexer.js +7 -7
- package/dist/normalizer.cjs +12 -12
- package/dist/normalizer.d.cts +3 -3
- package/dist/normalizer.d.ts +3 -3
- package/dist/normalizer.js +6 -6
- package/dist/packages.cjs +36 -37
- package/dist/packages.d.cts +5 -47
- package/dist/packages.d.ts +5 -47
- package/dist/packages.js +13 -14
- package/dist/parser.cjs +12 -12
- package/dist/parser.d.cts +3 -2
- package/dist/parser.d.ts +3 -2
- package/dist/parser.js +4 -4
- package/dist/resolvers.d.cts +1 -1
- package/dist/resolvers.d.ts +1 -1
- package/dist/uom.cjs +14 -14
- package/dist/uom.d.cts +12 -4
- package/dist/uom.d.ts +12 -4
- package/dist/uom.js +4 -4
- package/dist/vm.cjs +17 -17
- package/dist/vm.js +6 -6
- package/package.json +1 -1
- package/dist/chunk-2A3VOGVG.js.map +0 -1
- package/dist/chunk-34RRD7PC.js.map +0 -1
- package/dist/chunk-3YNVWKR2.cjs.map +0 -1
- package/dist/chunk-4QADQTWS.js.map +0 -1
- package/dist/chunk-626UW5RU.js.map +0 -1
- package/dist/chunk-6BKTCEUP.cjs.map +0 -1
- package/dist/chunk-6NTVRDQV.cjs.map +0 -1
- package/dist/chunk-7J2Q77OH.cjs.map +0 -1
- package/dist/chunk-AF5AE52C.js.map +0 -1
- package/dist/chunk-BOAVE4FC.cjs.map +0 -1
- package/dist/chunk-CGIDYRAX.cjs.map +0 -1
- package/dist/chunk-DM3LMRBC.js.map +0 -1
- package/dist/chunk-EEJSQEHC.cjs.map +0 -1
- package/dist/chunk-FI4WDYSL.cjs.map +0 -1
- package/dist/chunk-GOLDJNMZ.js.map +0 -1
- package/dist/chunk-HTXVVJRA.cjs.map +0 -1
- package/dist/chunk-J73SJHR3.cjs.map +0 -1
- package/dist/chunk-KVILKGMS.js.map +0 -1
- package/dist/chunk-NH2O2AUR.js.map +0 -1
- package/dist/chunk-OJ6LW7VQ.js.map +0 -1
- package/dist/chunk-OT6OJY7C.cjs +0 -114
- package/dist/chunk-OT6OJY7C.cjs.map +0 -1
- package/dist/chunk-OWXIOHQB.js.map +0 -1
- package/dist/chunk-QNJ4ACRT.cjs.map +0 -1
- package/dist/chunk-QWY3VEZN.js.map +0 -1
- package/dist/chunk-RFYD5TJE.js +0 -111
- package/dist/chunk-RFYD5TJE.js.map +0 -1
- package/dist/chunk-XJCMXB2E.cjs.map +0 -1
- package/dist/chunk-ZH2PCJ4V.cjs.map +0 -1
- package/dist/chunk-ZS6CRJZP.js.map +0 -1
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { a as PrecedenceParser, b as PrefixParselet, I as InfixParselet } from './Parselet-
|
|
1
|
+
import { a as PrecedenceParser, b as PrefixParselet, I as InfixParselet } from './Parselet-DEdF9I7n.js';
|
|
2
2
|
import { V as Value } from './Value-KtAQNHur.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-W9MBOP0V.js';
|
|
5
5
|
import { IAsyncResolver } from './resolvers.js';
|
|
6
|
-
import { T as TokenFusion, c as TokenNormalizer, a as NormalizerRule } from './TokenNormalizer-
|
|
6
|
+
import { T as TokenFusion, c as TokenNormalizer, a as NormalizerRule } from './TokenNormalizer-t_GotBxr.js';
|
|
7
7
|
import { D as DependencyGraph, V as VM, a as DagSnapshot, b as EngineContext, S as ScopeManager, L as LineExecutionContext } from './ScopeManager-B5k0nk05.js';
|
|
8
8
|
import { a as BytecodeProgram } from './BytecodeBuilder-3egMyuDi.js';
|
|
9
9
|
import { QueryClient } from '@tanstack/query-core';
|
|
10
10
|
import { E as EngineError } from './EngineError-DvPSnhZi.js';
|
|
11
11
|
import { a as DiagnosticReportJSON, D as DiagnosticPipeline } from './pipeline-CrsRPmsv.js';
|
|
12
|
-
import { T as Token } from './Token-
|
|
12
|
+
import { T as Token } from './Token-BzG5G4ja.js';
|
|
13
13
|
import { D as DEFAULT_CONFIG, E as EngineConfig } from './Configuration-fVpd-HC-.js';
|
|
14
14
|
|
|
15
15
|
/**
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { a as PrecedenceParser, b as PrefixParselet, I as InfixParselet } from './Parselet-
|
|
1
|
+
import { a as PrecedenceParser, b as PrefixParselet, I as InfixParselet } from './Parselet-Cu0bLSis.cjs';
|
|
2
2
|
import { V as Value } from './Value-KtAQNHur.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-Cfm79Dak.cjs';
|
|
5
5
|
import { IAsyncResolver } from './resolvers.cjs';
|
|
6
|
-
import { T as TokenFusion, c as TokenNormalizer, a as NormalizerRule } from './TokenNormalizer-
|
|
6
|
+
import { T as TokenFusion, c as TokenNormalizer, a as NormalizerRule } from './TokenNormalizer-DGVa24Q-.cjs';
|
|
7
7
|
import { D as DependencyGraph, V as VM, a as DagSnapshot, b as EngineContext, S as ScopeManager, L as LineExecutionContext } from './ScopeManager-CKfQtl7l.cjs';
|
|
8
8
|
import { a as BytecodeProgram } from './BytecodeBuilder-3egMyuDi.cjs';
|
|
9
9
|
import { QueryClient } from '@tanstack/query-core';
|
|
10
10
|
import { E as EngineError } from './EngineError-DvPSnhZi.cjs';
|
|
11
11
|
import { a as DiagnosticReportJSON, D as DiagnosticPipeline } from './pipeline-DPUQt7yL.cjs';
|
|
12
|
-
import { T as Token } from './Token-
|
|
12
|
+
import { T as Token } from './Token-BzG5G4ja.cjs';
|
|
13
13
|
import { D as DEFAULT_CONFIG, E as EngineConfig } from './Configuration-fVpd-HC-.cjs';
|
|
14
14
|
|
|
15
15
|
/**
|
|
@@ -87,6 +87,7 @@ declare const TokenTypes: {
|
|
|
87
87
|
readonly PI: "PI";
|
|
88
88
|
readonly E: "E";
|
|
89
89
|
readonly MOD: "MOD";
|
|
90
|
+
readonly AND_CONJ: "AND_CONJ";
|
|
90
91
|
readonly OF: "OF";
|
|
91
92
|
readonly INCREASE_BY: "INCREASE_BY";
|
|
92
93
|
readonly DECREASE_BY: "DECREASE_BY";
|
|
@@ -138,6 +139,9 @@ declare const TokenTypes: {
|
|
|
138
139
|
readonly ELSE: "ELSE";
|
|
139
140
|
readonly AS: "AS";
|
|
140
141
|
readonly CONVERTER_NAME: "CONVERTER_NAME";
|
|
142
|
+
readonly ROUNDED: "ROUNDED";
|
|
143
|
+
readonly TO_NEAREST: "TO_NEAREST";
|
|
144
|
+
readonly DECIMAL_PLACES: "DECIMAL_PLACES";
|
|
141
145
|
readonly AVERAGE_OF: "AVERAGE_OF";
|
|
142
146
|
readonly MEDIAN_OF: "MEDIAN_OF";
|
|
143
147
|
readonly TOTAL_OF: "TOTAL_OF";
|
|
@@ -146,8 +150,22 @@ declare const TokenTypes: {
|
|
|
146
150
|
readonly SMALLER_OF: "SMALLER_OF";
|
|
147
151
|
readonly HALF_OF: "HALF_OF";
|
|
148
152
|
readonly MIDPOINT_BETWEEN: "MIDPOINT_BETWEEN";
|
|
153
|
+
readonly REMAINDER_OF: "REMAINDER_OF";
|
|
154
|
+
readonly NTH_ROOT: "NTH_ROOT";
|
|
155
|
+
readonly LOG_PHRASE: "LOG_PHRASE";
|
|
156
|
+
readonly LOG_BASE: "LOG_BASE";
|
|
157
|
+
readonly GCD_OF: "GCD_OF";
|
|
158
|
+
readonly LCM_OF: "LCM_OF";
|
|
159
|
+
readonly SQUARE_ROOT_OF: "SQUARE_ROOT_OF";
|
|
160
|
+
readonly CUBE_ROOT_OF: "CUBE_ROOT_OF";
|
|
149
161
|
readonly RANDOM_NUMBER: "RANDOM_NUMBER";
|
|
150
162
|
readonly IS_TO: "IS_TO";
|
|
163
|
+
readonly IS: "IS";
|
|
164
|
+
readonly PCT_ON: "PCT_ON";
|
|
165
|
+
readonly PCT_OFF: "PCT_OFF";
|
|
166
|
+
readonly OF_WHAT: "OF_WHAT";
|
|
167
|
+
readonly OFF_WHAT: "OFF_WHAT";
|
|
168
|
+
readonly ON_WHAT: "ON_WHAT";
|
|
151
169
|
readonly CLAMP: "CLAMP";
|
|
152
170
|
readonly MAP: "MAP";
|
|
153
171
|
readonly REDUCE: "REDUCE";
|
|
@@ -181,6 +199,13 @@ declare const TokenTypes: {
|
|
|
181
199
|
readonly GLOBAL: "GLOBAL";
|
|
182
200
|
readonly OVER: "OVER";
|
|
183
201
|
readonly RATE_AT: "RATE_AT";
|
|
202
|
+
readonly AFTER: "AFTER";
|
|
203
|
+
readonly PRESENT_VALUE_OF: "PRESENT_VALUE_OF";
|
|
204
|
+
readonly ANNUAL_RETURN_ON: "ANNUAL_RETURN_ON";
|
|
205
|
+
readonly FOR_DURATION: "FOR_DURATION";
|
|
206
|
+
readonly COMPOUNDING: "COMPOUNDING";
|
|
207
|
+
readonly INVESTED: "INVESTED";
|
|
208
|
+
readonly RETURNED: "RETURNED";
|
|
184
209
|
readonly COMPOUND_INTEREST_ON: "COMPOUND_INTEREST_ON";
|
|
185
210
|
readonly INTEREST_ON: "INTEREST_ON";
|
|
186
211
|
readonly DAILY_REPAYMENT_ON: "DAILY_REPAYMENT_ON";
|
|
@@ -193,6 +218,7 @@ declare const TokenTypes: {
|
|
|
193
218
|
readonly TOTAL_LOAN_INTEREST_ON: "TOTAL_LOAN_INTEREST_ON";
|
|
194
219
|
readonly TAX_ON: "TAX_ON";
|
|
195
220
|
readonly TAX_OFF: "TAX_OFF";
|
|
221
|
+
readonly TAX_IN_PHRASE: "TAX_IN_PHRASE";
|
|
196
222
|
readonly WHAT_IS: "WHAT_IS";
|
|
197
223
|
readonly WHAT_WAS: "WHAT_WAS";
|
|
198
224
|
readonly VALUE_OF: "VALUE_OF";
|
|
@@ -209,6 +235,10 @@ declare const TokenTypes: {
|
|
|
209
235
|
readonly MONTH_ON: "MONTH_ON";
|
|
210
236
|
readonly MONTH_IN: "MONTH_IN";
|
|
211
237
|
readonly WEEK_ON: "WEEK_ON";
|
|
238
|
+
readonly DAYS_IN_PERIOD: "DAYS_IN_PERIOD";
|
|
239
|
+
readonly IN_TWO_UNITS: "IN_TWO_UNITS";
|
|
240
|
+
readonly PER_UNIT: "PER_UNIT";
|
|
241
|
+
readonly AT_RATE: "AT_RATE";
|
|
212
242
|
readonly WEEK_IN: "WEEK_IN";
|
|
213
243
|
readonly BETWEEN_UNIT: "BETWEEN_UNIT";
|
|
214
244
|
readonly IS_WEEKEND: "IS_WEEKEND";
|
|
@@ -87,6 +87,7 @@ declare const TokenTypes: {
|
|
|
87
87
|
readonly PI: "PI";
|
|
88
88
|
readonly E: "E";
|
|
89
89
|
readonly MOD: "MOD";
|
|
90
|
+
readonly AND_CONJ: "AND_CONJ";
|
|
90
91
|
readonly OF: "OF";
|
|
91
92
|
readonly INCREASE_BY: "INCREASE_BY";
|
|
92
93
|
readonly DECREASE_BY: "DECREASE_BY";
|
|
@@ -138,6 +139,9 @@ declare const TokenTypes: {
|
|
|
138
139
|
readonly ELSE: "ELSE";
|
|
139
140
|
readonly AS: "AS";
|
|
140
141
|
readonly CONVERTER_NAME: "CONVERTER_NAME";
|
|
142
|
+
readonly ROUNDED: "ROUNDED";
|
|
143
|
+
readonly TO_NEAREST: "TO_NEAREST";
|
|
144
|
+
readonly DECIMAL_PLACES: "DECIMAL_PLACES";
|
|
141
145
|
readonly AVERAGE_OF: "AVERAGE_OF";
|
|
142
146
|
readonly MEDIAN_OF: "MEDIAN_OF";
|
|
143
147
|
readonly TOTAL_OF: "TOTAL_OF";
|
|
@@ -146,8 +150,22 @@ declare const TokenTypes: {
|
|
|
146
150
|
readonly SMALLER_OF: "SMALLER_OF";
|
|
147
151
|
readonly HALF_OF: "HALF_OF";
|
|
148
152
|
readonly MIDPOINT_BETWEEN: "MIDPOINT_BETWEEN";
|
|
153
|
+
readonly REMAINDER_OF: "REMAINDER_OF";
|
|
154
|
+
readonly NTH_ROOT: "NTH_ROOT";
|
|
155
|
+
readonly LOG_PHRASE: "LOG_PHRASE";
|
|
156
|
+
readonly LOG_BASE: "LOG_BASE";
|
|
157
|
+
readonly GCD_OF: "GCD_OF";
|
|
158
|
+
readonly LCM_OF: "LCM_OF";
|
|
159
|
+
readonly SQUARE_ROOT_OF: "SQUARE_ROOT_OF";
|
|
160
|
+
readonly CUBE_ROOT_OF: "CUBE_ROOT_OF";
|
|
149
161
|
readonly RANDOM_NUMBER: "RANDOM_NUMBER";
|
|
150
162
|
readonly IS_TO: "IS_TO";
|
|
163
|
+
readonly IS: "IS";
|
|
164
|
+
readonly PCT_ON: "PCT_ON";
|
|
165
|
+
readonly PCT_OFF: "PCT_OFF";
|
|
166
|
+
readonly OF_WHAT: "OF_WHAT";
|
|
167
|
+
readonly OFF_WHAT: "OFF_WHAT";
|
|
168
|
+
readonly ON_WHAT: "ON_WHAT";
|
|
151
169
|
readonly CLAMP: "CLAMP";
|
|
152
170
|
readonly MAP: "MAP";
|
|
153
171
|
readonly REDUCE: "REDUCE";
|
|
@@ -181,6 +199,13 @@ declare const TokenTypes: {
|
|
|
181
199
|
readonly GLOBAL: "GLOBAL";
|
|
182
200
|
readonly OVER: "OVER";
|
|
183
201
|
readonly RATE_AT: "RATE_AT";
|
|
202
|
+
readonly AFTER: "AFTER";
|
|
203
|
+
readonly PRESENT_VALUE_OF: "PRESENT_VALUE_OF";
|
|
204
|
+
readonly ANNUAL_RETURN_ON: "ANNUAL_RETURN_ON";
|
|
205
|
+
readonly FOR_DURATION: "FOR_DURATION";
|
|
206
|
+
readonly COMPOUNDING: "COMPOUNDING";
|
|
207
|
+
readonly INVESTED: "INVESTED";
|
|
208
|
+
readonly RETURNED: "RETURNED";
|
|
184
209
|
readonly COMPOUND_INTEREST_ON: "COMPOUND_INTEREST_ON";
|
|
185
210
|
readonly INTEREST_ON: "INTEREST_ON";
|
|
186
211
|
readonly DAILY_REPAYMENT_ON: "DAILY_REPAYMENT_ON";
|
|
@@ -193,6 +218,7 @@ declare const TokenTypes: {
|
|
|
193
218
|
readonly TOTAL_LOAN_INTEREST_ON: "TOTAL_LOAN_INTEREST_ON";
|
|
194
219
|
readonly TAX_ON: "TAX_ON";
|
|
195
220
|
readonly TAX_OFF: "TAX_OFF";
|
|
221
|
+
readonly TAX_IN_PHRASE: "TAX_IN_PHRASE";
|
|
196
222
|
readonly WHAT_IS: "WHAT_IS";
|
|
197
223
|
readonly WHAT_WAS: "WHAT_WAS";
|
|
198
224
|
readonly VALUE_OF: "VALUE_OF";
|
|
@@ -209,6 +235,10 @@ declare const TokenTypes: {
|
|
|
209
235
|
readonly MONTH_ON: "MONTH_ON";
|
|
210
236
|
readonly MONTH_IN: "MONTH_IN";
|
|
211
237
|
readonly WEEK_ON: "WEEK_ON";
|
|
238
|
+
readonly DAYS_IN_PERIOD: "DAYS_IN_PERIOD";
|
|
239
|
+
readonly IN_TWO_UNITS: "IN_TWO_UNITS";
|
|
240
|
+
readonly PER_UNIT: "PER_UNIT";
|
|
241
|
+
readonly AT_RATE: "AT_RATE";
|
|
212
242
|
readonly WEEK_IN: "WEEK_IN";
|
|
213
243
|
readonly BETWEEN_UNIT: "BETWEEN_UNIT";
|
|
214
244
|
readonly IS_WEEKEND: "IS_WEEKEND";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { getTokenCategory } from './chunk-
|
|
2
|
-
import { ExpressionLexer } from './chunk-
|
|
3
|
-
import { getLocale } from './chunk-
|
|
4
|
-
import { knownUnits } from './chunk-
|
|
1
|
+
import { getTokenCategory } from './chunk-AJA6LUI7.js';
|
|
2
|
+
import { ExpressionLexer } from './chunk-SFQWJMKT.js';
|
|
3
|
+
import { getLocale } from './chunk-XBTEO4OB.js';
|
|
4
|
+
import { knownUnits } from './chunk-M5E34VG5.js';
|
|
5
5
|
|
|
6
6
|
// src/lexer/LexerState.ts
|
|
7
7
|
var LexerState = /* @__PURE__ */ ((LexerState2) => {
|
|
@@ -317,6 +317,7 @@ var BUILTIN_PHRASES = {
|
|
|
317
317
|
"decrease by": "DECREASE_BY",
|
|
318
318
|
"times by": "TIMES_BY",
|
|
319
319
|
"multiply by": "MULTIPLY_BY",
|
|
320
|
+
"multiplied by": "MULTIPLY_BY",
|
|
320
321
|
"divide by": "DIVIDE_BY"
|
|
321
322
|
};
|
|
322
323
|
function buildTokenLookup(localeCode = "en") {
|
|
@@ -328,5 +329,5 @@ function buildTokenLookup(localeCode = "en") {
|
|
|
328
329
|
}
|
|
329
330
|
|
|
330
331
|
export { Lexer, LexerState, buildTokenLookup, sharedLexer };
|
|
331
|
-
//# sourceMappingURL=chunk-
|
|
332
|
-
//# sourceMappingURL=chunk-
|
|
332
|
+
//# sourceMappingURL=chunk-2CS6OMZK.js.map
|
|
333
|
+
//# sourceMappingURL=chunk-2CS6OMZK.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/lexer/LexerState.ts","../src/lexer/Lexer.ts","../src/lexer/TokenClassRegistry.ts","../src/lexer/tokenRegistration.ts"],"names":["LexerState"],"mappings":";;;;;;AAMO,IAAK,UAAA,qBAAAA,WAAAA,KAAL;AACN,EAAAA,YAAA,MAAA,CAAA,GAAO,MAAA;AACP,EAAAA,YAAA,QAAA,CAAA,GAAS,QAAA;AACT,EAAAA,YAAA,QAAA,CAAA,GAAS,QAAA;AAHE,EAAA,OAAAA,WAAAA;AAAA,CAAA,EAAA,UAAA,IAAA,EAAA;;;ACaL,IAAM,QAAN,MAAY;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAkBjB,WAAA,CAAY,UAAA,GAAa,IAAA,EAAM,WAAA,EAA2B;AAf1D,IAAA,IAAA,CAAQ,YAAA,GAAA,MAAA;AAER,IAAA,IAAA,CAAQ,SAAA,GAAY,KAAA;AAIpB;AAAA;AAAA,IAAA,IAAA,CAAQ,SAAkB,EAAC;AAC3B,IAAA,IAAA,CAAQ,QAAA,GAAmB,CAAA;AAYzB,IAAA,IAAA,CAAK,eAAA,GAAkB,IAA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A,CAAO,IAAA,CAAK,EAAA,CAAG,OAAO,CAAA,EAAG;AAC5C,QAAA,MAAM,QAAQ,MAAA,CAAO,KAAA,CAAM,GAAG,CAAA,CAAE,CAAC,EAAE,WAAA,EAAY;AAC/C,QAAA,UAAA,CAAW,IAAI,KAAK,CAAA;AAAA,MACtB;AAAA,IACF;AAEA,IAAA,OAAO,UAAA;AAAA,EACT;AACF,CAAA;;;AClOA,IAAM,eAAA,GAA0C;AAAA,EAC9C,iBAAA,EAAmB,OAAA;AAAA,EACnB,UAAA,EAAY,OAAA;AAAA,EACZ,aAAA,EAAe,aAAA;AAAA,EACf,aAAA,EAAe,aAAA;AAAA,EACf,UAAA,EAAY,UAAA;AAAA,EACZ,aAAA,EAAe,aAAA;AAAA,EACf,eAAA,EAAiB,aAAA;AAAA,EACjB,WAAA,EAAa;AACf,CAAA;AAiBO,SAAS,gBAAA,CAAiB,aAAa,IAAA,EAAmB;AAC/D,EAAA,MAAM,MAAA,GAAkB,UAAU,UAAU,CAAA;AAC5C,EAAA,MAAM,QAAA,GAAW,IAAI,kBAAA,EAAmB;AAGxC,EAAA,QAAA,CAAS,SAAA,CAAU,MAAA,CAAO,UAAA,EAAY,eAAe,CAAA;AAGrD,EAAA,QAAA,CAAS,SAAS,UAAU,CAAA;AAG5B,EAAA,OAAO,SAAS,KAAA,EAAM;AACxB","file":"chunk-2CS6OMZK.js","sourcesContent":["/**\n * Lexer state machine modes.\n * - Main: document-level scanning with markdown classification\n * - Inline: expression embedded in markdown inline solve (`s\\`...\\``)\n * - String: inside a double-quoted string literal\n */\nexport enum LexerState {\n\tMain = \"main\",\n\tInline = \"inline\",\n\tString = \"string\",\n}\n","import { ExpressionLexer, LineClassification, LexerVocabulary, type ScanLineResult } from \"./ExpressionLexer\";\nimport { Token } from \"@solve-js/lexer/Token\";\nimport { LexerState } from \"@solve-js/lexer/LexerState\";\nimport { getTokenCategory } from \"@solve-js/language/TokenCategoryMap\";\nimport type { TokenCategory } from \"@solve-js/language/TokenCategory\";\nimport type { TokenLookup } from \"@solve-js/lexer/TokenClassRegistry\";\n\n/**\n * Public tokenizer wrapper around {@link ExpressionLexer}.\n *\n * `ExpressionLexer` does the actual character-by-character scanning;\n * `Lexer` adds a materialized-token-array streaming interface\n * (`next()`/`peek()`) plus line-classification state (`reset()`) so\n * callers can iterate a line's tokens without re-scanning on each peek.\n *\n * Each `ExpressionEngine` instance owns its own `Lexer`, and packages\n * extend it via {@link registerVocabulary} (keywords, operators, units)\n * see `IEnginePackage.lexerVocabulary`.\n */\nexport class Lexer {\n /** Expression-mode lexer (Phase A: V8-optimized, replaces moo) */\n private expressionLexer: ExpressionLexer;\n private currentState: LexerState = LexerState.Main;\n private peekedToken: Token | undefined;\n private hasPeeked = false;\n\n // Materialized token array from the last reset() call, used for\n // next()/peek() streaming access.\n private tokens: Token[] = [];\n private tokenIdx: number = 0;\n\n /**\n * @param localeCode - Locale code (e.g., \"en\", \"de\"). Defaults to \"en\".\n * @param tokenLookup - Optional TokenLookup from TokenClassRegistry.\n * When provided, configures ExpressionLexer to use registry-built\n * keyword/unit/phrase lookups instead of internal instance maps.\n */\n constructor(localeCode = \"en\", tokenLookup?: TokenLookup) {\n // Pass the lookup directly to ExpressionLexer's constructor, it's an\n // instance field now, not a static. Each Lexer instance gets its own\n // isolated lookup, preventing cross-instance corruption.\n this.expressionLexer = new ExpressionLexer(localeCode, tokenLookup);\n }\n\n reset(input: string, state?: LexerState): void {\n const newState = state ?? LexerState.Main;\n this.currentState = newState;\n this.hasPeeked = false;\n this.peekedToken = undefined;\n\n // Phase B: Main state classifies the line with the markdown scanner.\n // Skip lines (headings, fences, HRs, etc.) produce empty token arrays.\n // Expression lines and lines with inline solves are tokenized normally.\n if (newState === LexerState.Main) {\n const classification = this.expressionLexer.classifyLine(input);\n if (classification.skip) {\n this.tokens = [];\n this.tokenIdx = 0;\n return;\n }\n // Expression line or markdown line with inline solves, tokenize.\n this.expressionLexer.reset(input);\n this.tokens = this.expressionLexer.tokenizeAll();\n this.tokenIdx = 0;\n } else {\n // Non-main states (Inline, String), expression tokenization.\n this.expressionLexer.reset(input);\n this.tokens = this.expressionLexer.tokenizeAll();\n this.tokenIdx = 0;\n }\n }\n\n /**\n * Classify a single line of markdown text (Phase B).\n * Delegates to the ExpressionLexer's character-by-character scanner.\n */\n classifyLine(lineText: string): LineClassification {\n return this.expressionLexer.classifyLine(lineText);\n }\n\n /**\n * Find all inline solve markers in a line (Phase B).\n * Delegates to the ExpressionLexer's character-by-character scanner.\n */\n findInlineSolves(lineText: string) {\n return this.expressionLexer.findInlineSolves(lineText);\n }\n\n /**\n * Every keyword this lexer currently recognizes (locale + plugin-contributed),\n * mapped to the token type it lexes to. Delegates to the ExpressionLexer.\n */\n getKeywords(): Record<string, string> {\n return this.expressionLexer.getKeywords();\n }\n\n next(): Token | undefined {\n if (this.hasPeeked) {\n this.hasPeeked = false;\n return this.peekedToken;\n }\n // Materialized token array (ExpressionLexer path).\n if (this.tokenIdx < this.tokens.length) {\n return this.tokens[this.tokenIdx++];\n }\n return undefined;\n }\n\n peek(): Token | undefined {\n if (this.hasPeeked) return this.peekedToken;\n this.peekedToken = this.next();\n this.hasPeeked = true;\n return this.peekedToken;\n }\n\n [Symbol.iterator](): Iterator<Token> {\n return this.tokens[Symbol.iterator]();\n }\n\n /**\n * Register a plugin to extend the lexer with custom tokens.\n * Delegates to the underlying ExpressionLexer.\n *\n * @see LexerVocabulary for the supported extension points.\n */\n registerVocabulary(plugin: LexerVocabulary): void {\n this.expressionLexer.registerVocabulary(plugin);\n }\n\n /**\n * Unregister a plugin, removing its custom tokens from the lexer.\n * Delegates to the underlying ExpressionLexer.\n */\n unregisterVocabulary(plugin: LexerVocabulary): void {\n this.expressionLexer.unregisterVocabulary(plugin);\n }\n\n /**\n * Reset the lexer for expression-only text, skips the classifyLine()\n * overhead in reset() for callers that already know the input is an\n * evaluable expression (e.g., after isEmptyLine() confirmed non-skip).\n */\n resetExpression(input: string): void {\n this.currentState = LexerState.Main;\n this.hasPeeked = false;\n this.peekedToken = undefined;\n this.expressionLexer.reset(input);\n this.tokens = this.expressionLexer.tokenizeAll();\n this.tokenIdx = 0;\n }\n\n /**\n * Scan a full document in one pass, classifying each line and\n * tokenizing non-skipped lines. Delegates to ExpressionLexer.\n *\n * @returns ScanLineResult[], one per line, with classification + tokens.\n */\n scanDocument(text: string): ScanLineResult[] {\n return this.expressionLexer.scanDocument(text);\n }\n\n getState(): LexerState {\n return this.currentState;\n }\n\n setState(state: LexerState): void {\n this.currentState = state;\n }\n\n getHighlightTokens(lineText: string): {type: string; value: string; offset: number; col: number; length: number; category: TokenCategory | undefined}[] {\n const classification = this.expressionLexer.classifyLine(lineText);\n\n // For blockquote lines, strip the \"> \" prefix and tokenize the expression content.\n // This lets expressions inside blockquotes (e.g., \"> 1 + 2\") get syntax highlighted\n // while pure structural lines (headings, code fences) remain unhighlighted.\n if (classification.skip && lineText.startsWith(\"> \")) {\n return this.collectHighlightTokens(lineText.slice(2));\n }\n\n if (classification.skip) {\n return [];\n }\n\n return this.collectHighlightTokens(lineText);\n }\n\n /**\n * The same tokens {@link getHighlightTokens} reduces, before reduction.\n *\n * Exists because normalization operates on tokens, not on the flattened\n * shape, and a consumer that wants phrase-fused highlighting has to run the\n * normalizer between the two. See `LanguageService.getSemanticTokens`.\n *\n * @param lineText - One line of source.\n * @returns Every token on the line that is worth painting, unreduced.\n */\n getHighlightTokenObjects(lineText: string): Token[] {\n const classification = this.expressionLexer.classifyLine(lineText);\n if (classification.skip && lineText.startsWith(\"> \")) {\n return this.collectTokenObjects(lineText.slice(2));\n }\n if (classification.skip) return [];\n return this.collectTokenObjects(lineText);\n }\n\n private collectTokenObjects(lineText: string): Token[] {\n this.resetExpression(lineText);\n const result: Token[] = [];\n for (const token of this) {\n if (token.type === \"WS\" || token.type === \"NEWLINE\") continue;\n if (token.type.startsWith(\"MD_\")) continue;\n if (token.type === \"INLINE_SOLVE_START\" || token.type === \"BACKTICK_CLOSE\") continue;\n result.push(token);\n }\n return result;\n }\n\n private collectHighlightTokens(lineText: string): {type: string; value: string; offset: number; col: number; length: number; category: TokenCategory | undefined}[] {\n return this.collectTokenObjects(lineText).map(token => ({\n type: token.type,\n value: token.value,\n offset: token.offset,\n col: token.col,\n length: token.value.length,\n category: getTokenCategory(token.type),\n }));\n }\n}\n\n/**\n * A lexer for operations that do not depend on registered vocabulary.\n *\n * Line classification and inline-solve detection read characters looking for\n * headings, comment markers, fences and backtick spans, and never consult the\n * keyword, unit or operator tables. Every lexer therefore returns the same\n * answer, so the callers that have no engine to ask can use this one. Checked\n * by `__tests__/lexer/LineClassificationIsVocabularyIndependent.spec.ts`.\n *\n * Do not tokenize with this. An engine's own lexer carries the vocabulary its\n * packages registered; this one carries none.\n */\nexport const sharedLexer = new Lexer(\"en\", undefined);","/**\n * TokenClass, Plugin-extensible keyword registration for the Lexer.\n *\n * Providers call `registry.register(tokenClass)` to teach the lexer about\n * their keywords. The registry merges locale keywords, provider keywords,\n * phrase mappings, and unit names into an optimized TokenLookup structure\n * consumed by the Lexer.\n *\n * @example\n * registry.register({\n * tokenType: 'CARET',\n * keywords: {},\n * phrases: { 'to the power of': true, 'power of': true },\n * priority: 10,\n * description: 'Exponentiation operators (x^y)',\n * });\n */\nexport interface TokenClass {\n /** The token type string produced by the lexer (e.g., \"FUNC\", \"PI\", \"CARET\").\n * Must match a token type that a ParseletRegistry has a parselet for. */\n tokenType: string;\n\n /** Single-word keywords (case-insensitive). The lexer lowercases input\n * before lookup, so these should be lowercase. Example:\n * { sqrt: true, abs: true, sin: true, cos: true } for tokenType \"FUNC\" */\n keywords: Record<string, boolean>;\n\n /** Multi-word phrases (case-insensitive). Matched by the built-in PhraseMatcher\n * via the phrase trie. Example:\n * { \"to the power of\": true, \"power of\": true } for tokenType \"CARET\" */\n phrases?: Record<string, boolean>;\n\n /** Priority for conflict resolution. When two TokenClasses register\n * the same keyword, the higher-priority class wins. Locale keywords\n * have priority 0 (set via setLocale). Providers should use\n * priority >= 10 to override locale defaults. Default: 0 */\n priority?: number;\n\n /** Human-readable description for debugging and introspection */\n description?: string;\n}\n\n// ── Phrase Trie ──────────────────────────────────────────────────────────────\n\n/** Trie node for multi-word phrase matching. */\nexport interface PhraseNode {\n /** Complete phrase token type (null = intermediate node) */\n type?: string;\n children: Map<string, PhraseNode>;\n}\n\n// ── TokenLookup, Optimized lookup structure for the Lexer ──────────────────\n\n/**\n * The optimized lookup structure built by TokenClassRegistry.build().\n * Consumed by the Lexer for O(1) keyword → token type lookups and\n * O(word-count) phrase matching.\n */\nexport interface TokenLookup {\n /** Lowercase keyword → token type. O(1) Map lookup. */\n keywordToType: Map<string, string>;\n\n /** Phrase trie for multi-word matching. Root node with children maps.\n * Null if no phrases registered. */\n phraseTrie: PhraseNode | null;\n\n /** Set of lowercase first-words of all registered phrases.\n * Used by the lexer to emit IDENT (not a phrase keyword) for words\n * that start multi-word phrases, deferring to the PhraseMatcher.\n *\n * Example: \"to\" is in phraseStartWords because \"to the power of\" is a phrase.\n * When the lexer sees \"to\", it emits IDENT and lets the phrase matcher\n * combine \"to the power of\" into a single CARET token.\n *\n * This prevents plugins from accidentally overriding phrase-start words.\n */\n phraseStartWords: Set<string>;\n\n /** Case-sensitive unit names for UNIT fallback after keyword lookup fails. */\n unitNames: ReadonlySet<string>;\n}\n\n// ── TokenClassRegistry ───────────────────────────────────────────────────────\n\n/**\n * Central registry for keyword→token-type mappings.\n *\n * Providers register TokenClasses; locales provide keyword maps;\n * units provide a name set. `build()` merges all sources into an\n * optimized TokenLookup consumed by the Lexer.\n *\n * Merge order (later overrides earlier):\n * 1. Locale keywords (priority 0)\n * 2. Provider keywords (sorted by priority ascending, higher priority wins)\n *\n * Unit names are stored separately (checked AFTER keyword lookup fails).\n * Phrases are stored in a trie for O(phrase-length) matching.\n */\nexport class TokenClassRegistry {\n private classes: TokenClass[] = [];\n private localeKeywordMap: Record<string, string> | null = null;\n private localePhraseMap: Record<string, string> | null = null;\n private unitNames: ReadonlySet<string> | null = null;\n\n /**\n * Register a provider's TokenClass. Must be called BEFORE build().\n * Can be called multiple times to add more entries.\n *\n * Built-in token types CANNOT be overridden, throws a EngineError\n * if the TokenClass attempts to register a keyword that conflicts\n * with an already-registered token type.\n */\n register(tokenClass: TokenClass): void {\n this.classes.push(tokenClass);\n }\n\n /**\n * Unregister all TokenClasses for a given token type.\n * Useful for plugin unload. Requires rebuild() to take effect.\n */\n unregister(tokenType: string): void {\n this.classes = this.classes.filter(c => c.tokenType !== tokenType);\n }\n\n /**\n * Set the locale's keyword→type map and optional phrase map.\n * Called on locale change. Priority 0 (cannot override providers with higher priority).\n */\n setLocale(keywordMap: Record<string, string>, phraseMap?: Record<string, string>): void {\n this.localeKeywordMap = keywordMap;\n this.localePhraseMap = phraseMap ?? null;\n }\n\n /**\n * Set the unit name set. Called when unit list changes.\n * Units are stored separately (checked AFTER keyword lookup fails).\n *\n * Takes a ReadonlySet because the caller's set is derived from the\n * conversion tables and must not be mutated; this class only ever reads it.\n */\n setUnits(unitNames: ReadonlySet<string>): void {\n this.unitNames = unitNames;\n }\n\n /**\n * Build the optimized TokenLookup from all registered sources.\n *\n * Merge order (later overrides earlier):\n * 1. Locale keywords (priority 0)\n * 2. Provider classes (sorted by priority ascending)\n *\n * Returns a frozen TokenLookup that the Lexer consumes.\n * Call build() again after register()/setLocale()/setUnits() changes.\n */\n build(): TokenLookup {\n const keywordToType = new Map<string, string>();\n\n // Layer 1: Locale keywords (priority 0, lowest)\n if (this.localeKeywordMap) {\n for (const [keyword, tokenType] of Object.entries(this.localeKeywordMap)) {\n keywordToType.set(keyword.toLowerCase(), tokenType);\n }\n }\n\n // Layer 2: Provider keywords (sorted by priority ascending, higher wins)\n const sorted = [...this.classes].sort((a, b) => (a.priority ?? 0) - (b.priority ?? 0));\n for (const tc of sorted) {\n for (const keyword of Object.keys(tc.keywords)) {\n keywordToType.set(keyword.toLowerCase(), tc.tokenType);\n }\n }\n\n // Build phrase trie from locale + provider phrases\n const phraseTrie = this.buildPhraseTrie();\n\n // Build phraseStartWords set (first word of every phrase)\n const phraseStartWords = this.buildPhraseStartWords();\n\n return {\n keywordToType,\n phraseTrie,\n phraseStartWords,\n unitNames: this.unitNames ?? new Set(),\n };\n }\n\n // ── Private helpers ─────────────────────────────────────────────────────\n\n private buildPhraseTrie(): PhraseNode | null {\n const root: PhraseNode = { children: new Map() };\n\n // Layer 1: Locale phrases\n if (this.localePhraseMap) {\n for (const [phrase, tokenType] of Object.entries(this.localePhraseMap)) {\n this.insertPhrase(root, phrase.toLowerCase(), tokenType);\n }\n }\n\n // Layer 2: Provider phrases\n for (const tc of this.classes) {\n if (!tc.phrases) continue;\n for (const phrase of Object.keys(tc.phrases)) {\n this.insertPhrase(root, phrase.toLowerCase(), tc.tokenType);\n }\n }\n\n return root.children.size > 0 ? root : null;\n }\n\n private insertPhrase(root: PhraseNode, phrase: string, tokenType: string): void {\n const words = phrase.split(' ');\n let node = root;\n for (const word of words) {\n if (!node.children.has(word)) {\n node.children.set(word, { children: new Map() });\n }\n node = node.children.get(word)!;\n }\n // Only set type if not already set, first-registered (locale) wins\n if (!node.type) {\n node.type = tokenType;\n }\n }\n\n private buildPhraseStartWords(): Set<string> {\n const startWords = new Set<string>();\n\n // Locale phrase first words\n if (this.localePhraseMap) {\n for (const phrase of Object.keys(this.localePhraseMap)) {\n const first = phrase.split(' ')[0].toLowerCase();\n startWords.add(first);\n }\n }\n\n // Provider phrase first words\n for (const tc of this.classes) {\n if (!tc.phrases) continue;\n for (const phrase of Object.keys(tc.phrases)) {\n const first = phrase.split(' ')[0].toLowerCase();\n startWords.add(first);\n }\n }\n\n return startWords;\n }\n}","/**\n * tokenRegistration.ts, Bootstrap for building TokenLookup from locale, units, and phrases.\n *\n * This module centralizes the assembly of the TokenLookup consumed by ExpressionLexer.\n * It merges:\n * 1. Locale keywords (from ILocale.keywordMap)\n * 2. Built-in phrase patterns (to the power of, increase by, etc.)\n * 3. Known unit names (from units.ts)\n *\n * The resulting TokenLookup is frozen and passed to ExpressionLexer.configuredLookup\n * at construction time, enabling data-driven keyword/unit/phrase resolution.\n */\nimport { TokenClassRegistry } from '@solve-js/lexer/TokenClassRegistry';\nimport type { TokenLookup } from '@solve-js/lexer/TokenClassRegistry';\nimport { getLocale, type ILocale } from '@solve-js/constants/locales';\nimport { knownUnits } from '@solve-js/lexer/units';\n\n// ── Built-in phrase map ───────────────────────────────────────────────────\n// These are the multi-word expressions handled as compound tokens.\n// Matched by the PhraseMatcher (trie-based) in ExpressionLexer.tryMatchPhrase().\nconst BUILTIN_PHRASES: Record<string, string> = {\n 'to the power of': 'CARET',\n 'power of': 'CARET',\n 'increase by': 'INCREASE_BY',\n 'decrease by': 'DECREASE_BY',\n 'times by': 'TIMES_BY',\n 'multiply by': 'MULTIPLY_BY',\n 'multiplied by': 'MULTIPLY_BY',\n 'divide by': 'DIVIDE_BY',\n};\n\n/**\n * Build a TokenLookup from locale keywords, known units, and built-in phrases.\n *\n * Merge order (later overrides earlier):\n * 1. Locale keywords (priority 0, lowest, can be overridden by providers)\n * 2. Built-in phrases (via locale phraseMap)\n * 3. Known units (checked AFTER keyword lookup fails, via unitNames set)\n *\n * The resulting TokenLookup replaces the internal keyword map, unit set,\n * phrase trie, and phraseStartWords in ExpressionLexer when set via\n * ExpressionLexer.configuredLookup.\n *\n * @param localeCode - The locale code (e.g., \"en\", \"de\"). Defaults to \"en\".\n * @returns A frozen TokenLookup ready for consumption by the lexer.\n */\nexport function buildTokenLookup(localeCode = 'en'): TokenLookup {\n const locale: ILocale = getLocale(localeCode);\n const registry = new TokenClassRegistry();\n\n // Layer 1: Locale keywords (priority 0, lowest)\n registry.setLocale(locale.keywordMap, BUILTIN_PHRASES);\n\n // Layer 2: Known units (checked after keyword lookup)\n registry.setUnits(knownUnits);\n\n // Build and return the lookup\n return registry.build();\n}\n"]}
|
|
@@ -3,6 +3,179 @@
|
|
|
3
3
|
var chunkVEKIWQ3F_cjs = require('./chunk-VEKIWQ3F.cjs');
|
|
4
4
|
var chunkM4N5GA5Z_cjs = require('./chunk-M4N5GA5Z.cjs');
|
|
5
5
|
|
|
6
|
+
// src/uom/Iso4217.ts
|
|
7
|
+
var ISO_4217_CODES = /* @__PURE__ */ new Set([
|
|
8
|
+
"AED",
|
|
9
|
+
"AFN",
|
|
10
|
+
"ALL",
|
|
11
|
+
"AMD",
|
|
12
|
+
"ANG",
|
|
13
|
+
"AOA",
|
|
14
|
+
"ARS",
|
|
15
|
+
"AUD",
|
|
16
|
+
"AWG",
|
|
17
|
+
"AZN",
|
|
18
|
+
"BAM",
|
|
19
|
+
"BBD",
|
|
20
|
+
"BDT",
|
|
21
|
+
"BGN",
|
|
22
|
+
"BHD",
|
|
23
|
+
"BIF",
|
|
24
|
+
"BMD",
|
|
25
|
+
"BND",
|
|
26
|
+
"BOB",
|
|
27
|
+
"BOV",
|
|
28
|
+
"BRL",
|
|
29
|
+
"BSD",
|
|
30
|
+
"BTN",
|
|
31
|
+
"BWP",
|
|
32
|
+
"BYN",
|
|
33
|
+
"BZD",
|
|
34
|
+
"CAD",
|
|
35
|
+
"CDF",
|
|
36
|
+
"CHE",
|
|
37
|
+
"CHF",
|
|
38
|
+
"CHW",
|
|
39
|
+
"CLF",
|
|
40
|
+
"CLP",
|
|
41
|
+
"CNY",
|
|
42
|
+
"COP",
|
|
43
|
+
"COU",
|
|
44
|
+
"CRC",
|
|
45
|
+
"CUP",
|
|
46
|
+
"CVE",
|
|
47
|
+
"CZK",
|
|
48
|
+
"DJF",
|
|
49
|
+
"DKK",
|
|
50
|
+
"DOP",
|
|
51
|
+
"DZD",
|
|
52
|
+
"EGP",
|
|
53
|
+
"ERN",
|
|
54
|
+
"ETB",
|
|
55
|
+
"EUR",
|
|
56
|
+
"FJD",
|
|
57
|
+
"FKP",
|
|
58
|
+
"GBP",
|
|
59
|
+
"GEL",
|
|
60
|
+
"GHS",
|
|
61
|
+
"GIP",
|
|
62
|
+
"GMD",
|
|
63
|
+
"GNF",
|
|
64
|
+
"GTQ",
|
|
65
|
+
"GYD",
|
|
66
|
+
"HKD",
|
|
67
|
+
"HNL",
|
|
68
|
+
"HTG",
|
|
69
|
+
"HUF",
|
|
70
|
+
"IDR",
|
|
71
|
+
"ILS",
|
|
72
|
+
"INR",
|
|
73
|
+
"IQD",
|
|
74
|
+
"IRR",
|
|
75
|
+
"ISK",
|
|
76
|
+
"JMD",
|
|
77
|
+
"JOD",
|
|
78
|
+
"JPY",
|
|
79
|
+
"KES",
|
|
80
|
+
"KGS",
|
|
81
|
+
"KHR",
|
|
82
|
+
"KMF",
|
|
83
|
+
"KPW",
|
|
84
|
+
"KRW",
|
|
85
|
+
"KWD",
|
|
86
|
+
"KYD",
|
|
87
|
+
"KZT",
|
|
88
|
+
"LAK",
|
|
89
|
+
"LBP",
|
|
90
|
+
"LKR",
|
|
91
|
+
"LRD",
|
|
92
|
+
"LSL",
|
|
93
|
+
"LYD",
|
|
94
|
+
"MAD",
|
|
95
|
+
"MDL",
|
|
96
|
+
"MGA",
|
|
97
|
+
"MKD",
|
|
98
|
+
"MMK",
|
|
99
|
+
"MNT",
|
|
100
|
+
"MOP",
|
|
101
|
+
"MRU",
|
|
102
|
+
"MUR",
|
|
103
|
+
"MVR",
|
|
104
|
+
"MWK",
|
|
105
|
+
"MXN",
|
|
106
|
+
"MXV",
|
|
107
|
+
"MYR",
|
|
108
|
+
"MZN",
|
|
109
|
+
"NAD",
|
|
110
|
+
"NGN",
|
|
111
|
+
"NIO",
|
|
112
|
+
"NOK",
|
|
113
|
+
"NPR",
|
|
114
|
+
"NZD",
|
|
115
|
+
"OMR",
|
|
116
|
+
"PAB",
|
|
117
|
+
"PEN",
|
|
118
|
+
"PGK",
|
|
119
|
+
"PHP",
|
|
120
|
+
"PKR",
|
|
121
|
+
"PLN",
|
|
122
|
+
"PYG",
|
|
123
|
+
"QAR",
|
|
124
|
+
"RON",
|
|
125
|
+
"RSD",
|
|
126
|
+
"RUB",
|
|
127
|
+
"RWF",
|
|
128
|
+
"SAR",
|
|
129
|
+
"SBD",
|
|
130
|
+
"SCR",
|
|
131
|
+
"SDG",
|
|
132
|
+
"SEK",
|
|
133
|
+
"SGD",
|
|
134
|
+
"SHP",
|
|
135
|
+
"SLE",
|
|
136
|
+
"SOS",
|
|
137
|
+
"SRD",
|
|
138
|
+
"SSP",
|
|
139
|
+
"STN",
|
|
140
|
+
"SVC",
|
|
141
|
+
"SYP",
|
|
142
|
+
"SZL",
|
|
143
|
+
"THB",
|
|
144
|
+
"TJS",
|
|
145
|
+
"TMT",
|
|
146
|
+
"TND",
|
|
147
|
+
"TOP",
|
|
148
|
+
"TRY",
|
|
149
|
+
"TTD",
|
|
150
|
+
"TWD",
|
|
151
|
+
"TZS",
|
|
152
|
+
"UAH",
|
|
153
|
+
"UGX",
|
|
154
|
+
"USD",
|
|
155
|
+
"USN",
|
|
156
|
+
"UYI",
|
|
157
|
+
"UYU",
|
|
158
|
+
"UYW",
|
|
159
|
+
"UZS",
|
|
160
|
+
"VED",
|
|
161
|
+
"VES",
|
|
162
|
+
"VND",
|
|
163
|
+
"VUV",
|
|
164
|
+
"WST",
|
|
165
|
+
"XAF",
|
|
166
|
+
"XCD",
|
|
167
|
+
"XCG",
|
|
168
|
+
"XOF",
|
|
169
|
+
"XPF",
|
|
170
|
+
"YER",
|
|
171
|
+
"ZAR",
|
|
172
|
+
"ZMW",
|
|
173
|
+
"ZWG"
|
|
174
|
+
]);
|
|
175
|
+
function isIso4217(code) {
|
|
176
|
+
return ISO_4217_CODES.has(code.toUpperCase());
|
|
177
|
+
}
|
|
178
|
+
|
|
6
179
|
// src/uom/CurrencyExchange.ts
|
|
7
180
|
var CurrencyErrorCodes = {
|
|
8
181
|
/** Frankfurter's rates endpoint returned a non-OK HTTP status. */
|
|
@@ -224,67 +397,20 @@ var _CurrencyExchangeService = class _CurrencyExchangeService {
|
|
|
224
397
|
// CURRENCY VALIDATION
|
|
225
398
|
// ------------------------------------------------------------------------
|
|
226
399
|
/**
|
|
227
|
-
* Check whether `code` is a recognized currency code
|
|
228
|
-
* cryptocurrencies in {@link CRYPTO_IDS}
|
|
229
|
-
*
|
|
400
|
+
* Check whether `code` is a recognized currency code: any active ISO 4217
|
|
401
|
+
* code, or one of the cryptocurrencies in {@link CRYPTO_IDS}.
|
|
402
|
+
*
|
|
403
|
+
* This used to be a hand-written list of forty-six codes, which meant
|
|
404
|
+
* `$100 in UAH` returned an unconverted hundred dollars rather than saying
|
|
405
|
+
* it could not convert. Answering from the standard rather than from
|
|
406
|
+
* whichever codes happened to get added is what stops that class of bug.
|
|
407
|
+
*
|
|
408
|
+
* Recognising a code is not the same as having a rate for it. That is
|
|
409
|
+
* answered later, by the exchange provider; conflating the two is what
|
|
410
|
+
* produced the silent failure.
|
|
230
411
|
*/
|
|
231
412
|
isCurrency(code) {
|
|
232
|
-
|
|
233
|
-
"USD",
|
|
234
|
-
"EUR",
|
|
235
|
-
"GBP",
|
|
236
|
-
"JPY",
|
|
237
|
-
"AUD",
|
|
238
|
-
"CAD",
|
|
239
|
-
"CHF",
|
|
240
|
-
"CNY",
|
|
241
|
-
"SEK",
|
|
242
|
-
"NOK",
|
|
243
|
-
"DKK",
|
|
244
|
-
"NZD",
|
|
245
|
-
"KRW",
|
|
246
|
-
"SGD",
|
|
247
|
-
"HKD",
|
|
248
|
-
"INR",
|
|
249
|
-
"BRL",
|
|
250
|
-
"ZAR",
|
|
251
|
-
"MXN",
|
|
252
|
-
"RUB",
|
|
253
|
-
"TRY",
|
|
254
|
-
"SAR",
|
|
255
|
-
"AED",
|
|
256
|
-
"ILS",
|
|
257
|
-
"PLN",
|
|
258
|
-
"CZK",
|
|
259
|
-
"HUF",
|
|
260
|
-
"THB",
|
|
261
|
-
"IDR",
|
|
262
|
-
"MYR",
|
|
263
|
-
"PHP",
|
|
264
|
-
"CLP",
|
|
265
|
-
"COP",
|
|
266
|
-
"ARS",
|
|
267
|
-
"NGN",
|
|
268
|
-
"EGP",
|
|
269
|
-
"PKR",
|
|
270
|
-
"BDT",
|
|
271
|
-
"VND",
|
|
272
|
-
"KES",
|
|
273
|
-
"MAD",
|
|
274
|
-
"QAR",
|
|
275
|
-
"KWD",
|
|
276
|
-
"OMR",
|
|
277
|
-
"BHD",
|
|
278
|
-
"JOD",
|
|
279
|
-
"BTC",
|
|
280
|
-
"ETH",
|
|
281
|
-
"SOL",
|
|
282
|
-
"XRP",
|
|
283
|
-
"ADA",
|
|
284
|
-
"DOGE",
|
|
285
|
-
"DOT"
|
|
286
|
-
];
|
|
287
|
-
return knownCurrencies.includes(code.toUpperCase());
|
|
413
|
+
return isIso4217(code) || this.isCryptoCode(code);
|
|
288
414
|
}
|
|
289
415
|
};
|
|
290
416
|
/**
|
|
@@ -329,5 +455,5 @@ var sharedCurrencyExchange = currencyExchangeService;
|
|
|
329
455
|
exports.CurrencyExchangeService = CurrencyExchangeService;
|
|
330
456
|
exports.currencyExchangeService = currencyExchangeService;
|
|
331
457
|
exports.sharedCurrencyExchange = sharedCurrencyExchange;
|
|
332
|
-
//# sourceMappingURL=chunk-
|
|
333
|
-
//# sourceMappingURL=chunk-
|
|
458
|
+
//# sourceMappingURL=chunk-2MV4HBKC.cjs.map
|
|
459
|
+
//# sourceMappingURL=chunk-2MV4HBKC.cjs.map
|