solve-engine 1.0.0-beta.0 → 1.0.0-beta.2
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-3egMyuDi.d.cts +274 -0
- package/dist/BytecodeBuilder-3egMyuDi.d.ts +274 -0
- package/dist/Configuration-fVpd-HC-.d.cts +228 -0
- package/dist/Configuration-fVpd-HC-.d.ts +228 -0
- package/dist/EngineError-DvPSnhZi.d.cts +304 -0
- package/dist/EngineError-DvPSnhZi.d.ts +304 -0
- package/dist/Lexer-BJdhlnej.d.cts +531 -0
- package/dist/Lexer-D9l4Yrk2.d.ts +531 -0
- package/dist/NormalizerRule-BrVoVjmP.d.cts +163 -0
- package/dist/NormalizerRule-CEjf1FyD.d.ts +163 -0
- package/dist/PackageRegistry-D-Tv_7ca.d.cts +2572 -0
- package/dist/PackageRegistry-DaH4aIKP.d.ts +2572 -0
- package/dist/Parselet-CK8cQu2a.d.cts +299 -0
- package/dist/Parselet-ConOIdRO.d.ts +299 -0
- package/dist/ScopeManager-B5k0nk05.d.ts +559 -0
- package/dist/ScopeManager-CKfQtl7l.d.cts +559 -0
- package/dist/Token-0jpvUdPY.d.cts +245 -0
- package/dist/Token-0jpvUdPY.d.ts +245 -0
- package/dist/VMCheckpoints-BmDwIXgK.d.ts +171 -0
- package/dist/VMCheckpoints-CqFuLwrT.d.cts +171 -0
- package/dist/Value-KtAQNHur.d.cts +295 -0
- package/dist/Value-KtAQNHur.d.ts +295 -0
- package/dist/chunk-2RWAXT6O.js +3 -0
- package/dist/chunk-2RWAXT6O.js.map +1 -0
- package/dist/chunk-34RRD7PC.js +1492 -0
- package/dist/chunk-34RRD7PC.js.map +1 -0
- package/dist/chunk-3PPFLFH4.js +5097 -0
- package/dist/chunk-3PPFLFH4.js.map +1 -0
- package/dist/chunk-3VGDNEE3.js +84 -0
- package/dist/chunk-3VGDNEE3.js.map +1 -0
- package/dist/chunk-3YNVWKR2.cjs +370 -0
- package/dist/chunk-3YNVWKR2.cjs.map +1 -0
- package/dist/chunk-47LRVGOT.cjs +316 -0
- package/dist/chunk-47LRVGOT.cjs.map +1 -0
- package/dist/chunk-4MG4XKO2.js +1644 -0
- package/dist/chunk-4MG4XKO2.js.map +1 -0
- package/dist/chunk-4QADQTWS.js +2392 -0
- package/dist/chunk-4QADQTWS.js.map +1 -0
- package/dist/chunk-53B6KDDJ.cjs +1651 -0
- package/dist/chunk-53B6KDDJ.cjs.map +1 -0
- package/dist/chunk-5X2PTP6F.cjs +104 -0
- package/dist/chunk-5X2PTP6F.cjs.map +1 -0
- package/dist/chunk-5YEMOYSE.js +264 -0
- package/dist/chunk-5YEMOYSE.js.map +1 -0
- package/dist/chunk-64W6GLLZ.js +481 -0
- package/dist/chunk-64W6GLLZ.js.map +1 -0
- package/dist/chunk-6BKTCEUP.cjs +233 -0
- package/dist/chunk-6BKTCEUP.cjs.map +1 -0
- package/dist/chunk-6NTVRDQV.cjs +1642 -0
- package/dist/chunk-6NTVRDQV.cjs.map +1 -0
- package/dist/chunk-6RDSQURE.js +290 -0
- package/dist/chunk-6RDSQURE.js.map +1 -0
- package/dist/chunk-75JP4BZX.js +93 -0
- package/dist/chunk-75JP4BZX.js.map +1 -0
- package/dist/chunk-B7LXJ6LC.cjs +36 -0
- package/dist/chunk-B7LXJ6LC.cjs.map +1 -0
- package/dist/chunk-BVAR5J2F.js +257 -0
- package/dist/chunk-BVAR5J2F.js.map +1 -0
- package/dist/chunk-C4XZV6E7.cjs +269 -0
- package/dist/chunk-C4XZV6E7.cjs.map +1 -0
- package/dist/chunk-CCJPSHGI.cjs +40 -0
- package/dist/chunk-CCJPSHGI.cjs.map +1 -0
- package/dist/chunk-CLL7RUQV.cjs +316 -0
- package/dist/chunk-CLL7RUQV.cjs.map +1 -0
- package/dist/chunk-DM3LMRBC.js +329 -0
- package/dist/chunk-DM3LMRBC.js.map +1 -0
- package/dist/chunk-DUEZFTK2.js +38 -0
- package/dist/chunk-DUEZFTK2.js.map +1 -0
- package/dist/chunk-EBSPLUW4.cjs +489 -0
- package/dist/chunk-EBSPLUW4.cjs.map +1 -0
- package/dist/chunk-EHAHVROS.cjs +261 -0
- package/dist/chunk-EHAHVROS.cjs.map +1 -0
- package/dist/chunk-EIGTWK5N.js +167 -0
- package/dist/chunk-EIGTWK5N.js.map +1 -0
- package/dist/chunk-EPOXXJBK.js +96 -0
- package/dist/chunk-EPOXXJBK.js.map +1 -0
- package/dist/chunk-FEAIOR7N.cjs +91 -0
- package/dist/chunk-FEAIOR7N.cjs.map +1 -0
- package/dist/chunk-G535KJEG.js +312 -0
- package/dist/chunk-G535KJEG.js.map +1 -0
- package/dist/chunk-GCM5JHMX.js +88 -0
- package/dist/chunk-GCM5JHMX.js.map +1 -0
- package/dist/chunk-GOLDJNMZ.js +368 -0
- package/dist/chunk-GOLDJNMZ.js.map +1 -0
- package/dist/chunk-GW32KPCU.cjs +360 -0
- package/dist/chunk-GW32KPCU.cjs.map +1 -0
- package/dist/chunk-HTXVVJRA.cjs +1549 -0
- package/dist/chunk-HTXVVJRA.cjs.map +1 -0
- package/dist/chunk-HWSZJQCI.js +311 -0
- package/dist/chunk-HWSZJQCI.js.map +1 -0
- package/dist/chunk-IF532O7C.js +101 -0
- package/dist/chunk-IF532O7C.js.map +1 -0
- package/dist/chunk-J73SJHR3.cjs +2415 -0
- package/dist/chunk-J73SJHR3.cjs.map +1 -0
- package/dist/chunk-JBSYC7BB.cjs +7473 -0
- package/dist/chunk-JBSYC7BB.cjs.map +1 -0
- package/dist/chunk-KVILKGMS.js +228 -0
- package/dist/chunk-KVILKGMS.js.map +1 -0
- package/dist/chunk-LIPPNDBE.js +258 -0
- package/dist/chunk-LIPPNDBE.js.map +1 -0
- package/dist/chunk-LR7YASZF.cjs +172 -0
- package/dist/chunk-LR7YASZF.cjs.map +1 -0
- package/dist/chunk-M4N5GA5Z.cjs +309 -0
- package/dist/chunk-M4N5GA5Z.cjs.map +1 -0
- package/dist/chunk-M5LX5AOO.js +7459 -0
- package/dist/chunk-M5LX5AOO.js.map +1 -0
- package/dist/chunk-MZOVP3WI.cjs +96 -0
- package/dist/chunk-MZOVP3WI.cjs.map +1 -0
- package/dist/chunk-N5YFR4UP.cjs +10 -0
- package/dist/chunk-N5YFR4UP.cjs.map +1 -0
- package/dist/chunk-NGBBNL4K.cjs +4 -0
- package/dist/chunk-NGBBNL4K.cjs.map +1 -0
- package/dist/chunk-NH2O2AUR.js +146 -0
- package/dist/chunk-NH2O2AUR.js.map +1 -0
- package/dist/chunk-NLNDMWZC.js +31 -0
- package/dist/chunk-NLNDMWZC.js.map +1 -0
- package/dist/chunk-NMCRQP3Z.cjs +778 -0
- package/dist/chunk-NMCRQP3Z.cjs.map +1 -0
- package/dist/chunk-NMD5VRN4.cjs +1327 -0
- package/dist/chunk-NMD5VRN4.cjs.map +1 -0
- package/dist/chunk-OC6LTXYS.cjs +286 -0
- package/dist/chunk-OC6LTXYS.cjs.map +1 -0
- package/dist/chunk-OT6OJY7C.cjs +114 -0
- package/dist/chunk-OT6OJY7C.cjs.map +1 -0
- package/dist/chunk-PFSDGGYL.js +8 -0
- package/dist/chunk-PFSDGGYL.js.map +1 -0
- package/dist/chunk-QNJ4ACRT.cjs +155 -0
- package/dist/chunk-QNJ4ACRT.cjs.map +1 -0
- package/dist/chunk-QWY3VEZN.js +1637 -0
- package/dist/chunk-QWY3VEZN.js.map +1 -0
- package/dist/chunk-RFYD5TJE.js +111 -0
- package/dist/chunk-RFYD5TJE.js.map +1 -0
- package/dist/chunk-RIN643A3.js +354 -0
- package/dist/chunk-RIN643A3.js.map +1 -0
- package/dist/chunk-RZCWSXTA.cjs +5122 -0
- package/dist/chunk-RZCWSXTA.cjs.map +1 -0
- package/dist/chunk-SDGRK7EP.js +774 -0
- package/dist/chunk-SDGRK7EP.js.map +1 -0
- package/dist/chunk-VEKIWQ3F.cjs +39 -0
- package/dist/chunk-VEKIWQ3F.cjs.map +1 -0
- package/dist/chunk-WQTTOGXC.cjs +99 -0
- package/dist/chunk-WQTTOGXC.cjs.map +1 -0
- package/dist/chunk-X6K3HUOY.cjs +86 -0
- package/dist/chunk-X6K3HUOY.cjs.map +1 -0
- package/dist/chunk-XJCMXB2E.cjs +333 -0
- package/dist/chunk-XJCMXB2E.cjs.map +1 -0
- package/dist/chunk-XVWCOTR6.js +1324 -0
- package/dist/chunk-XVWCOTR6.js.map +1 -0
- package/dist/chunk-YLJ4XMA6.js +33 -0
- package/dist/chunk-YLJ4XMA6.js.map +1 -0
- package/dist/chunk-Z2XP767T.cjs +35 -0
- package/dist/chunk-Z2XP767T.cjs.map +1 -0
- package/dist/chunk-Z4X2RWOF.js +37 -0
- package/dist/chunk-Z4X2RWOF.js.map +1 -0
- package/dist/constants.cjs +22 -0
- package/dist/constants.cjs.map +1 -0
- package/dist/constants.d.cts +12 -0
- package/dist/constants.d.ts +12 -0
- package/dist/constants.js +5 -0
- package/dist/constants.js.map +1 -0
- package/dist/engine.cjs +79 -0
- package/dist/engine.cjs.map +1 -0
- package/dist/engine.d.cts +587 -0
- package/dist/engine.d.ts +587 -0
- package/dist/engine.js +34 -0
- package/dist/engine.js.map +1 -0
- package/dist/errors.cjs +81 -0
- package/dist/errors.cjs.map +1 -0
- package/dist/errors.d.cts +95 -0
- package/dist/errors.d.ts +95 -0
- package/dist/errors.js +4 -0
- package/dist/errors.js.map +1 -0
- package/dist/format.cjs +171 -0
- package/dist/format.cjs.map +1 -0
- package/dist/format.d.cts +51 -0
- package/dist/format.d.ts +51 -0
- package/dist/format.js +168 -0
- package/dist/format.js.map +1 -0
- package/dist/index.cjs +97 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +152 -0
- package/dist/index.d.ts +152 -0
- package/dist/index.js +75 -0
- package/dist/index.js.map +1 -0
- package/dist/language.cjs +308 -0
- package/dist/language.cjs.map +1 -0
- package/dist/language.d.cts +110 -0
- package/dist/language.d.ts +110 -0
- package/dist/language.js +287 -0
- package/dist/language.js.map +1 -0
- package/dist/lexer.cjs +64 -0
- package/dist/lexer.cjs.map +1 -0
- package/dist/lexer.d.cts +56 -0
- package/dist/lexer.d.ts +56 -0
- package/dist/lexer.js +11 -0
- package/dist/lexer.js.map +1 -0
- package/dist/normalizer.cjs +40 -0
- package/dist/normalizer.cjs.map +1 -0
- package/dist/normalizer.d.cts +364 -0
- package/dist/normalizer.d.ts +364 -0
- package/dist/normalizer.js +11 -0
- package/dist/normalizer.js.map +1 -0
- package/dist/packages.cjs +121 -0
- package/dist/packages.cjs.map +1 -0
- package/dist/packages.d.cts +691 -0
- package/dist/packages.d.ts +691 -0
- package/dist/packages.js +24 -0
- package/dist/packages.js.map +1 -0
- package/dist/parser.cjs +55 -0
- package/dist/parser.cjs.map +1 -0
- package/dist/parser.d.cts +46 -0
- package/dist/parser.d.ts +46 -0
- package/dist/parser.js +10 -0
- package/dist/parser.js.map +1 -0
- package/dist/pipeline-CrsRPmsv.d.ts +285 -0
- package/dist/pipeline-DPUQt7yL.d.cts +285 -0
- package/dist/resolvers.cjs +13 -0
- package/dist/resolvers.cjs.map +1 -0
- package/dist/resolvers.d.cts +111 -0
- package/dist/resolvers.d.ts +111 -0
- package/dist/resolvers.js +4 -0
- package/dist/resolvers.js.map +1 -0
- package/dist/services.cjs +21 -0
- package/dist/services.cjs.map +1 -0
- package/dist/services.d.cts +30 -0
- package/dist/services.d.ts +30 -0
- package/dist/services.js +4 -0
- package/dist/services.js.map +1 -0
- package/dist/uom.cjs +56 -0
- package/dist/uom.cjs.map +1 -0
- package/dist/uom.d.cts +224 -0
- package/dist/uom.d.ts +224 -0
- package/dist/uom.js +11 -0
- package/dist/uom.js.map +1 -0
- package/dist/utilities.cjs +32 -0
- package/dist/utilities.cjs.map +1 -0
- package/dist/utilities.d.cts +113 -0
- package/dist/utilities.d.ts +113 -0
- package/dist/utilities.js +7 -0
- package/dist/utilities.js.map +1 -0
- package/dist/variables.cjs +17 -0
- package/dist/variables.cjs.map +1 -0
- package/dist/variables.d.cts +87 -0
- package/dist/variables.d.ts +87 -0
- package/dist/variables.js +4 -0
- package/dist/variables.js.map +1 -0
- package/dist/vm.cjs +284 -0
- package/dist/vm.cjs.map +1 -0
- package/dist/vm.d.cts +68 -0
- package/dist/vm.d.ts +68 -0
- package/dist/vm.js +194 -0
- package/dist/vm.js.map +1 -0
- package/package.json +4 -4
|
@@ -0,0 +1,1327 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkGW32KPCU_cjs = require('./chunk-GW32KPCU.cjs');
|
|
4
|
+
var chunk3YNVWKR2_cjs = require('./chunk-3YNVWKR2.cjs');
|
|
5
|
+
var chunkEHAHVROS_cjs = require('./chunk-EHAHVROS.cjs');
|
|
6
|
+
var chunkM4N5GA5Z_cjs = require('./chunk-M4N5GA5Z.cjs');
|
|
7
|
+
|
|
8
|
+
// src/lexer/ExpressionLexer.ts
|
|
9
|
+
chunkGW32KPCU_cjs.registerAllTokenTypes();
|
|
10
|
+
function buildCharClassTable() {
|
|
11
|
+
const table = new Uint8Array(128);
|
|
12
|
+
for (let i = 48; i <= 57; i++) table[i] = 2 /* DIGIT */;
|
|
13
|
+
for (let i = 65; i <= 90; i++) table[i] = 3 /* ALPHA */;
|
|
14
|
+
for (let i = 97; i <= 122; i++) table[i] = 3 /* ALPHA */;
|
|
15
|
+
table[95] = 3 /* ALPHA */;
|
|
16
|
+
table[46] = 4 /* DOT */;
|
|
17
|
+
table[32] = 1 /* WHITESPACE */;
|
|
18
|
+
table[9] = 1 /* WHITESPACE */;
|
|
19
|
+
table[10] = 1 /* WHITESPACE */;
|
|
20
|
+
table[13] = 1 /* WHITESPACE */;
|
|
21
|
+
table[33] = 5 /* OPERATOR */;
|
|
22
|
+
table[37] = 5 /* OPERATOR */;
|
|
23
|
+
table[38] = 5 /* OPERATOR */;
|
|
24
|
+
table[40] = 5 /* OPERATOR */;
|
|
25
|
+
table[41] = 5 /* OPERATOR */;
|
|
26
|
+
table[42] = 5 /* OPERATOR */;
|
|
27
|
+
table[43] = 5 /* OPERATOR */;
|
|
28
|
+
table[44] = 5 /* OPERATOR */;
|
|
29
|
+
table[45] = 5 /* OPERATOR */;
|
|
30
|
+
table[47] = 5 /* OPERATOR */;
|
|
31
|
+
table[58] = 5 /* OPERATOR */;
|
|
32
|
+
table[59] = 5 /* OPERATOR */;
|
|
33
|
+
table[60] = 5 /* OPERATOR */;
|
|
34
|
+
table[61] = 5 /* OPERATOR */;
|
|
35
|
+
table[62] = 5 /* OPERATOR */;
|
|
36
|
+
table[63] = 5 /* OPERATOR */;
|
|
37
|
+
table[91] = 5 /* OPERATOR */;
|
|
38
|
+
table[93] = 5 /* OPERATOR */;
|
|
39
|
+
table[94] = 5 /* OPERATOR */;
|
|
40
|
+
table[123] = 5 /* OPERATOR */;
|
|
41
|
+
table[124] = 5 /* OPERATOR */;
|
|
42
|
+
table[125] = 5 /* OPERATOR */;
|
|
43
|
+
table[126] = 5 /* OPERATOR */;
|
|
44
|
+
table[64] = 5 /* OPERATOR */;
|
|
45
|
+
table[34] = 6 /* QUOTE */;
|
|
46
|
+
table[35] = 7 /* HASH */;
|
|
47
|
+
table[36] = 8 /* DOLLAR */;
|
|
48
|
+
table[96] = 11 /* BACKTICK */;
|
|
49
|
+
return table;
|
|
50
|
+
}
|
|
51
|
+
var LexerToken = class {
|
|
52
|
+
constructor(type, typeId, value, text, offset, lineBreaks, line, col) {
|
|
53
|
+
this.type = type;
|
|
54
|
+
this.typeId = typeId;
|
|
55
|
+
this.value = value;
|
|
56
|
+
this.text = text;
|
|
57
|
+
this.offset = offset;
|
|
58
|
+
this.lineBreaks = lineBreaks;
|
|
59
|
+
this.line = line;
|
|
60
|
+
this.col = col;
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
var TWO_CHAR_OPS = {
|
|
64
|
+
61: { 61: "EQUALITY", 62: "THEREFORE" },
|
|
65
|
+
// ==, => (opposite char order from >='s GTE below — no collision)
|
|
66
|
+
33: { 61: "NEQ" },
|
|
67
|
+
// !=
|
|
68
|
+
62: { 61: "GTE" },
|
|
69
|
+
// >=
|
|
70
|
+
60: { 61: "LTE" },
|
|
71
|
+
// <=
|
|
72
|
+
38: { 38: "LOGICAL_AND" },
|
|
73
|
+
// &&
|
|
74
|
+
124: { 124: "LOGICAL_OR" }
|
|
75
|
+
// ||
|
|
76
|
+
// Note: ** is NOT a single token, the existing moo lexer emits two
|
|
77
|
+
// separate STAR tokens, and the parser consumes them that way.
|
|
78
|
+
// 42: { 42: 'EXPONENT' }, // **, disabled for moo compatibility
|
|
79
|
+
};
|
|
80
|
+
var OP_MAP = {
|
|
81
|
+
43: "PLUS",
|
|
82
|
+
// +
|
|
83
|
+
45: "MINUS",
|
|
84
|
+
// -
|
|
85
|
+
42: "STAR",
|
|
86
|
+
// *
|
|
87
|
+
47: "SLASH",
|
|
88
|
+
// /
|
|
89
|
+
94: "CARET",
|
|
90
|
+
// ^
|
|
91
|
+
37: "PERCENT",
|
|
92
|
+
// %
|
|
93
|
+
40: "LPAREN",
|
|
94
|
+
// (
|
|
95
|
+
41: "RPAREN",
|
|
96
|
+
// )
|
|
97
|
+
91: "LBRACKET",
|
|
98
|
+
// [
|
|
99
|
+
93: "RBRACKET",
|
|
100
|
+
// ]
|
|
101
|
+
123: "LBRACE",
|
|
102
|
+
// {
|
|
103
|
+
125: "RBRACE",
|
|
104
|
+
// }
|
|
105
|
+
44: "COMMA",
|
|
106
|
+
// ,
|
|
107
|
+
58: "COLON",
|
|
108
|
+
// :
|
|
109
|
+
59: "SEMICOLON",
|
|
110
|
+
// ;
|
|
111
|
+
61: "EQUALS",
|
|
112
|
+
// =
|
|
113
|
+
63: "QUESTION",
|
|
114
|
+
// ?
|
|
115
|
+
33: "BANG",
|
|
116
|
+
// !
|
|
117
|
+
38: "BIT_AND",
|
|
118
|
+
// &
|
|
119
|
+
124: "BIT_OR",
|
|
120
|
+
// |
|
|
121
|
+
60: "LT",
|
|
122
|
+
// <
|
|
123
|
+
62: "GT",
|
|
124
|
+
// >
|
|
125
|
+
126: "BIT_NOT",
|
|
126
|
+
// ~
|
|
127
|
+
// "@", activates the token type name already dormant-reserved for this
|
|
128
|
+
// exact purpose (see Token.ts's OVER/RATE_AT doc comment and
|
|
129
|
+
// normalizer/TokenNormalizer.ts's NON_WORD_NAMES, both of which already
|
|
130
|
+
// anticipated "AT" as a future "@" symbol token before this addition).
|
|
131
|
+
// Backs the time package's video-timecode literal's alternate fps
|
|
132
|
+
// separator (`01:02:03:04 @ 30fps`, equivalent to `... at 30fps`). See
|
|
133
|
+
// packages/time/parselets/VideoTimecodeParselet.ts.
|
|
134
|
+
64: "AT"
|
|
135
|
+
// @
|
|
136
|
+
};
|
|
137
|
+
var EXPRESSION_INDICATOR_CODES = (() => {
|
|
138
|
+
const set = /* @__PURE__ */ new Set();
|
|
139
|
+
for (let i = 48; i <= 57; i++) set.add(i);
|
|
140
|
+
const opCodes = [43, 45, 42, 47, 94, 37, 40, 41, 91, 93, 123, 125, 61, 60, 62, 33, 38, 124, 126, 59, 63];
|
|
141
|
+
for (const c of opCodes) set.add(c);
|
|
142
|
+
set.add(36);
|
|
143
|
+
set.add(163);
|
|
144
|
+
set.add(8364);
|
|
145
|
+
set.add(165);
|
|
146
|
+
set.add(8381);
|
|
147
|
+
set.add(8361);
|
|
148
|
+
set.add(96);
|
|
149
|
+
set.add(46);
|
|
150
|
+
set.add(35);
|
|
151
|
+
return set;
|
|
152
|
+
})();
|
|
153
|
+
var _ExpressionLexer = class _ExpressionLexer {
|
|
154
|
+
constructor(localeCode = "en", lookup) {
|
|
155
|
+
/**
|
|
156
|
+
* Configured TokenLookup from TokenClassRegistry. When set, replaces
|
|
157
|
+
* the internal keyword map and unit set with registry-built equivalents.
|
|
158
|
+
* Enables data-driven keyword/unit registration across locale keywords,
|
|
159
|
+
* provider keywords, and plugins.
|
|
160
|
+
*
|
|
161
|
+
* Set at construction time via the constructor parameter. Plugin-registered
|
|
162
|
+
* keywords/units (via registerVocabulary()) are checked alongside
|
|
163
|
+
* the configuredLookup, neither source is bypassed.
|
|
164
|
+
*/
|
|
165
|
+
this.configuredLookup = null;
|
|
166
|
+
// Instance state
|
|
167
|
+
this.input = "";
|
|
168
|
+
this.pos = 0;
|
|
169
|
+
this.len = 0;
|
|
170
|
+
// Line / column tracking (1-indexed)
|
|
171
|
+
this.line = 1;
|
|
172
|
+
this.lineStartPos = 0;
|
|
173
|
+
// Plugin-extensible keyword map (merged with locale keywordMap)
|
|
174
|
+
this.pluginKeywordMap = /* @__PURE__ */ new Map();
|
|
175
|
+
// Plugin-extensible two-char operators: firstChar → (secondChar → tokenType)
|
|
176
|
+
this.pluginOperators = /* @__PURE__ */ new Map();
|
|
177
|
+
// Plugin-extensible units (merged with knownUnits)
|
|
178
|
+
this.pluginUnits = /* @__PURE__ */ new Set();
|
|
179
|
+
// Fast-path guards: skip plugin lookups entirely when no plugins registered
|
|
180
|
+
this.hasPluginOps = false;
|
|
181
|
+
/**
|
|
182
|
+
* Inline solve spans collected during the most recent tokenization pass.
|
|
183
|
+
* Populated by [Symbol.iterator]() and consumed by scanDocument().
|
|
184
|
+
*/
|
|
185
|
+
this._inlineSolveSpans = [];
|
|
186
|
+
// Plugin-extensible raw-line patterns. See LexerVocabulary.rawLinePatterns.
|
|
187
|
+
this.pluginRawLinePatterns = [];
|
|
188
|
+
/**
|
|
189
|
+
* If a `rawLinePatterns` rule matches the FULL text most recently passed
|
|
190
|
+
* to {@link reset}, this holds the single synthetic token that
|
|
191
|
+
* {@link tokenizeAll} should return instead of running the
|
|
192
|
+
* character-by-character scanner. Cleared (re-evaluated) on every
|
|
193
|
+
* {@link reset} call. `null` when no plugin registered any raw-line
|
|
194
|
+
* patterns, or none matched, the overwhelmingly common case, checked
|
|
195
|
+
* with a `length === 0` guard before ever touching this field so a
|
|
196
|
+
* plugin-free lexer pays zero cost for the feature.
|
|
197
|
+
*/
|
|
198
|
+
this.pendingRawLineToken = null;
|
|
199
|
+
this.localeCode = localeCode;
|
|
200
|
+
this.locale = chunk3YNVWKR2_cjs.getLocale(localeCode);
|
|
201
|
+
this.configuredLookup = lookup ?? null;
|
|
202
|
+
this.keywordMap = /* @__PURE__ */ new Map();
|
|
203
|
+
for (const [k, v] of Object.entries(this.locale.keywordMap)) {
|
|
204
|
+
this.keywordMap.set(k.toLowerCase(), v);
|
|
205
|
+
}
|
|
206
|
+
this.mergedKeywords = new Map(this.keywordMap);
|
|
207
|
+
this.mergedUnits = new Set(chunkEHAHVROS_cjs.knownUnits);
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Test `text` against every registered `rawLinePatterns` rule, in
|
|
211
|
+
* registration order. Returns a synthetic token for the first rule
|
|
212
|
+
* whose `pattern` matches AND whose capture group 1 is non-empty after
|
|
213
|
+
* trimming; returns `null` if no rule matches (the normal
|
|
214
|
+
* character-by-character scanner should run instead).
|
|
215
|
+
*/
|
|
216
|
+
matchRawLine(text) {
|
|
217
|
+
for (const rule of this.pluginRawLinePatterns) {
|
|
218
|
+
const m = rule.pattern.exec(text);
|
|
219
|
+
if (m && typeof m[1] === "string") {
|
|
220
|
+
const value = m[1].trim();
|
|
221
|
+
if (value.length > 0) {
|
|
222
|
+
return new LexerToken(rule.tokenType, chunkGW32KPCU_cjs.tokenTypeId(rule.tokenType), value, value, 0, 0, this.line, 1);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
return null;
|
|
227
|
+
}
|
|
228
|
+
/** Rebuild merged keyword and unit collections after plugin registration. */
|
|
229
|
+
rebuildMergedCollections() {
|
|
230
|
+
this.mergedKeywords = new Map([...this.keywordMap, ...this.pluginKeywordMap]);
|
|
231
|
+
this.mergedUnits = /* @__PURE__ */ new Set([...chunkEHAHVROS_cjs.knownUnits, ...this.pluginUnits]);
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Register a plugin to extend the lexer with custom tokens.
|
|
235
|
+
*
|
|
236
|
+
* All registrations are additive, built-in patterns still work.
|
|
237
|
+
* Keywords, operators, and units from the plugin are merged
|
|
238
|
+
* with existing ones. Calling multiple times adds more entries.
|
|
239
|
+
*
|
|
240
|
+
* Note: multi-word phrases are now handled by the TokenNormalizer
|
|
241
|
+
* (see `IEnginePackage.normalizerRules`), not the lexer.
|
|
242
|
+
*
|
|
243
|
+
* Built-in tokens CANNOT be overridden. Throws a EngineError if the
|
|
244
|
+
* plugin attempts to register a keyword, operator, or unit
|
|
245
|
+
* that conflicts with a built-in one.
|
|
246
|
+
*/
|
|
247
|
+
registerVocabulary(plugin) {
|
|
248
|
+
if (plugin.keywords) {
|
|
249
|
+
for (const [keyword, tokenType] of Object.entries(plugin.keywords)) {
|
|
250
|
+
const lower = keyword.toLowerCase();
|
|
251
|
+
if (this.keywordMap.has(lower)) {
|
|
252
|
+
throw chunkM4N5GA5Z_cjs.ErrorFactory.config(
|
|
253
|
+
"PLUGIN_KEYWORD_COLLISION",
|
|
254
|
+
`Plugin keyword "${keyword}" conflicts with built-in keyword (type: ${this.keywordMap.get(lower)}). Built-in keywords cannot be overridden.`,
|
|
255
|
+
{ keyword, builtinType: this.keywordMap.get(lower) }
|
|
256
|
+
);
|
|
257
|
+
}
|
|
258
|
+
this.pluginKeywordMap.set(lower, tokenType);
|
|
259
|
+
}
|
|
260
|
+
this.rebuildMergedCollections();
|
|
261
|
+
}
|
|
262
|
+
if (plugin.operators) {
|
|
263
|
+
this.hasPluginOps = true;
|
|
264
|
+
for (const [chars, tokenType] of Object.entries(plugin.operators)) {
|
|
265
|
+
if (chars.length === 2) {
|
|
266
|
+
const first = chars.charCodeAt(0);
|
|
267
|
+
const second = chars.charCodeAt(1);
|
|
268
|
+
const builtInSecondMap = TWO_CHAR_OPS[first];
|
|
269
|
+
if (builtInSecondMap && builtInSecondMap[second] !== void 0) {
|
|
270
|
+
throw chunkM4N5GA5Z_cjs.ErrorFactory.config(
|
|
271
|
+
"PLUGIN_OPERATOR_COLLISION",
|
|
272
|
+
`Plugin operator "${chars}" conflicts with built-in operator (type: ${builtInSecondMap[second]}). Built-in operators cannot be overridden.`,
|
|
273
|
+
{ operator: chars, builtinType: builtInSecondMap[second] }
|
|
274
|
+
);
|
|
275
|
+
}
|
|
276
|
+
if (first === 60 && second === 60) {
|
|
277
|
+
throw chunkM4N5GA5Z_cjs.ErrorFactory.config(
|
|
278
|
+
"PLUGIN_OPERATOR_COLLISION",
|
|
279
|
+
`Plugin operator "${chars}" conflicts with built-in operator (type: LSHIFT). Built-in operators cannot be overridden.`,
|
|
280
|
+
{ operator: chars, builtinType: "LSHIFT" }
|
|
281
|
+
);
|
|
282
|
+
}
|
|
283
|
+
if (first === 62 && second === 62) {
|
|
284
|
+
throw chunkM4N5GA5Z_cjs.ErrorFactory.config(
|
|
285
|
+
"PLUGIN_OPERATOR_COLLISION",
|
|
286
|
+
`Plugin operator "${chars}" conflicts with built-in operator (type: RSHIFT). Built-in operators cannot be overridden.`,
|
|
287
|
+
{ operator: chars, builtinType: "RSHIFT" }
|
|
288
|
+
);
|
|
289
|
+
}
|
|
290
|
+
if (first === 47 && second === 47) {
|
|
291
|
+
throw chunkM4N5GA5Z_cjs.ErrorFactory.config(
|
|
292
|
+
"PLUGIN_OPERATOR_COLLISION",
|
|
293
|
+
`Plugin operator "${chars}" conflicts with built-in comment sequence. Comment sequences cannot be overridden.`,
|
|
294
|
+
{ operator: chars, builtinType: "COMMENT" }
|
|
295
|
+
);
|
|
296
|
+
}
|
|
297
|
+
let inner = this.pluginOperators.get(first);
|
|
298
|
+
if (!inner) {
|
|
299
|
+
inner = /* @__PURE__ */ new Map();
|
|
300
|
+
this.pluginOperators.set(first, inner);
|
|
301
|
+
}
|
|
302
|
+
inner.set(second, tokenType);
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
if (plugin.units) {
|
|
307
|
+
for (const unit of plugin.units) {
|
|
308
|
+
if (chunkEHAHVROS_cjs.knownUnits.has(unit)) {
|
|
309
|
+
throw chunkM4N5GA5Z_cjs.ErrorFactory.config(
|
|
310
|
+
"PLUGIN_UNIT_COLLISION",
|
|
311
|
+
`Plugin unit "${unit}" conflicts with a built-in unit. Built-in units cannot be overridden.`,
|
|
312
|
+
{ unit }
|
|
313
|
+
);
|
|
314
|
+
}
|
|
315
|
+
this.pluginUnits.add(unit);
|
|
316
|
+
}
|
|
317
|
+
this.rebuildMergedCollections();
|
|
318
|
+
}
|
|
319
|
+
if (plugin.rawLinePatterns) {
|
|
320
|
+
this.pluginRawLinePatterns.push(...plugin.rawLinePatterns);
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* Unregister a plugin, removing its custom tokens from the lexer.
|
|
325
|
+
*
|
|
326
|
+
* This is the inverse of registerVocabulary(). All keywords, operators,
|
|
327
|
+
* and units registered by the plugin are removed. After
|
|
328
|
+
* unregistration, those tokens will revert to their default behavior
|
|
329
|
+
* (e.g., keywords become IDENT, operators become ERROR).
|
|
330
|
+
*
|
|
331
|
+
* Calling unregisterVocabulary with a plugin that was never registered
|
|
332
|
+
* is safe, it simply has no effect.
|
|
333
|
+
*/
|
|
334
|
+
unregisterVocabulary(plugin) {
|
|
335
|
+
if (plugin.keywords) {
|
|
336
|
+
for (const keyword of Object.keys(plugin.keywords)) {
|
|
337
|
+
this.pluginKeywordMap.delete(keyword.toLowerCase());
|
|
338
|
+
}
|
|
339
|
+
this.rebuildMergedCollections();
|
|
340
|
+
}
|
|
341
|
+
if (plugin.operators) {
|
|
342
|
+
for (const chars of Object.keys(plugin.operators)) {
|
|
343
|
+
if (chars.length === 2) {
|
|
344
|
+
const first = chars.charCodeAt(0);
|
|
345
|
+
const second = chars.charCodeAt(1);
|
|
346
|
+
const inner = this.pluginOperators.get(first);
|
|
347
|
+
if (inner) {
|
|
348
|
+
inner.delete(second);
|
|
349
|
+
if (inner.size === 0) {
|
|
350
|
+
this.pluginOperators.delete(first);
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
this.hasPluginOps = this.pluginOperators.size > 0;
|
|
356
|
+
}
|
|
357
|
+
if (plugin.units) {
|
|
358
|
+
for (const unit of plugin.units) {
|
|
359
|
+
this.pluginUnits.delete(unit);
|
|
360
|
+
}
|
|
361
|
+
this.rebuildMergedCollections();
|
|
362
|
+
}
|
|
363
|
+
if (plugin.rawLinePatterns) {
|
|
364
|
+
const toRemove = new Set(plugin.rawLinePatterns);
|
|
365
|
+
this.pluginRawLinePatterns = this.pluginRawLinePatterns.filter((r) => !toRemove.has(r));
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
reset(input) {
|
|
369
|
+
this.input = input;
|
|
370
|
+
this.pos = 0;
|
|
371
|
+
this.len = input.length;
|
|
372
|
+
this.line = 1;
|
|
373
|
+
this.lineStartPos = 0;
|
|
374
|
+
this.pendingRawLineToken = this.pluginRawLinePatterns.length > 0 ? this.matchRawLine(input) : null;
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
* Scan a full document text in a single pass, classifying each line and
|
|
378
|
+
* tokenizing non-skipped lines.
|
|
379
|
+
*
|
|
380
|
+
* Replaces the separate classifyLine() + findInlineSolves() + per-line
|
|
381
|
+
* reset() + tokenizeAll() pattern with a single character-by-character
|
|
382
|
+
* walk through the entire document. Key benefits:
|
|
383
|
+
*
|
|
384
|
+
* - **Single reset()**: `this.pos`, `this.len`, `this.line`, and
|
|
385
|
+
* `this.lineStartPos` are set once for the whole document, not per-line.
|
|
386
|
+
* - **Single classification**: classifyLine() runs once per line inline;
|
|
387
|
+
* skipped lines are jumped over without tokenization.
|
|
388
|
+
* - **Shared tokenization**: Non-skipped lines are tokenized using the
|
|
389
|
+
* existing state machine, yielding Token[] without per-line reset().
|
|
390
|
+
* - **Inline solve detection**: findInlineSolves() is called only for
|
|
391
|
+
* lines that classifyLine() marks as having inline solves.
|
|
392
|
+
*
|
|
393
|
+
* Tokenization is scoped to each line by temporarily restricting
|
|
394
|
+
* `this.len` to the line end position, so the [Symbol.iterator]
|
|
395
|
+
* generator naturally stops at the line boundary. After tokenization,
|
|
396
|
+
* `this.len` is restored and `this.pos` advances past the newline.
|
|
397
|
+
*
|
|
398
|
+
* @param text The full document text (with newlines).
|
|
399
|
+
* @returns Array of ScanLineResult, one per line, in document order.
|
|
400
|
+
*/
|
|
401
|
+
scanDocument(text) {
|
|
402
|
+
this.input = text;
|
|
403
|
+
this.pos = 0;
|
|
404
|
+
this.len = text.length;
|
|
405
|
+
this.line = 1;
|
|
406
|
+
this.lineStartPos = 0;
|
|
407
|
+
const results = [];
|
|
408
|
+
const input = this.input;
|
|
409
|
+
const docLen = this.len;
|
|
410
|
+
while (this.pos < docLen) {
|
|
411
|
+
const lineStart = this.pos;
|
|
412
|
+
let lineEnd = this.pos;
|
|
413
|
+
while (lineEnd < docLen) {
|
|
414
|
+
const cc = input.charCodeAt(lineEnd);
|
|
415
|
+
if (cc === 10 || cc === 13) break;
|
|
416
|
+
lineEnd++;
|
|
417
|
+
}
|
|
418
|
+
const lineNumber = this.line;
|
|
419
|
+
const classification = this.classifyFromPositions(lineStart, lineEnd);
|
|
420
|
+
const lineText = input.slice(lineStart, lineEnd);
|
|
421
|
+
let tokens = [];
|
|
422
|
+
if (!classification.skip) {
|
|
423
|
+
const rawToken = this.pluginRawLinePatterns.length > 0 ? this.matchRawLine(lineText) : null;
|
|
424
|
+
if (rawToken) {
|
|
425
|
+
tokens = [rawToken];
|
|
426
|
+
} else {
|
|
427
|
+
const savedLen = this.len;
|
|
428
|
+
this.len = lineEnd;
|
|
429
|
+
tokens = Array.from(this);
|
|
430
|
+
this.len = savedLen;
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
let inlineSolves = [];
|
|
434
|
+
if (classification.hasInlineSolve) {
|
|
435
|
+
if (!classification.skip && tokens.length > 0) {
|
|
436
|
+
const charSpans = this.findInlineSolves(lineText);
|
|
437
|
+
inlineSolves = this._inlineSolveSpans.map((span, i) => ({
|
|
438
|
+
start: charSpans[i]?.start ?? 0,
|
|
439
|
+
end: charSpans[i]?.end ?? 0,
|
|
440
|
+
expression: charSpans[i]?.expression ?? "",
|
|
441
|
+
columnNumber: charSpans[i]?.columnNumber ?? span.columnNumber,
|
|
442
|
+
startTokenIndex: span.startTokenIndex,
|
|
443
|
+
endTokenIndex: span.endTokenIndex
|
|
444
|
+
}));
|
|
445
|
+
} else {
|
|
446
|
+
inlineSolves = this.findInlineSolves(lineText);
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
results.push({
|
|
450
|
+
text: lineText,
|
|
451
|
+
lineNumber,
|
|
452
|
+
startOffset: lineStart,
|
|
453
|
+
endOffset: lineEnd,
|
|
454
|
+
classification,
|
|
455
|
+
tokens,
|
|
456
|
+
inlineSolves
|
|
457
|
+
});
|
|
458
|
+
this.pos = lineEnd;
|
|
459
|
+
if (this.pos < docLen) {
|
|
460
|
+
const nlChar = input.charCodeAt(this.pos);
|
|
461
|
+
if (nlChar === 13) {
|
|
462
|
+
this.pos++;
|
|
463
|
+
if (this.pos < docLen && input.charCodeAt(this.pos) === 10) {
|
|
464
|
+
this.pos++;
|
|
465
|
+
}
|
|
466
|
+
} else if (nlChar === 10) {
|
|
467
|
+
this.pos++;
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
this.line++;
|
|
471
|
+
this.lineStartPos = this.pos;
|
|
472
|
+
}
|
|
473
|
+
return results;
|
|
474
|
+
}
|
|
475
|
+
/**
|
|
476
|
+
* Tokenize an expression string into an array of Tokens.
|
|
477
|
+
*
|
|
478
|
+
* Delegates to the lazy [Symbol.iterator]() generator and collects all
|
|
479
|
+
* yielded tokens via Array.from(). For memory-sensitive use cases, prefer
|
|
480
|
+
* iterating the lexer directly with for...of to avoid array allocation.
|
|
481
|
+
*
|
|
482
|
+
* Optimizations:
|
|
483
|
+
* - CHAR_CLASS jump table (Uint8Array) → switch on small integers
|
|
484
|
+
* - Direct character-code dispatch (c0 cached pattern)
|
|
485
|
+
* - Mathematical digit parsing (integer math, not slice+parseFloat)
|
|
486
|
+
* - Inline operator tokenizer with two-char peek-ahead
|
|
487
|
+
* - Whitespace eliminated in-lexer (never emitted)
|
|
488
|
+
* - 0-char and 1-char fast paths
|
|
489
|
+
*/
|
|
490
|
+
tokenizeAll() {
|
|
491
|
+
if (this.pendingRawLineToken) {
|
|
492
|
+
this._inlineSolveSpans = [];
|
|
493
|
+
return [this.pendingRawLineToken];
|
|
494
|
+
}
|
|
495
|
+
return Array.from(this);
|
|
496
|
+
}
|
|
497
|
+
// ── Lazy iterator ─────────────────────────────────────────────────────
|
|
498
|
+
/**
|
|
499
|
+
* Lazy token-by-token generator. Yields each token without allocating an
|
|
500
|
+
* intermediate Token[] array. Supports for...of and spread usage.
|
|
501
|
+
*
|
|
502
|
+
* Usage:
|
|
503
|
+
* for (const t of lexer) { ... } // lazy, no array allocation
|
|
504
|
+
* const tokens = [...lexer]; // materializes via spread
|
|
505
|
+
* const tokens = lexer.tokenizeAll(); // materializes via Array.from()
|
|
506
|
+
*
|
|
507
|
+
* IMPORTANT: This generator captures `this.len` ONCE at creation time
|
|
508
|
+
* (const len = this.len). `scanDocument()` relies on this behavior to
|
|
509
|
+
* scope tokenization to a single line by temporarily restricting
|
|
510
|
+
* `this.len` to the line end position before creating the iterator.
|
|
511
|
+
* Do NOT refactor to re-read `this.len` mid-loop without also updating
|
|
512
|
+
* `scanDocument()`.
|
|
513
|
+
*/
|
|
514
|
+
*[Symbol.iterator]() {
|
|
515
|
+
const len = this.len;
|
|
516
|
+
if (len === 0) {
|
|
517
|
+
this._inlineSolveSpans = [];
|
|
518
|
+
return;
|
|
519
|
+
}
|
|
520
|
+
let tokenIndex = 0;
|
|
521
|
+
let openSpan = null;
|
|
522
|
+
const collectedSpans = [];
|
|
523
|
+
if (len === 1) {
|
|
524
|
+
const c0 = this.input.charCodeAt(0);
|
|
525
|
+
const cc = _ExpressionLexer.CHAR_CLASS[c0] ?? 0 /* SKIP */;
|
|
526
|
+
switch (cc) {
|
|
527
|
+
case 2 /* DIGIT */:
|
|
528
|
+
case 4 /* DOT */:
|
|
529
|
+
yield new LexerToken("NUMBER", chunkGW32KPCU_cjs.tokenTypeId("NUMBER"), this.input, this.input, 0, 0, 1, 1);
|
|
530
|
+
tokenIndex++;
|
|
531
|
+
break;
|
|
532
|
+
case 3 /* ALPHA */: {
|
|
533
|
+
const input2 = this.input;
|
|
534
|
+
const identLower = input2.toLowerCase();
|
|
535
|
+
if (this.mergedUnits.has(input2)) {
|
|
536
|
+
yield new LexerToken("UNIT", chunkGW32KPCU_cjs.tokenTypeId("UNIT"), input2, input2, 0, 0, 1, 1);
|
|
537
|
+
} else {
|
|
538
|
+
const kwType = this.mergedKeywords.get(identLower);
|
|
539
|
+
if (kwType) {
|
|
540
|
+
yield new LexerToken(kwType, chunkGW32KPCU_cjs.tokenTypeId(kwType), input2, input2, 0, 0, 1, 1);
|
|
541
|
+
} else {
|
|
542
|
+
yield new LexerToken("IDENT", chunkGW32KPCU_cjs.tokenTypeId("IDENT"), input2, input2, 0, 0, 1, 1);
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
tokenIndex++;
|
|
546
|
+
break;
|
|
547
|
+
}
|
|
548
|
+
case 5 /* OPERATOR */: {
|
|
549
|
+
const opType = OP_MAP[c0];
|
|
550
|
+
if (opType) {
|
|
551
|
+
yield new LexerToken(opType, chunkGW32KPCU_cjs.tokenTypeId(opType), this.input, this.input, 0, 0, 1, 1);
|
|
552
|
+
tokenIndex++;
|
|
553
|
+
}
|
|
554
|
+
break;
|
|
555
|
+
}
|
|
556
|
+
case 6 /* QUOTE */:
|
|
557
|
+
this.pos = 0;
|
|
558
|
+
yield this.tokenizeString();
|
|
559
|
+
tokenIndex++;
|
|
560
|
+
break;
|
|
561
|
+
case 7 /* HASH */:
|
|
562
|
+
this.pos = 0;
|
|
563
|
+
yield this.tokenizeComment();
|
|
564
|
+
tokenIndex++;
|
|
565
|
+
break;
|
|
566
|
+
case 8 /* DOLLAR */:
|
|
567
|
+
yield new LexerToken("DOLLAR", chunkGW32KPCU_cjs.tokenTypeId("DOLLAR"), "$", "$", 0, 0, 1, 1);
|
|
568
|
+
tokenIndex++;
|
|
569
|
+
break;
|
|
570
|
+
case 11 /* BACKTICK */:
|
|
571
|
+
yield new LexerToken("BACKTICK_OPEN", chunkGW32KPCU_cjs.tokenTypeId("BACKTICK_OPEN"), "`", "`", 0, 0, 1, 1);
|
|
572
|
+
tokenIndex++;
|
|
573
|
+
break;
|
|
574
|
+
default: {
|
|
575
|
+
if (c0 === 215) {
|
|
576
|
+
yield new LexerToken("STAR", chunkGW32KPCU_cjs.tokenTypeId("STAR"), "\xD7", "\xD7", 0, 0, 1, 1);
|
|
577
|
+
tokenIndex++;
|
|
578
|
+
} else if (c0 === 247) {
|
|
579
|
+
yield new LexerToken("SLASH", chunkGW32KPCU_cjs.tokenTypeId("SLASH"), "\xF7", "\xF7", 0, 0, 1, 1);
|
|
580
|
+
tokenIndex++;
|
|
581
|
+
} else if (c0 === 8800) {
|
|
582
|
+
yield new LexerToken("NEQ", chunkGW32KPCU_cjs.tokenTypeId("NEQ"), "\u2260", "\u2260", 0, 0, 1, 1);
|
|
583
|
+
tokenIndex++;
|
|
584
|
+
} else if (c0 === 163) {
|
|
585
|
+
yield new LexerToken("POUND", chunkGW32KPCU_cjs.tokenTypeId("POUND"), "\xA3", "\xA3", 0, 0, 1, 1);
|
|
586
|
+
tokenIndex++;
|
|
587
|
+
} else if (c0 === 8364) {
|
|
588
|
+
yield new LexerToken("EURO", chunkGW32KPCU_cjs.tokenTypeId("EURO"), "\u20AC", "\u20AC", 0, 0, 1, 1);
|
|
589
|
+
tokenIndex++;
|
|
590
|
+
} else if (c0 === 165) {
|
|
591
|
+
yield new LexerToken("YEN", chunkGW32KPCU_cjs.tokenTypeId("YEN"), "\xA5", "\xA5", 0, 0, 1, 1);
|
|
592
|
+
tokenIndex++;
|
|
593
|
+
} else if (c0 === 8381) {
|
|
594
|
+
yield new LexerToken("RUBLE", chunkGW32KPCU_cjs.tokenTypeId("RUBLE"), "\u20BD", "\u20BD", 0, 0, 1, 1);
|
|
595
|
+
tokenIndex++;
|
|
596
|
+
} else if (c0 === 8361) {
|
|
597
|
+
yield new LexerToken("WON", chunkGW32KPCU_cjs.tokenTypeId("WON"), "\u20A9", "\u20A9", 0, 0, 1, 1);
|
|
598
|
+
tokenIndex++;
|
|
599
|
+
} else if (c0 === 8377) {
|
|
600
|
+
yield new LexerToken("CURRENCY_SYMBOL", chunkGW32KPCU_cjs.tokenTypeId("CURRENCY_SYMBOL"), "\u20B9", "\u20B9", 0, 0, 1, 1);
|
|
601
|
+
tokenIndex++;
|
|
602
|
+
} else if (c0 === 8378) {
|
|
603
|
+
yield new LexerToken("CURRENCY_SYMBOL", chunkGW32KPCU_cjs.tokenTypeId("CURRENCY_SYMBOL"), "\u20BA", "\u20BA", 0, 0, 1, 1);
|
|
604
|
+
tokenIndex++;
|
|
605
|
+
} else if (c0 === 8372) {
|
|
606
|
+
yield new LexerToken("CURRENCY_SYMBOL", chunkGW32KPCU_cjs.tokenTypeId("CURRENCY_SYMBOL"), "\u20B4", "\u20B4", 0, 0, 1, 1);
|
|
607
|
+
tokenIndex++;
|
|
608
|
+
} else if (c0 === 8362) {
|
|
609
|
+
yield new LexerToken("CURRENCY_SYMBOL", chunkGW32KPCU_cjs.tokenTypeId("CURRENCY_SYMBOL"), "\u20AA", "\u20AA", 0, 0, 1, 1);
|
|
610
|
+
tokenIndex++;
|
|
611
|
+
} else if (c0 === 8363) {
|
|
612
|
+
yield new LexerToken("CURRENCY_SYMBOL", chunkGW32KPCU_cjs.tokenTypeId("CURRENCY_SYMBOL"), "\u20AB", "\u20AB", 0, 0, 1, 1);
|
|
613
|
+
tokenIndex++;
|
|
614
|
+
} else if (c0 === 8358) {
|
|
615
|
+
yield new LexerToken("CURRENCY_SYMBOL", chunkGW32KPCU_cjs.tokenTypeId("CURRENCY_SYMBOL"), "\u20A6", "\u20A6", 0, 0, 1, 1);
|
|
616
|
+
tokenIndex++;
|
|
617
|
+
} else if (c0 === 8369) {
|
|
618
|
+
yield new LexerToken("CURRENCY_SYMBOL", chunkGW32KPCU_cjs.tokenTypeId("CURRENCY_SYMBOL"), "\u20B1", "\u20B1", 0, 0, 1, 1);
|
|
619
|
+
tokenIndex++;
|
|
620
|
+
} else if (c0 >= 128) {
|
|
621
|
+
yield new LexerToken("IDENT", chunkGW32KPCU_cjs.tokenTypeId("IDENT"), this.input, this.input, 0, 0, 1, 1);
|
|
622
|
+
tokenIndex++;
|
|
623
|
+
}
|
|
624
|
+
break;
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
this._inlineSolveSpans = collectedSpans;
|
|
628
|
+
return;
|
|
629
|
+
}
|
|
630
|
+
const input = this.input;
|
|
631
|
+
while (this.pos < len) {
|
|
632
|
+
const c0 = input.charCodeAt(this.pos);
|
|
633
|
+
const cc = _ExpressionLexer.CHAR_CLASS[c0] ?? 0 /* SKIP */;
|
|
634
|
+
if (openSpan && c0 === 92 && this.pos + 1 < len && input.charCodeAt(this.pos + 1) === 96) {
|
|
635
|
+
this.pos += 2;
|
|
636
|
+
continue;
|
|
637
|
+
}
|
|
638
|
+
switch (cc) {
|
|
639
|
+
// ── Whitespace, skip entirely, track newlines ────────────────
|
|
640
|
+
case 1 /* WHITESPACE */:
|
|
641
|
+
this.pos++;
|
|
642
|
+
if (c0 === 10) {
|
|
643
|
+
this.line++;
|
|
644
|
+
this.lineStartPos = this.pos;
|
|
645
|
+
} else if (c0 === 13) {
|
|
646
|
+
this.line++;
|
|
647
|
+
if (this.pos < len && input.charCodeAt(this.pos) === 10) {
|
|
648
|
+
this.pos++;
|
|
649
|
+
}
|
|
650
|
+
this.lineStartPos = this.pos;
|
|
651
|
+
}
|
|
652
|
+
break;
|
|
653
|
+
// ── Digit, inline number tokenizer ───────────────────────────
|
|
654
|
+
case 2 /* DIGIT */:
|
|
655
|
+
yield this.tokenizeNumber();
|
|
656
|
+
tokenIndex++;
|
|
657
|
+
break;
|
|
658
|
+
// ── Alpha / underscore, identifier or keyword ────────────────
|
|
659
|
+
case 3 /* ALPHA */: {
|
|
660
|
+
const token = this.tokenizeIdentifier();
|
|
661
|
+
if (token.type === "INLINE_SOLVE_START") {
|
|
662
|
+
openSpan = { startTokenIndex: tokenIndex, startColumn: token.col };
|
|
663
|
+
}
|
|
664
|
+
yield token;
|
|
665
|
+
tokenIndex++;
|
|
666
|
+
break;
|
|
667
|
+
}
|
|
668
|
+
// ── Dot, could be decimal (.5) or DOT token ─────────────────
|
|
669
|
+
case 4 /* DOT */:
|
|
670
|
+
if (this.pos + 1 < len) {
|
|
671
|
+
const nextCc = _ExpressionLexer.CHAR_CLASS[input.charCodeAt(this.pos + 1)] ?? 0 /* SKIP */;
|
|
672
|
+
if (nextCc === 2 /* DIGIT */) {
|
|
673
|
+
yield this.tokenizeNumber();
|
|
674
|
+
} else {
|
|
675
|
+
const col = this.pos - this.lineStartPos + 1;
|
|
676
|
+
yield new LexerToken("DOT", chunkGW32KPCU_cjs.tokenTypeId("DOT"), ".", ".", this.pos, 0, this.line, col);
|
|
677
|
+
this.pos++;
|
|
678
|
+
}
|
|
679
|
+
} else {
|
|
680
|
+
const col = this.pos - this.lineStartPos + 1;
|
|
681
|
+
yield new LexerToken("DOT", chunkGW32KPCU_cjs.tokenTypeId("DOT"), ".", ".", this.pos, 0, this.line, col);
|
|
682
|
+
this.pos++;
|
|
683
|
+
}
|
|
684
|
+
tokenIndex++;
|
|
685
|
+
break;
|
|
686
|
+
// ── Operator / punctuation ────────────────────────────────────
|
|
687
|
+
case 5 /* OPERATOR */:
|
|
688
|
+
yield this.tokenizeOperator();
|
|
689
|
+
tokenIndex++;
|
|
690
|
+
break;
|
|
691
|
+
// ── String literal ────────────────────────────────────────────
|
|
692
|
+
case 6 /* QUOTE */:
|
|
693
|
+
yield this.tokenizeString();
|
|
694
|
+
tokenIndex++;
|
|
695
|
+
break;
|
|
696
|
+
// ── Comment (# or //) ─────────────────────────────────────────
|
|
697
|
+
case 7 /* HASH */:
|
|
698
|
+
yield this.tokenizeComment();
|
|
699
|
+
tokenIndex++;
|
|
700
|
+
break;
|
|
701
|
+
// ── Dollar sign $ ─────────────────────────────────────────────
|
|
702
|
+
case 8 /* DOLLAR */: {
|
|
703
|
+
const col = this.pos - this.lineStartPos + 1;
|
|
704
|
+
yield new LexerToken("DOLLAR", chunkGW32KPCU_cjs.tokenTypeId("DOLLAR"), "$", "$", this.pos, 0, this.line, col);
|
|
705
|
+
this.pos++;
|
|
706
|
+
tokenIndex++;
|
|
707
|
+
break;
|
|
708
|
+
}
|
|
709
|
+
// ── Backtick ` ───────────────────────────────────────────────
|
|
710
|
+
case 11 /* BACKTICK */: {
|
|
711
|
+
const col = this.pos - this.lineStartPos + 1;
|
|
712
|
+
yield new LexerToken("BACKTICK_OPEN", chunkGW32KPCU_cjs.tokenTypeId("BACKTICK_OPEN"), "`", "`", this.pos, 0, this.line, col);
|
|
713
|
+
this.pos++;
|
|
714
|
+
if (openSpan) {
|
|
715
|
+
const span = openSpan;
|
|
716
|
+
collectedSpans.push({
|
|
717
|
+
start: 0,
|
|
718
|
+
end: 0,
|
|
719
|
+
expression: "",
|
|
720
|
+
columnNumber: span.startColumn,
|
|
721
|
+
startTokenIndex: span.startTokenIndex,
|
|
722
|
+
endTokenIndex: tokenIndex
|
|
723
|
+
});
|
|
724
|
+
openSpan = null;
|
|
725
|
+
}
|
|
726
|
+
tokenIndex++;
|
|
727
|
+
break;
|
|
728
|
+
}
|
|
729
|
+
// ── Non-ASCII characters ─────────────────────────────────────
|
|
730
|
+
default: {
|
|
731
|
+
const col = this.pos - this.lineStartPos + 1;
|
|
732
|
+
if (c0 === 215) {
|
|
733
|
+
yield new LexerToken("STAR", chunkGW32KPCU_cjs.tokenTypeId("STAR"), "\xD7", "\xD7", this.pos, 0, this.line, col);
|
|
734
|
+
this.pos++;
|
|
735
|
+
tokenIndex++;
|
|
736
|
+
} else if (c0 === 247) {
|
|
737
|
+
yield new LexerToken("SLASH", chunkGW32KPCU_cjs.tokenTypeId("SLASH"), "\xF7", "\xF7", this.pos, 0, this.line, col);
|
|
738
|
+
this.pos++;
|
|
739
|
+
tokenIndex++;
|
|
740
|
+
} else if (c0 === 8800) {
|
|
741
|
+
yield new LexerToken("NEQ", chunkGW32KPCU_cjs.tokenTypeId("NEQ"), "\u2260", "\u2260", this.pos, 0, this.line, col);
|
|
742
|
+
this.pos++;
|
|
743
|
+
tokenIndex++;
|
|
744
|
+
} else if (c0 === 163) {
|
|
745
|
+
yield new LexerToken("POUND", chunkGW32KPCU_cjs.tokenTypeId("POUND"), "\xA3", "\xA3", this.pos, 0, this.line, col);
|
|
746
|
+
this.pos++;
|
|
747
|
+
tokenIndex++;
|
|
748
|
+
} else if (c0 === 8364) {
|
|
749
|
+
yield new LexerToken("EURO", chunkGW32KPCU_cjs.tokenTypeId("EURO"), "\u20AC", "\u20AC", this.pos, 0, this.line, col);
|
|
750
|
+
this.pos++;
|
|
751
|
+
tokenIndex++;
|
|
752
|
+
} else if (c0 === 165) {
|
|
753
|
+
yield new LexerToken("YEN", chunkGW32KPCU_cjs.tokenTypeId("YEN"), "\xA5", "\xA5", this.pos, 0, this.line, col);
|
|
754
|
+
this.pos++;
|
|
755
|
+
tokenIndex++;
|
|
756
|
+
} else if (c0 === 8381) {
|
|
757
|
+
yield new LexerToken("RUBLE", chunkGW32KPCU_cjs.tokenTypeId("RUBLE"), "\u20BD", "\u20BD", this.pos, 0, this.line, col);
|
|
758
|
+
this.pos++;
|
|
759
|
+
tokenIndex++;
|
|
760
|
+
} else if (c0 === 8361) {
|
|
761
|
+
yield new LexerToken("WON", chunkGW32KPCU_cjs.tokenTypeId("WON"), "\u20A9", "\u20A9", this.pos, 0, this.line, col);
|
|
762
|
+
this.pos++;
|
|
763
|
+
tokenIndex++;
|
|
764
|
+
} else if (c0 === 8377) {
|
|
765
|
+
yield new LexerToken("CURRENCY_SYMBOL", chunkGW32KPCU_cjs.tokenTypeId("CURRENCY_SYMBOL"), "\u20B9", "\u20B9", this.pos, 0, this.line, col);
|
|
766
|
+
this.pos++;
|
|
767
|
+
tokenIndex++;
|
|
768
|
+
} else if (c0 === 8378) {
|
|
769
|
+
yield new LexerToken("CURRENCY_SYMBOL", chunkGW32KPCU_cjs.tokenTypeId("CURRENCY_SYMBOL"), "\u20BA", "\u20BA", this.pos, 0, this.line, col);
|
|
770
|
+
this.pos++;
|
|
771
|
+
tokenIndex++;
|
|
772
|
+
} else if (c0 === 8372) {
|
|
773
|
+
yield new LexerToken("CURRENCY_SYMBOL", chunkGW32KPCU_cjs.tokenTypeId("CURRENCY_SYMBOL"), "\u20B4", "\u20B4", this.pos, 0, this.line, col);
|
|
774
|
+
this.pos++;
|
|
775
|
+
tokenIndex++;
|
|
776
|
+
} else if (c0 === 8362) {
|
|
777
|
+
yield new LexerToken("CURRENCY_SYMBOL", chunkGW32KPCU_cjs.tokenTypeId("CURRENCY_SYMBOL"), "\u20AA", "\u20AA", this.pos, 0, this.line, col);
|
|
778
|
+
this.pos++;
|
|
779
|
+
tokenIndex++;
|
|
780
|
+
} else if (c0 === 8363) {
|
|
781
|
+
yield new LexerToken("CURRENCY_SYMBOL", chunkGW32KPCU_cjs.tokenTypeId("CURRENCY_SYMBOL"), "\u20AB", "\u20AB", this.pos, 0, this.line, col);
|
|
782
|
+
this.pos++;
|
|
783
|
+
tokenIndex++;
|
|
784
|
+
} else if (c0 === 8358) {
|
|
785
|
+
yield new LexerToken("CURRENCY_SYMBOL", chunkGW32KPCU_cjs.tokenTypeId("CURRENCY_SYMBOL"), "\u20A6", "\u20A6", this.pos, 0, this.line, col);
|
|
786
|
+
this.pos++;
|
|
787
|
+
tokenIndex++;
|
|
788
|
+
} else if (c0 === 8369) {
|
|
789
|
+
yield new LexerToken("CURRENCY_SYMBOL", chunkGW32KPCU_cjs.tokenTypeId("CURRENCY_SYMBOL"), "\u20B1", "\u20B1", this.pos, 0, this.line, col);
|
|
790
|
+
this.pos++;
|
|
791
|
+
tokenIndex++;
|
|
792
|
+
} else if (c0 >= 128) {
|
|
793
|
+
yield this.tokenizeIdentifier();
|
|
794
|
+
tokenIndex++;
|
|
795
|
+
} else {
|
|
796
|
+
this.pos++;
|
|
797
|
+
}
|
|
798
|
+
break;
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
this._inlineSolveSpans = collectedSpans;
|
|
803
|
+
}
|
|
804
|
+
// ── Inline number tokenizer ────────────────────────────────────────────
|
|
805
|
+
/**
|
|
806
|
+
* Character-by-character number parsing.
|
|
807
|
+
*
|
|
808
|
+
* Supports: integers, floats, scientific notation (1.5e10, 1.5e-10),
|
|
809
|
+
* hex (0xFF), binary (0b1010), octal (0o17), BigInt suffix (123n),
|
|
810
|
+
* thousands separators (1,234 or 1.234.567).
|
|
811
|
+
*
|
|
812
|
+
* Returns a LexerToken and advances `this.pos` past the number.
|
|
813
|
+
*/
|
|
814
|
+
tokenizeNumber() {
|
|
815
|
+
const input = this.input;
|
|
816
|
+
const len = this.len;
|
|
817
|
+
let pos = this.pos;
|
|
818
|
+
const start = pos;
|
|
819
|
+
const startCol = pos - this.lineStartPos + 1;
|
|
820
|
+
let cc;
|
|
821
|
+
if (input.charCodeAt(pos) === 48 && pos + 1 < len) {
|
|
822
|
+
const next = input.charCodeAt(pos + 1);
|
|
823
|
+
if (next === 120 || next === 88) {
|
|
824
|
+
pos += 2;
|
|
825
|
+
while (pos < len && (cc = input.charCodeAt(pos), cc >= 48 && cc <= 57 || cc >= 65 && cc <= 70 || cc >= 97 && cc <= 102)) {
|
|
826
|
+
pos++;
|
|
827
|
+
}
|
|
828
|
+
const text2 = input.slice(start, pos);
|
|
829
|
+
this.pos = pos;
|
|
830
|
+
return new LexerToken("NUMBER", chunkGW32KPCU_cjs.tokenTypeId("NUMBER"), text2, text2, start, 0, this.line, startCol);
|
|
831
|
+
}
|
|
832
|
+
if (next === 98 || next === 66) {
|
|
833
|
+
pos += 2;
|
|
834
|
+
while (pos < len && (cc = input.charCodeAt(pos), cc === 48 || cc === 49)) {
|
|
835
|
+
pos++;
|
|
836
|
+
}
|
|
837
|
+
const text2 = input.slice(start, pos);
|
|
838
|
+
this.pos = pos;
|
|
839
|
+
return new LexerToken("NUMBER", chunkGW32KPCU_cjs.tokenTypeId("NUMBER"), text2, text2, start, 0, this.line, startCol);
|
|
840
|
+
}
|
|
841
|
+
if (next === 111 || next === 79) {
|
|
842
|
+
pos += 2;
|
|
843
|
+
while (pos < len && (cc = input.charCodeAt(pos), cc >= 48 && cc <= 55)) {
|
|
844
|
+
pos++;
|
|
845
|
+
}
|
|
846
|
+
const text2 = input.slice(start, pos);
|
|
847
|
+
this.pos = pos;
|
|
848
|
+
return new LexerToken("NUMBER", chunkGW32KPCU_cjs.tokenTypeId("NUMBER"), text2, text2, start, 0, this.line, startCol);
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
let hasIntPart = false;
|
|
852
|
+
while (pos < len && (cc = input.charCodeAt(pos), cc >= 48 && cc <= 57)) {
|
|
853
|
+
hasIntPart = true;
|
|
854
|
+
pos++;
|
|
855
|
+
}
|
|
856
|
+
while (hasIntPart && pos < len && (input.charCodeAt(pos) === 44 || input.charCodeAt(pos) === 46)) {
|
|
857
|
+
if (pos + 4 <= len) {
|
|
858
|
+
const d1 = input.charCodeAt(pos + 1);
|
|
859
|
+
const d2 = input.charCodeAt(pos + 2);
|
|
860
|
+
const d3 = input.charCodeAt(pos + 3);
|
|
861
|
+
const d4 = pos + 4 < len ? input.charCodeAt(pos + 4) : -1;
|
|
862
|
+
const isGroupOfExactlyThree = !(d4 >= 48 && d4 <= 57);
|
|
863
|
+
if (d1 >= 48 && d1 <= 57 && d2 >= 48 && d2 <= 57 && d3 >= 48 && d3 <= 57 && isGroupOfExactlyThree) {
|
|
864
|
+
pos += 4;
|
|
865
|
+
hasIntPart = true;
|
|
866
|
+
continue;
|
|
867
|
+
}
|
|
868
|
+
}
|
|
869
|
+
break;
|
|
870
|
+
}
|
|
871
|
+
let hasDecimal = false;
|
|
872
|
+
if (pos < len && input.charCodeAt(pos) === 46) {
|
|
873
|
+
if (pos + 1 < len) {
|
|
874
|
+
const nextCc = input.charCodeAt(pos + 1);
|
|
875
|
+
if (nextCc >= 48 && nextCc <= 57) {
|
|
876
|
+
hasDecimal = true;
|
|
877
|
+
pos++;
|
|
878
|
+
while (pos < len && (cc = input.charCodeAt(pos), cc >= 48 && cc <= 57)) {
|
|
879
|
+
pos++;
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
let hasExponent = false;
|
|
885
|
+
if (pos < len) {
|
|
886
|
+
const ec = input.charCodeAt(pos);
|
|
887
|
+
if (ec === 101 || ec === 69) {
|
|
888
|
+
if (pos + 1 < len) {
|
|
889
|
+
const next = input.charCodeAt(pos + 1);
|
|
890
|
+
if (next >= 48 && next <= 57 || next === 43 || next === 45) {
|
|
891
|
+
hasExponent = true;
|
|
892
|
+
pos++;
|
|
893
|
+
if (next === 43 || next === 45) pos++;
|
|
894
|
+
while (pos < len && (cc = input.charCodeAt(pos), cc >= 48 && cc <= 57)) {
|
|
895
|
+
pos++;
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
if (pos < len && input.charCodeAt(pos) === 110) {
|
|
902
|
+
if (hasIntPart && !hasDecimal && !hasExponent) {
|
|
903
|
+
pos++;
|
|
904
|
+
const text2 = input.slice(start, pos);
|
|
905
|
+
this.pos = pos;
|
|
906
|
+
return new LexerToken("BIGINT", chunkGW32KPCU_cjs.tokenTypeId("BIGINT"), text2, text2, start, 0, this.line, startCol);
|
|
907
|
+
}
|
|
908
|
+
}
|
|
909
|
+
const text = input.slice(start, pos);
|
|
910
|
+
this.pos = pos;
|
|
911
|
+
return new LexerToken("NUMBER", chunkGW32KPCU_cjs.tokenTypeId("NUMBER"), text, text, start, 0, this.line, startCol);
|
|
912
|
+
}
|
|
913
|
+
// ── Inline identifier / keyword tokenizer ──────────────────────────────
|
|
914
|
+
/**
|
|
915
|
+
* Reads [a-zA-Z_][a-zA-Z0-9_]* and resolves to:
|
|
916
|
+
* - A unit type (via knownUnits, case-sensitive)
|
|
917
|
+
* - A keyword type (via locale keywordMap, case-insensitive)
|
|
918
|
+
* - IDENT if none of the above
|
|
919
|
+
*
|
|
920
|
+
* Multi-word phrases (e.g., "to the power of") are handled by the
|
|
921
|
+
* TokenNormalizer post-lexer pass, not the lexer.
|
|
922
|
+
*/
|
|
923
|
+
tokenizeIdentifier() {
|
|
924
|
+
const input = this.input;
|
|
925
|
+
const len = this.len;
|
|
926
|
+
let pos = this.pos;
|
|
927
|
+
const start = pos;
|
|
928
|
+
const startCol = pos - this.lineStartPos + 1;
|
|
929
|
+
let cc;
|
|
930
|
+
while (pos < len && (cc = input.charCodeAt(pos), cc >= 48 && cc <= 57 || // 0-9
|
|
931
|
+
cc >= 65 && cc <= 90 || // A-Z
|
|
932
|
+
cc >= 97 && cc <= 122 || // a-z
|
|
933
|
+
cc === 95 || // _
|
|
934
|
+
cc >= 128)) {
|
|
935
|
+
pos++;
|
|
936
|
+
}
|
|
937
|
+
const identText = input.slice(start, pos);
|
|
938
|
+
const identLower = identText.toLowerCase();
|
|
939
|
+
if (identLower === "s" && pos < len && input.charCodeAt(pos) === 96) {
|
|
940
|
+
pos++;
|
|
941
|
+
this.pos = pos;
|
|
942
|
+
const fullText = input.slice(start, pos);
|
|
943
|
+
return new LexerToken("INLINE_SOLVE_START", chunkGW32KPCU_cjs.tokenTypeId("INLINE_SOLVE_START"), fullText, fullText, start, 0, this.line, startCol);
|
|
944
|
+
}
|
|
945
|
+
const isKnownUnit = this.mergedUnits.has(identText);
|
|
946
|
+
if (isKnownUnit) {
|
|
947
|
+
if (!this.isFollowedByLParen(pos)) {
|
|
948
|
+
this.pos = pos;
|
|
949
|
+
return new LexerToken("UNIT", chunkGW32KPCU_cjs.tokenTypeId("UNIT"), identText, identText, start, 0, this.line, startCol);
|
|
950
|
+
}
|
|
951
|
+
}
|
|
952
|
+
const localeKwType = this.mergedKeywords.get(identLower);
|
|
953
|
+
if (localeKwType) {
|
|
954
|
+
this.pos = pos;
|
|
955
|
+
return new LexerToken(localeKwType, chunkGW32KPCU_cjs.tokenTypeId(localeKwType), identText, identText, start, 0, this.line, startCol);
|
|
956
|
+
}
|
|
957
|
+
this.pos = pos;
|
|
958
|
+
return new LexerToken("IDENT", chunkGW32KPCU_cjs.tokenTypeId("IDENT"), identText, identText, start, 0, this.line, startCol);
|
|
959
|
+
}
|
|
960
|
+
/**
|
|
961
|
+
* Peek past in-expression whitespace (space, tab) from `pos` to check
|
|
962
|
+
* if the next significant character is '('.
|
|
963
|
+
*/
|
|
964
|
+
isFollowedByLParen(pos) {
|
|
965
|
+
const len = this.len;
|
|
966
|
+
let lookPos = pos;
|
|
967
|
+
while (lookPos < len) {
|
|
968
|
+
const cc = this.input.charCodeAt(lookPos);
|
|
969
|
+
if (cc === 40) return true;
|
|
970
|
+
if (cc !== 32 && cc !== 9) break;
|
|
971
|
+
lookPos++;
|
|
972
|
+
}
|
|
973
|
+
return false;
|
|
974
|
+
}
|
|
975
|
+
// ── Inline operator tokenizer ─────────────────────────────────────────
|
|
976
|
+
/**
|
|
977
|
+
* Reads an operator/punctuation token.
|
|
978
|
+
* Handles two-char operators (==, !=, >=, <=, **) and the special
|
|
979
|
+
* cases << (LSHIFT) and >> (RSHIFT).
|
|
980
|
+
*/
|
|
981
|
+
tokenizeOperator() {
|
|
982
|
+
const input = this.input;
|
|
983
|
+
const pos = this.pos;
|
|
984
|
+
const col = pos - this.lineStartPos + 1;
|
|
985
|
+
const c0 = input.charCodeAt(pos);
|
|
986
|
+
const len = this.len;
|
|
987
|
+
if (pos + 1 < len) {
|
|
988
|
+
const c1 = input.charCodeAt(pos + 1);
|
|
989
|
+
const secondMap = TWO_CHAR_OPS[c0];
|
|
990
|
+
if (secondMap) {
|
|
991
|
+
const twoCharType = secondMap[c1];
|
|
992
|
+
if (twoCharType) {
|
|
993
|
+
const text2 = input.slice(pos, pos + 2);
|
|
994
|
+
this.pos = pos + 2;
|
|
995
|
+
return new LexerToken(twoCharType, chunkGW32KPCU_cjs.tokenTypeId(twoCharType), text2, text2, pos, 0, this.line, col);
|
|
996
|
+
}
|
|
997
|
+
}
|
|
998
|
+
if (c0 === 47 && c1 === 47) {
|
|
999
|
+
let commentPos = pos + 2;
|
|
1000
|
+
while (commentPos < len) {
|
|
1001
|
+
const cc = input.charCodeAt(commentPos);
|
|
1002
|
+
if (cc === 10 || cc === 13) break;
|
|
1003
|
+
commentPos++;
|
|
1004
|
+
}
|
|
1005
|
+
const text2 = input.slice(pos, commentPos);
|
|
1006
|
+
this.pos = commentPos;
|
|
1007
|
+
return new LexerToken("COMMENT", chunkGW32KPCU_cjs.tokenTypeId("COMMENT"), text2, text2, pos, 0, this.line, col);
|
|
1008
|
+
}
|
|
1009
|
+
if (c0 === 60 && c1 === 60) {
|
|
1010
|
+
this.pos = pos + 2;
|
|
1011
|
+
return new LexerToken("LSHIFT", chunkGW32KPCU_cjs.tokenTypeId("LSHIFT"), "<<", "<<", pos, 0, this.line, col);
|
|
1012
|
+
}
|
|
1013
|
+
if (c0 === 62 && c1 === 62) {
|
|
1014
|
+
if (input.charCodeAt(pos + 2) === 62) {
|
|
1015
|
+
this.pos = pos + 3;
|
|
1016
|
+
return new LexerToken("URSHIFT", chunkGW32KPCU_cjs.tokenTypeId("URSHIFT"), ">>>", ">>>", pos, 0, this.line, col);
|
|
1017
|
+
}
|
|
1018
|
+
this.pos = pos + 2;
|
|
1019
|
+
return new LexerToken("RSHIFT", chunkGW32KPCU_cjs.tokenTypeId("RSHIFT"), ">>", ">>", pos, 0, this.line, col);
|
|
1020
|
+
}
|
|
1021
|
+
if (this.hasPluginOps) {
|
|
1022
|
+
const pluginInner = this.pluginOperators.get(c0);
|
|
1023
|
+
if (pluginInner) {
|
|
1024
|
+
const pluginType = pluginInner.get(c1);
|
|
1025
|
+
if (pluginType) {
|
|
1026
|
+
const text2 = input.slice(pos, pos + 2);
|
|
1027
|
+
this.pos = pos + 2;
|
|
1028
|
+
return new LexerToken(pluginType, chunkGW32KPCU_cjs.tokenTypeId(pluginType), text2, text2, pos, 0, this.line, col);
|
|
1029
|
+
}
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1032
|
+
}
|
|
1033
|
+
this.pos = pos + 1;
|
|
1034
|
+
const opType = OP_MAP[c0];
|
|
1035
|
+
const text = input.charAt(pos);
|
|
1036
|
+
return new LexerToken(opType || "ERROR", chunkGW32KPCU_cjs.tokenTypeId(opType || "ERROR"), text, text, pos, 0, this.line, col);
|
|
1037
|
+
}
|
|
1038
|
+
// ── String literal tokenizer ──────────────────────────────────────────
|
|
1039
|
+
/**
|
|
1040
|
+
* Reads a double-quoted string literal. Supports backslash escapes.
|
|
1041
|
+
*/
|
|
1042
|
+
tokenizeString() {
|
|
1043
|
+
const input = this.input;
|
|
1044
|
+
const len = this.len;
|
|
1045
|
+
const start = this.pos;
|
|
1046
|
+
const startCol = start - this.lineStartPos + 1;
|
|
1047
|
+
let pos = start + 1;
|
|
1048
|
+
let lineBreaks = 0;
|
|
1049
|
+
while (pos < len) {
|
|
1050
|
+
const c0 = input.charCodeAt(pos);
|
|
1051
|
+
if (c0 === 34) {
|
|
1052
|
+
pos++;
|
|
1053
|
+
const text2 = input.slice(start, pos);
|
|
1054
|
+
this.pos = pos;
|
|
1055
|
+
return new LexerToken("STRING", chunkGW32KPCU_cjs.tokenTypeId("STRING"), text2, text2, start, lineBreaks, this.line, startCol);
|
|
1056
|
+
}
|
|
1057
|
+
if (c0 === 92 && pos + 1 < len) {
|
|
1058
|
+
pos += 2;
|
|
1059
|
+
continue;
|
|
1060
|
+
}
|
|
1061
|
+
if (c0 === 10) {
|
|
1062
|
+
this.line++;
|
|
1063
|
+
this.lineStartPos = pos + 1;
|
|
1064
|
+
lineBreaks++;
|
|
1065
|
+
}
|
|
1066
|
+
pos++;
|
|
1067
|
+
}
|
|
1068
|
+
const text = input.slice(start, pos);
|
|
1069
|
+
this.pos = pos;
|
|
1070
|
+
return new LexerToken("STRING", chunkGW32KPCU_cjs.tokenTypeId("STRING"), text, text, start, lineBreaks, this.line, startCol);
|
|
1071
|
+
}
|
|
1072
|
+
// ── Markdown line scanner (Phase B) ───────────────────────────────────
|
|
1073
|
+
/**
|
|
1074
|
+
* L1 expression gating: quickly determine if a line contains any
|
|
1075
|
+
* characters that indicate an expression (digits, operators, currency,
|
|
1076
|
+
* backticks, parentheses, etc.).
|
|
1077
|
+
*
|
|
1078
|
+
* Pure prose lines (e.g., "The quick brown fox jumps over the lazy dog")
|
|
1079
|
+
* return false and can be skipped without full tokenization (L2).
|
|
1080
|
+
*
|
|
1081
|
+
* This is a fast character-by-character scan that stops at the first
|
|
1082
|
+
* expression indicator. Called once per line in classifyFromPositions().
|
|
1083
|
+
*/
|
|
1084
|
+
static hasExpressionIndicators(input, start, end) {
|
|
1085
|
+
const indicatorCodes = EXPRESSION_INDICATOR_CODES;
|
|
1086
|
+
for (let i = start; i < end; i++) {
|
|
1087
|
+
const cc = input.charCodeAt(i);
|
|
1088
|
+
if (indicatorCodes.has(cc)) return true;
|
|
1089
|
+
if (cc >= 128) {
|
|
1090
|
+
if (cc === 215 || cc === 247 || cc === 8800 || cc === 163 || cc === 8364 || cc === 165 || cc === 8381 || cc === 8361) {
|
|
1091
|
+
return true;
|
|
1092
|
+
}
|
|
1093
|
+
}
|
|
1094
|
+
}
|
|
1095
|
+
return false;
|
|
1096
|
+
}
|
|
1097
|
+
/**
|
|
1098
|
+
* Classify a line by its character positions within this.input.
|
|
1099
|
+
* Reads directly from this.input using start/end boundaries.
|
|
1100
|
+
* DOES NOT modify this.pos, purely a read-only classifier.
|
|
1101
|
+
*/
|
|
1102
|
+
classifyFromPositions(start, end) {
|
|
1103
|
+
const len = end;
|
|
1104
|
+
if (start >= len) {
|
|
1105
|
+
return { type: "empty", skip: true, hasInlineSolve: false };
|
|
1106
|
+
}
|
|
1107
|
+
const input = this.input;
|
|
1108
|
+
let pos = start;
|
|
1109
|
+
while (pos < len) {
|
|
1110
|
+
const cc = input.charCodeAt(pos);
|
|
1111
|
+
if (cc !== 32 && cc !== 9) break;
|
|
1112
|
+
pos++;
|
|
1113
|
+
}
|
|
1114
|
+
if (pos >= len) {
|
|
1115
|
+
return { type: "empty", skip: true, hasInlineSolve: false };
|
|
1116
|
+
}
|
|
1117
|
+
const c0 = input.charCodeAt(pos);
|
|
1118
|
+
let hasInline;
|
|
1119
|
+
if (c0 === 35) {
|
|
1120
|
+
let hashCount = 1;
|
|
1121
|
+
while (pos + hashCount < len && input.charCodeAt(pos + hashCount) === 35) {
|
|
1122
|
+
hashCount++;
|
|
1123
|
+
}
|
|
1124
|
+
if (hashCount <= 6 && pos + hashCount < len && input.charCodeAt(pos + hashCount) === 32) {
|
|
1125
|
+
return { type: "heading", skip: true, hasInlineSolve: false };
|
|
1126
|
+
}
|
|
1127
|
+
return { type: "heading", skip: true, hasInlineSolve: false };
|
|
1128
|
+
}
|
|
1129
|
+
if (c0 === 62) {
|
|
1130
|
+
if (pos + 1 < len && input.charCodeAt(pos + 1) === 32) {
|
|
1131
|
+
return { type: "blockquote", skip: true, hasInlineSolve: false };
|
|
1132
|
+
}
|
|
1133
|
+
}
|
|
1134
|
+
if (c0 === 96 && pos + 2 < len && input.charCodeAt(pos + 1) === 96 && input.charCodeAt(pos + 2) === 96) {
|
|
1135
|
+
return { type: "code_fence", skip: true, hasInlineSolve: false };
|
|
1136
|
+
}
|
|
1137
|
+
if (c0 === 126 && pos + 2 < len && input.charCodeAt(pos + 1) === 126 && input.charCodeAt(pos + 2) === 126) {
|
|
1138
|
+
return { type: "code_fence", skip: true, hasInlineSolve: false };
|
|
1139
|
+
}
|
|
1140
|
+
if (c0 === 36 && pos + 1 < len && input.charCodeAt(pos + 1) === 36) {
|
|
1141
|
+
return { type: "math_fence", skip: true, hasInlineSolve: false };
|
|
1142
|
+
}
|
|
1143
|
+
if (c0 === 45 || c0 === 42 || c0 === 95) {
|
|
1144
|
+
let count = 1;
|
|
1145
|
+
while (pos + count < len && input.charCodeAt(pos + count) === c0) {
|
|
1146
|
+
count++;
|
|
1147
|
+
}
|
|
1148
|
+
if (count >= 3) {
|
|
1149
|
+
let trailPos = pos + count;
|
|
1150
|
+
while (trailPos < len && (input.charCodeAt(trailPos) === 32 || input.charCodeAt(trailPos) === 9)) {
|
|
1151
|
+
trailPos++;
|
|
1152
|
+
}
|
|
1153
|
+
if (trailPos >= len) {
|
|
1154
|
+
return { type: "hr", skip: true, hasInlineSolve: false };
|
|
1155
|
+
}
|
|
1156
|
+
}
|
|
1157
|
+
}
|
|
1158
|
+
if ((c0 === 45 || c0 === 42 || c0 === 43) && pos + 1 < len && input.charCodeAt(pos + 1) === 32) {
|
|
1159
|
+
if (hasInline === void 0) {
|
|
1160
|
+
const idx = input.indexOf("s`", pos);
|
|
1161
|
+
hasInline = idx !== -1 && idx < len;
|
|
1162
|
+
}
|
|
1163
|
+
return { type: "list", skip: false, hasInlineSolve: hasInline };
|
|
1164
|
+
}
|
|
1165
|
+
if (c0 >= 48 && c0 <= 57) {
|
|
1166
|
+
let digitPos = pos;
|
|
1167
|
+
while (digitPos < len && input.charCodeAt(digitPos) >= 48 && input.charCodeAt(digitPos) <= 57) {
|
|
1168
|
+
digitPos++;
|
|
1169
|
+
}
|
|
1170
|
+
if (digitPos < len && input.charCodeAt(digitPos) === 46) {
|
|
1171
|
+
if (digitPos + 1 < len && input.charCodeAt(digitPos + 1) === 32) {
|
|
1172
|
+
if (hasInline === void 0) {
|
|
1173
|
+
const idx = input.indexOf("s`", pos);
|
|
1174
|
+
hasInline = idx !== -1 && idx < len;
|
|
1175
|
+
}
|
|
1176
|
+
return { type: "list", skip: false, hasInlineSolve: hasInline };
|
|
1177
|
+
}
|
|
1178
|
+
}
|
|
1179
|
+
}
|
|
1180
|
+
if (c0 === 124) {
|
|
1181
|
+
let tPos = pos + 1;
|
|
1182
|
+
while (tPos < len) {
|
|
1183
|
+
const tc = input.charCodeAt(tPos);
|
|
1184
|
+
if (tc !== 45 && tc !== 58 && tc !== 124 && tc !== 32 && tc !== 9 && tc !== 13) break;
|
|
1185
|
+
tPos++;
|
|
1186
|
+
}
|
|
1187
|
+
if (tPos >= len) {
|
|
1188
|
+
return { type: "table_separator", skip: true, hasInlineSolve: false };
|
|
1189
|
+
}
|
|
1190
|
+
}
|
|
1191
|
+
if (c0 === 91 && pos + 1 < len && input.charCodeAt(pos + 1) === 91) {
|
|
1192
|
+
const closePos = input.indexOf("]]", pos + 2);
|
|
1193
|
+
if (closePos !== -1 && closePos < len) {
|
|
1194
|
+
let trailPos = closePos + 2;
|
|
1195
|
+
while (trailPos < len && (input.charCodeAt(trailPos) === 32 || input.charCodeAt(trailPos) === 9)) {
|
|
1196
|
+
trailPos++;
|
|
1197
|
+
}
|
|
1198
|
+
if (trailPos >= len) {
|
|
1199
|
+
return { type: "wikilink", skip: true, hasInlineSolve: false };
|
|
1200
|
+
}
|
|
1201
|
+
}
|
|
1202
|
+
}
|
|
1203
|
+
if (c0 === 33 && pos + 2 < len && input.charCodeAt(pos + 1) === 91 && input.charCodeAt(pos + 2) === 91) {
|
|
1204
|
+
const closePos = input.indexOf("]]", pos + 3);
|
|
1205
|
+
if (closePos !== -1 && closePos < len) {
|
|
1206
|
+
let trailPos = closePos + 2;
|
|
1207
|
+
while (trailPos < len && (input.charCodeAt(trailPos) === 32 || input.charCodeAt(trailPos) === 9)) {
|
|
1208
|
+
trailPos++;
|
|
1209
|
+
}
|
|
1210
|
+
if (trailPos >= len) {
|
|
1211
|
+
return { type: "wikilink", skip: true, hasInlineSolve: false };
|
|
1212
|
+
}
|
|
1213
|
+
}
|
|
1214
|
+
}
|
|
1215
|
+
if (c0 === 47 && pos + 1 < len && input.charCodeAt(pos + 1) === 47) {
|
|
1216
|
+
return { type: "comment", skip: true, hasInlineSolve: false };
|
|
1217
|
+
}
|
|
1218
|
+
if (c0 === 62) {
|
|
1219
|
+
let trail = pos + 1;
|
|
1220
|
+
while (trail < len && (input.charCodeAt(trail) === 32 || input.charCodeAt(trail) === 9)) trail++;
|
|
1221
|
+
if (trail >= len) return { type: "blockquote", skip: true, hasInlineSolve: false };
|
|
1222
|
+
}
|
|
1223
|
+
if (c0 === 45 || c0 === 42 || c0 === 43) {
|
|
1224
|
+
let trail = pos + 1;
|
|
1225
|
+
while (trail < len && (input.charCodeAt(trail) === 32 || input.charCodeAt(trail) === 9)) trail++;
|
|
1226
|
+
if (trail >= len) return { type: "list", skip: false, hasInlineSolve: false };
|
|
1227
|
+
}
|
|
1228
|
+
if (hasInline === void 0) {
|
|
1229
|
+
const idx = input.indexOf("s`", pos);
|
|
1230
|
+
hasInline = idx !== -1 && idx < len;
|
|
1231
|
+
}
|
|
1232
|
+
return { type: "expression", skip: false, hasInlineSolve: hasInline };
|
|
1233
|
+
}
|
|
1234
|
+
/**
|
|
1235
|
+
* Classify a single line of markdown text.
|
|
1236
|
+
*/
|
|
1237
|
+
classifyLine(lineText) {
|
|
1238
|
+
const savedInput = this.input;
|
|
1239
|
+
const savedLen = this.len;
|
|
1240
|
+
const savedPos = this.pos;
|
|
1241
|
+
this.input = lineText;
|
|
1242
|
+
this.len = lineText.length;
|
|
1243
|
+
this.pos = 0;
|
|
1244
|
+
const result = this.classifyFromPositions(0, lineText.length);
|
|
1245
|
+
this.input = savedInput;
|
|
1246
|
+
this.len = savedLen;
|
|
1247
|
+
this.pos = savedPos;
|
|
1248
|
+
return result;
|
|
1249
|
+
}
|
|
1250
|
+
/**
|
|
1251
|
+
* Every keyword this lexer currently recognizes, locale keywords
|
|
1252
|
+
* (`pi`, `sqrt`, `convert`, ...) merged with any plugin-contributed ones
|
|
1253
|
+
* from `registerVocabulary()` (e.g. a package's custom keywords), mapped to
|
|
1254
|
+
* the token type they lex to. A snapshot copy, not a live reference
|
|
1255
|
+
* mutating the return value has no effect on the lexer.
|
|
1256
|
+
*/
|
|
1257
|
+
getKeywords() {
|
|
1258
|
+
return Object.fromEntries(this.mergedKeywords);
|
|
1259
|
+
}
|
|
1260
|
+
/**
|
|
1261
|
+
* Find all inline solve markers in a line with precise coordinate mapping.
|
|
1262
|
+
*/
|
|
1263
|
+
findInlineSolves(lineText) {
|
|
1264
|
+
const results = [];
|
|
1265
|
+
const len = lineText.length;
|
|
1266
|
+
let pos = 0;
|
|
1267
|
+
while (pos < len) {
|
|
1268
|
+
const sPos = lineText.indexOf("s`", pos);
|
|
1269
|
+
if (sPos === -1) break;
|
|
1270
|
+
const exprStart = sPos + 2;
|
|
1271
|
+
let exprEnd = exprStart;
|
|
1272
|
+
while (exprEnd < len) {
|
|
1273
|
+
const cc = lineText.charCodeAt(exprEnd);
|
|
1274
|
+
if (cc === 92 && exprEnd + 1 < len) {
|
|
1275
|
+
exprEnd += 2;
|
|
1276
|
+
continue;
|
|
1277
|
+
}
|
|
1278
|
+
if (cc === 96) break;
|
|
1279
|
+
exprEnd++;
|
|
1280
|
+
}
|
|
1281
|
+
if (exprEnd >= len) {
|
|
1282
|
+
exprEnd = len;
|
|
1283
|
+
}
|
|
1284
|
+
const expression = lineText.slice(exprStart, exprEnd);
|
|
1285
|
+
const end = exprEnd < len ? exprEnd + 1 : exprEnd;
|
|
1286
|
+
results.push({
|
|
1287
|
+
start: sPos,
|
|
1288
|
+
end,
|
|
1289
|
+
expression,
|
|
1290
|
+
columnNumber: sPos + 1
|
|
1291
|
+
});
|
|
1292
|
+
pos = end;
|
|
1293
|
+
}
|
|
1294
|
+
return results;
|
|
1295
|
+
}
|
|
1296
|
+
// ── Comment tokenizer ─────────────────────────────────────────────────
|
|
1297
|
+
/**
|
|
1298
|
+
* Reads a comment: # to end of line, or // to end of line.
|
|
1299
|
+
*/
|
|
1300
|
+
tokenizeComment() {
|
|
1301
|
+
const input = this.input;
|
|
1302
|
+
const len = this.len;
|
|
1303
|
+
const start = this.pos;
|
|
1304
|
+
const startCol = start - this.lineStartPos + 1;
|
|
1305
|
+
let pos = this.pos;
|
|
1306
|
+
if (pos + 1 < len && input.charCodeAt(pos + 1) === 47) {
|
|
1307
|
+
pos += 2;
|
|
1308
|
+
} else {
|
|
1309
|
+
pos++;
|
|
1310
|
+
}
|
|
1311
|
+
while (pos < len) {
|
|
1312
|
+
const c0 = input.charCodeAt(pos);
|
|
1313
|
+
if (c0 === 10 || c0 === 13) break;
|
|
1314
|
+
pos++;
|
|
1315
|
+
}
|
|
1316
|
+
const text = input.slice(start, pos);
|
|
1317
|
+
this.pos = pos;
|
|
1318
|
+
return new LexerToken("COMMENT", chunkGW32KPCU_cjs.tokenTypeId("COMMENT"), text, text, start, 0, this.line, startCol);
|
|
1319
|
+
}
|
|
1320
|
+
};
|
|
1321
|
+
_ExpressionLexer.CHAR_CLASS = buildCharClassTable();
|
|
1322
|
+
var ExpressionLexer = _ExpressionLexer;
|
|
1323
|
+
|
|
1324
|
+
exports.ExpressionLexer = ExpressionLexer;
|
|
1325
|
+
exports.LexerToken = LexerToken;
|
|
1326
|
+
//# sourceMappingURL=chunk-NMD5VRN4.cjs.map
|
|
1327
|
+
//# sourceMappingURL=chunk-NMD5VRN4.cjs.map
|