solve-engine 1.1.1 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (395) hide show
  1. package/README.md +12 -17
  2. package/dist/{BytecodeBuilder-Bp9xeTmX.d.cts → BytecodeBuilder-DGGeByAP.d.cts} +18 -0
  3. package/dist/{BytecodeBuilder-Bp9xeTmX.d.ts → BytecodeBuilder-DGGeByAP.d.ts} +18 -0
  4. package/dist/{Configuration-C9W8tJv_.d.cts → Configuration-B6W0-T67.d.cts} +17 -4
  5. package/dist/{Configuration-C9W8tJv_.d.ts → Configuration-B6W0-T67.d.ts} +17 -4
  6. package/dist/{EngineError-B61GS1jp.d.cts → EngineError-Ce1lPkjZ.d.cts} +8 -0
  7. package/dist/{EngineError-B61GS1jp.d.ts → EngineError-Ce1lPkjZ.d.ts} +8 -0
  8. package/dist/{Lexer-BOs7euZe.d.cts → Lexer-B4C1qHXu.d.cts} +1 -1
  9. package/dist/{Lexer-CSI_lwbW.d.ts → Lexer-DKMlj7Sy.d.ts} +1 -1
  10. package/dist/{PackageCompatibility-B-7rK1TD.d.cts → PackageCompatibility-Bn5jnBtA.d.cts} +2 -2
  11. package/dist/{PackageCompatibility-Dh59eF-X.d.ts → PackageCompatibility-CIvq2MP5.d.ts} +2 -2
  12. package/dist/{PackageRegistry-_8rDlvxI.d.ts → PackageRegistry-DzeiWcv4.d.ts} +143 -175
  13. package/dist/{PackageRegistry-BHWJP83F.d.cts → PackageRegistry-dpdurBVO.d.cts} +143 -175
  14. package/dist/{Parselet-BBT8riYh.d.ts → Parselet-B-zoPrTa.d.ts} +9 -6
  15. package/dist/{Parselet-BHcgK9S7.d.cts → Parselet-C4Wu055_.d.cts} +9 -6
  16. package/dist/{ScopeManager-CxA24W5n.d.ts → ScopeManager-C2LDOrDx.d.ts} +14 -16
  17. package/dist/{ScopeManager-8vf02dwj.d.cts → ScopeManager-D7uMXbhS.d.cts} +14 -16
  18. package/dist/{Token-B1hdkedD.d.cts → Token-CbP_OutD.d.cts} +9 -0
  19. package/dist/{Token-B1hdkedD.d.ts → Token-CbP_OutD.d.ts} +9 -0
  20. package/dist/{TokenNormalizer-C6VzZgHa.d.ts → TokenNormalizer-DCWdZjGz.d.ts} +1 -1
  21. package/dist/{TokenNormalizer-DRc1Js1V.d.cts → TokenNormalizer-DnlL7_8c.d.cts} +1 -1
  22. package/dist/{VMCheckpoints-MK--EBH2.d.ts → VMCheckpoints-CGyFhivM.d.ts} +3 -3
  23. package/dist/{VMCheckpoints-ELYqITdF.d.cts → VMCheckpoints-I9jg3jWR.d.cts} +3 -3
  24. package/dist/{Value-BUi1RA3S.d.cts → Value-CCi_Eecs.d.cts} +72 -5
  25. package/dist/{Value-BUi1RA3S.d.ts → Value-CCi_Eecs.d.ts} +72 -5
  26. package/dist/{WorkerError-gzmaopj2.d.cts → WorkerError-B4p6PNfx.d.cts} +1 -1
  27. package/dist/{WorkerError-_-RkoQ5P.d.ts → WorkerError-Dhj9BQ_A.d.ts} +1 -1
  28. package/dist/chunk-2JMFUQZH.js +2 -0
  29. package/dist/chunk-2JMFUQZH.js.map +1 -0
  30. package/dist/chunk-2RWAXT6O.js +0 -1
  31. package/dist/chunk-4BZIYU7S.cjs +3 -0
  32. package/dist/chunk-4BZIYU7S.cjs.map +1 -0
  33. package/dist/chunk-4J7XZSZJ.cjs +5 -0
  34. package/dist/chunk-4J7XZSZJ.cjs.map +1 -0
  35. package/dist/chunk-4QVBSG6B.cjs +2 -0
  36. package/dist/chunk-4QVBSG6B.cjs.map +1 -0
  37. package/dist/chunk-5IJD5L3O.cjs +2 -0
  38. package/dist/chunk-5IJD5L3O.cjs.map +1 -0
  39. package/dist/chunk-62LMTO4F.js +2 -0
  40. package/dist/chunk-62LMTO4F.js.map +1 -0
  41. package/dist/chunk-6CY44ZPG.js +2 -0
  42. package/dist/chunk-6CY44ZPG.js.map +1 -0
  43. package/dist/chunk-6G3PMEPA.js +2 -0
  44. package/dist/chunk-6G3PMEPA.js.map +1 -0
  45. package/dist/chunk-6INX773F.cjs +2 -0
  46. package/dist/chunk-6INX773F.cjs.map +1 -0
  47. package/dist/chunk-6KFVG6UY.cjs +2 -0
  48. package/dist/chunk-6KFVG6UY.cjs.map +1 -0
  49. package/dist/chunk-76F3LCIL.js +4 -0
  50. package/dist/chunk-76F3LCIL.js.map +1 -0
  51. package/dist/chunk-7GK3XEZF.js +2 -0
  52. package/dist/chunk-7GK3XEZF.js.map +1 -0
  53. package/dist/chunk-APN442VD.cjs +2 -0
  54. package/dist/chunk-APN442VD.cjs.map +1 -0
  55. package/dist/chunk-AXMQG5TS.cjs +2 -0
  56. package/dist/chunk-AXMQG5TS.cjs.map +1 -0
  57. package/dist/chunk-CIQOK7Q4.cjs +2 -0
  58. package/dist/chunk-CIQOK7Q4.cjs.map +1 -0
  59. package/dist/chunk-E6Z4NQAS.js +2 -0
  60. package/dist/chunk-E6Z4NQAS.js.map +1 -0
  61. package/dist/chunk-EFJCC6FJ.cjs +2 -0
  62. package/dist/chunk-EFJCC6FJ.cjs.map +1 -0
  63. package/dist/chunk-ESUN2THE.cjs +2 -0
  64. package/dist/chunk-ESUN2THE.cjs.map +1 -0
  65. package/dist/chunk-EVAOPEO4.js +2 -0
  66. package/dist/chunk-EVAOPEO4.js.map +1 -0
  67. package/dist/chunk-EYRBENHC.js +3 -0
  68. package/dist/chunk-EYRBENHC.js.map +1 -0
  69. package/dist/chunk-FDE5HWDI.cjs +2 -0
  70. package/dist/chunk-FDE5HWDI.cjs.map +1 -0
  71. package/dist/chunk-FWW3M36J.cjs +2 -0
  72. package/dist/chunk-FWW3M36J.cjs.map +1 -0
  73. package/dist/chunk-GOIQYUWV.js +2 -0
  74. package/dist/chunk-GOIQYUWV.js.map +1 -0
  75. package/dist/chunk-HFKDWQUL.js +2 -0
  76. package/dist/chunk-HFKDWQUL.js.map +1 -0
  77. package/dist/chunk-HLBYHXQD.cjs +3 -0
  78. package/dist/chunk-HLBYHXQD.cjs.map +1 -0
  79. package/dist/chunk-IANAMBJQ.cjs +2 -0
  80. package/dist/chunk-IANAMBJQ.cjs.map +1 -0
  81. package/dist/chunk-IJMNVBIS.js +2 -0
  82. package/dist/chunk-IJMNVBIS.js.map +1 -0
  83. package/dist/chunk-J4LZD4ZY.js +3 -0
  84. package/dist/chunk-J4LZD4ZY.js.map +1 -0
  85. package/dist/chunk-JAK3RAFA.cjs +2 -0
  86. package/dist/chunk-JAK3RAFA.cjs.map +1 -0
  87. package/dist/chunk-JFAJN3C2.cjs +2 -0
  88. package/dist/chunk-JFAJN3C2.cjs.map +1 -0
  89. package/dist/chunk-JPFCXLJV.js +2 -0
  90. package/dist/chunk-JPFCXLJV.js.map +1 -0
  91. package/dist/chunk-JSPKKNPQ.js +3 -0
  92. package/dist/chunk-JSPKKNPQ.js.map +1 -0
  93. package/dist/chunk-L3FPQSGN.js +2 -0
  94. package/dist/chunk-L3FPQSGN.js.map +1 -0
  95. package/dist/chunk-LR4E4A4W.cjs +2 -0
  96. package/dist/chunk-LR4E4A4W.cjs.map +1 -0
  97. package/dist/chunk-MIQBJGGR.js +2 -0
  98. package/dist/chunk-MIQBJGGR.js.map +1 -0
  99. package/dist/chunk-MPB7KUN5.js +3 -0
  100. package/dist/chunk-MPB7KUN5.js.map +1 -0
  101. package/dist/chunk-MSYX32PF.cjs +2 -0
  102. package/dist/chunk-MSYX32PF.cjs.map +1 -0
  103. package/dist/chunk-MVZUTETT.js +2 -0
  104. package/dist/chunk-MVZUTETT.js.map +1 -0
  105. package/dist/chunk-N7N7MPMK.cjs +2 -0
  106. package/dist/chunk-N7N7MPMK.cjs.map +1 -0
  107. package/dist/chunk-NGBBNL4K.cjs +1 -3
  108. package/dist/chunk-P6WPEUAJ.cjs +2 -0
  109. package/dist/chunk-P6WPEUAJ.cjs.map +1 -0
  110. package/dist/chunk-PS272DZJ.cjs +2 -0
  111. package/dist/chunk-PS272DZJ.cjs.map +1 -0
  112. package/dist/chunk-QXQE7X4S.js +2 -0
  113. package/dist/chunk-QXQE7X4S.js.map +1 -0
  114. package/dist/chunk-R2ENWQ76.js +2 -0
  115. package/dist/chunk-R2ENWQ76.js.map +1 -0
  116. package/dist/chunk-R2SZFJTT.cjs +2 -0
  117. package/dist/chunk-R2SZFJTT.cjs.map +1 -0
  118. package/dist/chunk-RAF57WYO.js +2 -0
  119. package/dist/chunk-RAF57WYO.js.map +1 -0
  120. package/dist/chunk-RSF25YSJ.js +2 -0
  121. package/dist/chunk-RSF25YSJ.js.map +1 -0
  122. package/dist/chunk-SOMGSIO4.cjs +3 -0
  123. package/dist/chunk-SOMGSIO4.cjs.map +1 -0
  124. package/dist/chunk-SUXRZWH2.cjs +3 -0
  125. package/dist/chunk-SUXRZWH2.cjs.map +1 -0
  126. package/dist/chunk-SYYE3QAX.cjs +2 -0
  127. package/dist/chunk-SYYE3QAX.cjs.map +1 -0
  128. package/dist/chunk-SZGK6RIP.cjs +2 -0
  129. package/dist/chunk-SZGK6RIP.cjs.map +1 -0
  130. package/dist/chunk-TCZSPH4A.js +2 -0
  131. package/dist/chunk-TCZSPH4A.js.map +1 -0
  132. package/dist/chunk-TLG7VZRX.cjs +2 -0
  133. package/dist/chunk-TLG7VZRX.cjs.map +1 -0
  134. package/dist/chunk-TRBXW6HW.js +2 -0
  135. package/dist/{chunk-AQNHHJMJ.cjs.map → chunk-TRBXW6HW.js.map} +1 -1
  136. package/dist/chunk-TTFO4YDP.cjs +2 -0
  137. package/dist/chunk-TTFO4YDP.cjs.map +1 -0
  138. package/dist/chunk-TWC7K3ZX.js +2 -0
  139. package/dist/chunk-TWC7K3ZX.js.map +1 -0
  140. package/dist/chunk-UDQ57ZRX.cjs +2 -0
  141. package/dist/chunk-UDQ57ZRX.cjs.map +1 -0
  142. package/dist/chunk-UI6IFGBT.js +2 -0
  143. package/dist/chunk-UI6IFGBT.js.map +1 -0
  144. package/dist/chunk-UURM7P3P.cjs +4 -0
  145. package/dist/chunk-UURM7P3P.cjs.map +1 -0
  146. package/dist/chunk-W2JAR233.js +2 -0
  147. package/dist/chunk-W2JAR233.js.map +1 -0
  148. package/dist/chunk-WGZ3FNHI.js +2 -0
  149. package/dist/chunk-WGZ3FNHI.js.map +1 -0
  150. package/dist/chunk-WN5CMP4T.cjs +3 -0
  151. package/dist/chunk-WN5CMP4T.cjs.map +1 -0
  152. package/dist/chunk-XEIDV5JP.js +2 -0
  153. package/dist/chunk-XEIDV5JP.js.map +1 -0
  154. package/dist/chunk-XNIWQHXY.js +2 -0
  155. package/dist/chunk-XNIWQHXY.js.map +1 -0
  156. package/dist/chunk-XR7HEC7B.js +5 -0
  157. package/dist/chunk-XR7HEC7B.js.map +1 -0
  158. package/dist/chunk-Y7O4D3BJ.cjs +2 -0
  159. package/dist/chunk-Y7O4D3BJ.cjs.map +1 -0
  160. package/dist/chunk-YAYBVVG2.js +3 -0
  161. package/dist/chunk-YAYBVVG2.js.map +1 -0
  162. package/dist/chunk-YJ2OPULK.js +2 -0
  163. package/dist/chunk-YJ2OPULK.js.map +1 -0
  164. package/dist/chunk-YVKHEAFT.js +2 -0
  165. package/dist/chunk-YVKHEAFT.js.map +1 -0
  166. package/dist/chunk-ZCNBT44X.cjs +2 -0
  167. package/dist/chunk-ZCNBT44X.cjs.map +1 -0
  168. package/dist/chunk-ZLRJ7TDP.cjs +2 -0
  169. package/dist/chunk-ZLRJ7TDP.cjs.map +1 -0
  170. package/dist/constants.cjs +1 -21
  171. package/dist/constants.d.cts +1 -1
  172. package/dist/constants.d.ts +1 -1
  173. package/dist/constants.js +1 -4
  174. package/dist/engine.cjs +1 -94
  175. package/dist/engine.d.cts +29 -14
  176. package/dist/engine.d.ts +29 -14
  177. package/dist/engine.js +1 -37
  178. package/dist/errors.cjs +1 -105
  179. package/dist/errors.d.cts +3 -3
  180. package/dist/errors.d.ts +3 -3
  181. package/dist/errors.js +1 -4
  182. package/dist/format.cjs +1 -26
  183. package/dist/format.d.cts +2 -2
  184. package/dist/format.d.ts +2 -2
  185. package/dist/format.js +1 -9
  186. package/dist/index.cjs +1 -314
  187. package/dist/index.cjs.map +1 -1
  188. package/dist/index.d.cts +55 -23
  189. package/dist/index.d.ts +55 -23
  190. package/dist/index.js +1 -278
  191. package/dist/index.js.map +1 -1
  192. package/dist/language.cjs +1 -369
  193. package/dist/language.cjs.map +1 -1
  194. package/dist/language.d.cts +12 -13
  195. package/dist/language.d.ts +12 -13
  196. package/dist/language.js +1 -348
  197. package/dist/language.js.map +1 -1
  198. package/dist/lexer.cjs +1 -63
  199. package/dist/lexer.d.cts +3 -3
  200. package/dist/lexer.d.ts +3 -3
  201. package/dist/lexer.js +1 -10
  202. package/dist/normalizer.cjs +1 -39
  203. package/dist/normalizer.d.cts +3 -3
  204. package/dist/normalizer.d.ts +3 -3
  205. package/dist/normalizer.js +1 -10
  206. package/dist/packages.cjs +1 -128
  207. package/dist/packages.d.cts +39 -14
  208. package/dist/packages.d.ts +39 -14
  209. package/dist/packages.js +1 -23
  210. package/dist/parser.cjs +1 -54
  211. package/dist/parser.d.cts +9 -9
  212. package/dist/parser.d.ts +9 -9
  213. package/dist/parser.js +1 -9
  214. package/dist/{pipeline-CtfJtPQc.d.cts → pipeline-72QmQlGx.d.ts} +3 -3
  215. package/dist/{pipeline-DCd5M6Gk.d.ts → pipeline-DCQicwWX.d.cts} +3 -3
  216. package/dist/resolvers.cjs +1 -12
  217. package/dist/resolvers.d.cts +3 -3
  218. package/dist/resolvers.d.ts +3 -3
  219. package/dist/resolvers.js +1 -3
  220. package/dist/services.cjs +1 -20
  221. package/dist/services.js +1 -3
  222. package/dist/testing.cjs +3 -477
  223. package/dist/testing.cjs.map +1 -1
  224. package/dist/testing.d.cts +12 -13
  225. package/dist/testing.d.ts +12 -13
  226. package/dist/testing.js +3 -469
  227. package/dist/testing.js.map +1 -1
  228. package/dist/uom.cjs +1 -55
  229. package/dist/uom.d.cts +3 -3
  230. package/dist/uom.d.ts +3 -3
  231. package/dist/uom.js +1 -10
  232. package/dist/utilities.cjs +1 -36
  233. package/dist/utilities.js +1 -7
  234. package/dist/vm.cjs +1 -295
  235. package/dist/vm.cjs.map +1 -1
  236. package/dist/vm.d.cts +22 -10
  237. package/dist/vm.d.ts +22 -10
  238. package/dist/vm.js +1 -193
  239. package/dist/vm.js.map +1 -1
  240. package/dist/worker.cjs +2 -492
  241. package/dist/worker.cjs.map +1 -1
  242. package/dist/worker.d.cts +19 -20
  243. package/dist/worker.d.ts +19 -20
  244. package/dist/worker.js +2 -483
  245. package/dist/worker.js.map +1 -1
  246. package/package.json +1 -13
  247. package/dist/chunk-267JPOTF.js +0 -406
  248. package/dist/chunk-267JPOTF.js.map +0 -1
  249. package/dist/chunk-2TZKENDH.cjs +0 -448
  250. package/dist/chunk-2TZKENDH.cjs.map +0 -1
  251. package/dist/chunk-3BOK2LDK.js +0 -17
  252. package/dist/chunk-3BOK2LDK.js.map +0 -1
  253. package/dist/chunk-3OWCDIPN.js +0 -215
  254. package/dist/chunk-3OWCDIPN.js.map +0 -1
  255. package/dist/chunk-3VGDNEE3.js +0 -84
  256. package/dist/chunk-3VGDNEE3.js.map +0 -1
  257. package/dist/chunk-4D6NIHE2.js +0 -451
  258. package/dist/chunk-4D6NIHE2.js.map +0 -1
  259. package/dist/chunk-4HQKTMWG.js +0 -7985
  260. package/dist/chunk-4HQKTMWG.js.map +0 -1
  261. package/dist/chunk-536WPM2V.cjs +0 -283
  262. package/dist/chunk-536WPM2V.cjs.map +0 -1
  263. package/dist/chunk-5HRB36DK.js +0 -405
  264. package/dist/chunk-5HRB36DK.js.map +0 -1
  265. package/dist/chunk-5ON7PUAZ.js +0 -12
  266. package/dist/chunk-5ON7PUAZ.js.map +0 -1
  267. package/dist/chunk-7KYSUDQO.js +0 -109
  268. package/dist/chunk-7KYSUDQO.js.map +0 -1
  269. package/dist/chunk-7ZX6B7SY.cjs +0 -3222
  270. package/dist/chunk-7ZX6B7SY.cjs.map +0 -1
  271. package/dist/chunk-ADBA3XBE.cjs +0 -20
  272. package/dist/chunk-ADBA3XBE.cjs.map +0 -1
  273. package/dist/chunk-ALYRJ72W.cjs +0 -434
  274. package/dist/chunk-ALYRJ72W.cjs.map +0 -1
  275. package/dist/chunk-AMOJYLG2.cjs +0 -1692
  276. package/dist/chunk-AMOJYLG2.cjs.map +0 -1
  277. package/dist/chunk-AQNHHJMJ.cjs +0 -261
  278. package/dist/chunk-B4HBEFTB.cjs +0 -375
  279. package/dist/chunk-B4HBEFTB.cjs.map +0 -1
  280. package/dist/chunk-B7LXJ6LC.cjs +0 -36
  281. package/dist/chunk-B7LXJ6LC.cjs.map +0 -1
  282. package/dist/chunk-B7NLZMQ3.cjs +0 -74
  283. package/dist/chunk-B7NLZMQ3.cjs.map +0 -1
  284. package/dist/chunk-BLI4NIQY.js +0 -98
  285. package/dist/chunk-BLI4NIQY.js.map +0 -1
  286. package/dist/chunk-BYJBUL7U.js +0 -499
  287. package/dist/chunk-BYJBUL7U.js.map +0 -1
  288. package/dist/chunk-CCBZZQAE.js +0 -312
  289. package/dist/chunk-CCBZZQAE.js.map +0 -1
  290. package/dist/chunk-CKQMXMHR.cjs +0 -219
  291. package/dist/chunk-CKQMXMHR.cjs.map +0 -1
  292. package/dist/chunk-CUR2WLI4.cjs +0 -507
  293. package/dist/chunk-CUR2WLI4.cjs.map +0 -1
  294. package/dist/chunk-DLEBSLF4.js +0 -336
  295. package/dist/chunk-DLEBSLF4.js.map +0 -1
  296. package/dist/chunk-E23GZEWL.cjs +0 -209
  297. package/dist/chunk-E23GZEWL.cjs.map +0 -1
  298. package/dist/chunk-EJ3ILXX6.cjs +0 -223
  299. package/dist/chunk-EJ3ILXX6.cjs.map +0 -1
  300. package/dist/chunk-ENKKJYD3.js +0 -333
  301. package/dist/chunk-ENKKJYD3.js.map +0 -1
  302. package/dist/chunk-ENRIK36Q.cjs +0 -94
  303. package/dist/chunk-ENRIK36Q.cjs.map +0 -1
  304. package/dist/chunk-ERCOHGXD.js +0 -356
  305. package/dist/chunk-ERCOHGXD.js.map +0 -1
  306. package/dist/chunk-FD5ZZHEU.js +0 -92
  307. package/dist/chunk-FD5ZZHEU.js.map +0 -1
  308. package/dist/chunk-FEAIOR7N.cjs +0 -91
  309. package/dist/chunk-FEAIOR7N.cjs.map +0 -1
  310. package/dist/chunk-GCM5JHMX.js +0 -88
  311. package/dist/chunk-GCM5JHMX.js.map +0 -1
  312. package/dist/chunk-GLA4JXBO.js +0 -204
  313. package/dist/chunk-GLA4JXBO.js.map +0 -1
  314. package/dist/chunk-HIQ5HSZL.cjs +0 -1923
  315. package/dist/chunk-HIQ5HSZL.cjs.map +0 -1
  316. package/dist/chunk-HVRVSI2Z.cjs +0 -829
  317. package/dist/chunk-HVRVSI2Z.cjs.map +0 -1
  318. package/dist/chunk-I4GAWIPW.js +0 -825
  319. package/dist/chunk-I4GAWIPW.js.map +0 -1
  320. package/dist/chunk-J45BCEZ4.cjs +0 -339
  321. package/dist/chunk-J45BCEZ4.cjs.map +0 -1
  322. package/dist/chunk-JG6ZJ2WU.js +0 -1513
  323. package/dist/chunk-JG6ZJ2WU.js.map +0 -1
  324. package/dist/chunk-L2TE7PMO.cjs +0 -14
  325. package/dist/chunk-L2TE7PMO.cjs.map +0 -1
  326. package/dist/chunk-LHZ6VOA7.js +0 -1764
  327. package/dist/chunk-LHZ6VOA7.js.map +0 -1
  328. package/dist/chunk-MN3LHRGV.cjs +0 -8012
  329. package/dist/chunk-MN3LHRGV.cjs.map +0 -1
  330. package/dist/chunk-MVTOCRV2.js +0 -213
  331. package/dist/chunk-MVTOCRV2.js.map +0 -1
  332. package/dist/chunk-N5NNW4VG.cjs +0 -341
  333. package/dist/chunk-N5NNW4VG.cjs.map +0 -1
  334. package/dist/chunk-N7FNVFXW.cjs +0 -32
  335. package/dist/chunk-N7FNVFXW.cjs.map +0 -1
  336. package/dist/chunk-NKW7LKYU.js +0 -3185
  337. package/dist/chunk-NKW7LKYU.js.map +0 -1
  338. package/dist/chunk-NLNDMWZC.js +0 -31
  339. package/dist/chunk-NLNDMWZC.js.map +0 -1
  340. package/dist/chunk-NNQ2TYDF.js +0 -1848
  341. package/dist/chunk-NNQ2TYDF.js.map +0 -1
  342. package/dist/chunk-NNZAEUDW.js +0 -6792
  343. package/dist/chunk-NNZAEUDW.js.map +0 -1
  344. package/dist/chunk-OUHT5Z36.cjs +0 -393
  345. package/dist/chunk-OUHT5Z36.cjs.map +0 -1
  346. package/dist/chunk-QFTDTX6K.cjs +0 -457
  347. package/dist/chunk-QFTDTX6K.cjs.map +0 -1
  348. package/dist/chunk-SBUFNJVE.js +0 -258
  349. package/dist/chunk-SBUFNJVE.js.map +0 -1
  350. package/dist/chunk-SRGQ72IR.cjs +0 -2800
  351. package/dist/chunk-SRGQ72IR.cjs.map +0 -1
  352. package/dist/chunk-SSV46KFA.cjs +0 -112
  353. package/dist/chunk-SSV46KFA.cjs.map +0 -1
  354. package/dist/chunk-T6ZYQJ63.cjs +0 -6807
  355. package/dist/chunk-T6ZYQJ63.cjs.map +0 -1
  356. package/dist/chunk-UKQHXPGW.js +0 -30
  357. package/dist/chunk-UKQHXPGW.js.map +0 -1
  358. package/dist/chunk-UO6BUV6K.js +0 -278
  359. package/dist/chunk-UO6BUV6K.js.map +0 -1
  360. package/dist/chunk-V4XG5QF6.js +0 -1685
  361. package/dist/chunk-V4XG5QF6.js.map +0 -1
  362. package/dist/chunk-VEKIWQ3F.cjs +0 -39
  363. package/dist/chunk-VEKIWQ3F.cjs.map +0 -1
  364. package/dist/chunk-WWQEY7BV.js +0 -67
  365. package/dist/chunk-WWQEY7BV.js.map +0 -1
  366. package/dist/chunk-WXEHD6TT.js +0 -2795
  367. package/dist/chunk-WXEHD6TT.js.map +0 -1
  368. package/dist/chunk-X6K3HUOY.cjs +0 -86
  369. package/dist/chunk-X6K3HUOY.cjs.map +0 -1
  370. package/dist/chunk-XA4CKRML.cjs +0 -316
  371. package/dist/chunk-XA4CKRML.cjs.map +0 -1
  372. package/dist/chunk-XBTEO4OB.js +0 -391
  373. package/dist/chunk-XBTEO4OB.js.map +0 -1
  374. package/dist/chunk-XIYYHA65.cjs +0 -101
  375. package/dist/chunk-XIYYHA65.cjs.map +0 -1
  376. package/dist/chunk-YLJ4XMA6.js +0 -33
  377. package/dist/chunk-YLJ4XMA6.js.map +0 -1
  378. package/dist/chunk-YRIKITGF.cjs +0 -1768
  379. package/dist/chunk-YRIKITGF.cjs.map +0 -1
  380. package/dist/chunk-Z2XP767T.cjs +0 -35
  381. package/dist/chunk-Z2XP767T.cjs.map +0 -1
  382. package/dist/chunk-Z4X2RWOF.js +0 -37
  383. package/dist/chunk-Z4X2RWOF.js.map +0 -1
  384. package/dist/chunk-Z7XGGLI2.js +0 -455
  385. package/dist/chunk-Z7XGGLI2.js.map +0 -1
  386. package/dist/chunk-ZMW6NU2K.cjs +0 -1516
  387. package/dist/chunk-ZMW6NU2K.cjs.map +0 -1
  388. package/dist/chunk-ZVTWQLK4.cjs +0 -459
  389. package/dist/chunk-ZVTWQLK4.cjs.map +0 -1
  390. package/dist/variables.cjs +0 -17
  391. package/dist/variables.cjs.map +0 -1
  392. package/dist/variables.d.cts +0 -87
  393. package/dist/variables.d.ts +0 -87
  394. package/dist/variables.js +0 -4
  395. package/dist/variables.js.map +0 -1
@@ -1,1516 +0,0 @@
1
- 'use strict';
2
-
3
- var chunkQFTDTX6K_cjs = require('./chunk-QFTDTX6K.cjs');
4
- var chunkOUHT5Z36_cjs = require('./chunk-OUHT5Z36.cjs');
5
- var chunkAQNHHJMJ_cjs = require('./chunk-AQNHHJMJ.cjs');
6
- var chunkB4HBEFTB_cjs = require('./chunk-B4HBEFTB.cjs');
7
-
8
- // src/lexer/ExpressionLexer.ts
9
- chunkQFTDTX6K_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
- function isUnicodeSpace(cc) {
52
- return cc === 133 || // NEL, next line
53
- cc === 160 || // no-break space
54
- cc === 5760 || // ogham space mark
55
- cc >= 8192 && cc <= 8202 || // en quad through hair space, incl. figure/thin space
56
- cc === 8203 || // zero-width space
57
- cc === 8232 || // line separator
58
- cc === 8233 || // paragraph separator
59
- cc === 8239 || // narrow no-break space
60
- cc === 8287 || // medium mathematical space
61
- cc === 12288 || // ideographic space
62
- cc === 65279;
63
- }
64
- var LexerToken = class {
65
- constructor(type, typeId, value, text, offset, lineBreaks, line, col, sourceEnd) {
66
- this.type = type;
67
- this.typeId = typeId;
68
- this.value = value;
69
- this.text = text;
70
- this.offset = offset;
71
- this.lineBreaks = lineBreaks;
72
- this.line = line;
73
- this.col = col;
74
- this.sourceEnd = sourceEnd;
75
- }
76
- };
77
- var TWO_CHAR_OPS = {
78
- 61: { 61: "EQUALITY", 62: "THEREFORE" },
79
- // ==, => (opposite char order from >='s GTE below — no collision)
80
- 33: { 61: "NEQ" },
81
- // !=
82
- 62: { 61: "GTE" },
83
- // >=
84
- 60: { 61: "LTE" },
85
- // <=
86
- 38: { 38: "LOGICAL_AND" },
87
- // &&
88
- 124: { 124: "LOGICAL_OR" }
89
- // ||
90
- // Note: ** is NOT a single token, the existing moo lexer emits two
91
- // separate STAR tokens, and the parser consumes them that way.
92
- // 42: { 42: 'EXPONENT' }, // **, disabled for moo compatibility
93
- };
94
- var OP_MAP = {
95
- 43: "PLUS",
96
- // +
97
- 45: "MINUS",
98
- // -
99
- 42: "STAR",
100
- // *
101
- 47: "SLASH",
102
- // /
103
- 94: "CARET",
104
- // ^
105
- 37: "PERCENT",
106
- // %
107
- 40: "LPAREN",
108
- // (
109
- 41: "RPAREN",
110
- // )
111
- 91: "LBRACKET",
112
- // [
113
- 93: "RBRACKET",
114
- // ]
115
- 123: "LBRACE",
116
- // {
117
- 125: "RBRACE",
118
- // }
119
- 44: "COMMA",
120
- // ,
121
- 58: "COLON",
122
- // :
123
- 59: "SEMICOLON",
124
- // ;
125
- 61: "EQUALS",
126
- // =
127
- 63: "QUESTION",
128
- // ?
129
- 33: "BANG",
130
- // !
131
- 38: "BIT_AND",
132
- // &
133
- 124: "BIT_OR",
134
- // |
135
- 60: "LT",
136
- // <
137
- 62: "GT",
138
- // >
139
- 126: "BIT_NOT",
140
- // ~
141
- // "@", activates the token type name already dormant-reserved for this
142
- // exact purpose (see Token.ts's OVER/RATE_AT doc comment and
143
- // normalizer/TokenNormalizer.ts's NON_WORD_NAMES, both of which already
144
- // anticipated "AT" as a future "@" symbol token before this addition).
145
- // Backs the time package's video-timecode literal's alternate fps
146
- // separator (`01:02:03:04 @ 30fps`, equivalent to `... at 30fps`). See
147
- // packages/time/parselets/VideoTimecodeParselet.ts.
148
- 64: "AT"
149
- // @
150
- };
151
- var EXPRESSION_INDICATOR_CODES = (() => {
152
- const set = /* @__PURE__ */ new Set();
153
- for (let i = 48; i <= 57; i++) set.add(i);
154
- const opCodes = [43, 45, 42, 47, 94, 37, 40, 41, 91, 93, 123, 125, 61, 60, 62, 33, 38, 124, 126, 59, 63];
155
- for (const c of opCodes) set.add(c);
156
- set.add(36);
157
- set.add(163);
158
- set.add(8364);
159
- set.add(165);
160
- set.add(8381);
161
- set.add(8361);
162
- set.add(96);
163
- set.add(46);
164
- set.add(35);
165
- return set;
166
- })();
167
- var _ExpressionLexer = class _ExpressionLexer {
168
- constructor(localeCode = "en", lookup) {
169
- /**
170
- * Configured TokenLookup from TokenClassRegistry. When set, replaces
171
- * the internal keyword map and unit set with registry-built equivalents.
172
- * Enables data-driven keyword/unit registration across locale keywords,
173
- * provider keywords, and plugins.
174
- *
175
- * Set at construction time via the constructor parameter. Plugin-registered
176
- * keywords/units (via registerVocabulary()) are checked alongside
177
- * the configuredLookup, neither source is bypassed.
178
- */
179
- this.configuredLookup = null;
180
- // Instance state
181
- this.input = "";
182
- this.pos = 0;
183
- this.len = 0;
184
- // Line / column tracking (1-indexed)
185
- this.line = 1;
186
- this.lineStartPos = 0;
187
- // Open-bracket context stack for the current line, one entry per unclosed
188
- // `(`/`[`, `true` when a comma inside it is a separator rather than a
189
- // thousands group. A `[` (vector/matrix) and a CALL `(` (`rgb(255,255,255)`,
190
- // preceded by an identifier) are separator contexts; a bare GROUPING `(`
191
- // (`(1,000)`, preceded by an operator or the line start) is not, so a
192
- // parenthesised thousands number still reads as one scalar. The number scanner
193
- // consults the innermost entry. Tracked here because the flat token stream
194
- // carries no nesting otherwise; reset per line, so an unbalanced bracket
195
- // cannot bleed the decision into the next.
196
- this.groupingStack = [];
197
- // Plugin-extensible keyword map (merged with locale keywordMap)
198
- this.pluginKeywordMap = /* @__PURE__ */ new Map();
199
- // Plugin-extensible two-char operators: firstChar → (secondChar → tokenType)
200
- this.pluginOperators = /* @__PURE__ */ new Map();
201
- // Plugin-extensible units (merged with knownUnits)
202
- this.pluginUnits = /* @__PURE__ */ new Set();
203
- // Fast-path guards: skip plugin lookups entirely when no plugins registered
204
- this.hasPluginOps = false;
205
- /**
206
- * Inline solve spans collected during the most recent tokenization pass.
207
- * Populated by [Symbol.iterator]() and consumed by scanDocument().
208
- */
209
- this._inlineSolveSpans = [];
210
- // Plugin-extensible raw-line patterns. See LexerVocabulary.rawLinePatterns.
211
- this.pluginRawLinePatterns = [];
212
- /**
213
- * If a `rawLinePatterns` rule matches the FULL text most recently passed
214
- * to {@link reset}, this holds the single synthetic token that
215
- * {@link tokenizeAll} should return instead of running the
216
- * character-by-character scanner. Cleared (re-evaluated) on every
217
- * {@link reset} call. `null` when no plugin registered any raw-line
218
- * patterns, or none matched, the overwhelmingly common case, checked
219
- * with a `length === 0` guard before ever touching this field so a
220
- * plugin-free lexer pays zero cost for the feature.
221
- */
222
- this.pendingRawLineToken = null;
223
- this.localeCode = localeCode;
224
- this.locale = chunkOUHT5Z36_cjs.getLocale(localeCode);
225
- this.configuredLookup = lookup ?? null;
226
- this.keywordMap = /* @__PURE__ */ new Map();
227
- for (const [k, v] of Object.entries(this.locale.keywordMap)) {
228
- this.keywordMap.set(k.toLowerCase(), v);
229
- }
230
- this.mergedKeywords = new Map(this.keywordMap);
231
- this.mergedUnits = new Set(chunkAQNHHJMJ_cjs.knownUnits);
232
- }
233
- /**
234
- * Test `text` against every registered `rawLinePatterns` rule, in
235
- * registration order. Returns a synthetic token for the first rule
236
- * whose `pattern` matches AND whose capture group 1 is non-empty after
237
- * trimming; returns `null` if no rule matches (the normal
238
- * character-by-character scanner should run instead).
239
- */
240
- matchRawLine(text) {
241
- for (const rule of this.pluginRawLinePatterns) {
242
- const m = rule.pattern.exec(text);
243
- if (m && typeof m[1] === "string") {
244
- const value = m[1].trim();
245
- if (value.length > 0) {
246
- return new LexerToken(rule.tokenType, chunkQFTDTX6K_cjs.tokenTypeId(rule.tokenType), value, value, 0, 0, this.line, 1);
247
- }
248
- }
249
- }
250
- return null;
251
- }
252
- /** Rebuild merged keyword and unit collections after plugin registration. */
253
- rebuildMergedCollections() {
254
- this.mergedKeywords = new Map([...this.keywordMap, ...this.pluginKeywordMap]);
255
- this.mergedUnits = /* @__PURE__ */ new Set([...chunkAQNHHJMJ_cjs.knownUnits, ...this.pluginUnits]);
256
- }
257
- /**
258
- * Register a plugin to extend the lexer with custom tokens.
259
- *
260
- * All registrations are additive, built-in patterns still work.
261
- * Keywords, operators, and units from the plugin are merged
262
- * with existing ones. Calling multiple times adds more entries.
263
- *
264
- * Note: multi-word phrases are now handled by the TokenNormalizer
265
- * (see `IEnginePackage.normalizerRules`), not the lexer.
266
- *
267
- * Built-in tokens CANNOT be overridden. Throws a EngineError if the
268
- * plugin attempts to register a keyword, operator, or unit
269
- * that conflicts with a built-in one.
270
- */
271
- registerVocabulary(plugin) {
272
- if (plugin.keywords) {
273
- for (const [keyword, tokenType] of Object.entries(plugin.keywords)) {
274
- const lower = keyword.toLowerCase();
275
- if (this.keywordMap.has(lower)) {
276
- throw chunkB4HBEFTB_cjs.ErrorFactory.config(
277
- "PLUGIN_KEYWORD_COLLISION",
278
- `Plugin keyword "${keyword}" conflicts with built-in keyword (type: ${this.keywordMap.get(lower)}). Built-in keywords cannot be overridden.`,
279
- { keyword, builtinType: this.keywordMap.get(lower) }
280
- );
281
- }
282
- this.pluginKeywordMap.set(lower, tokenType);
283
- }
284
- this.rebuildMergedCollections();
285
- }
286
- if (plugin.operators) {
287
- this.hasPluginOps = true;
288
- for (const [chars, tokenType] of Object.entries(plugin.operators)) {
289
- if (chars.length === 2) {
290
- const first = chars.charCodeAt(0);
291
- const second = chars.charCodeAt(1);
292
- const builtInSecondMap = TWO_CHAR_OPS[first];
293
- if (builtInSecondMap && builtInSecondMap[second] !== void 0) {
294
- throw chunkB4HBEFTB_cjs.ErrorFactory.config(
295
- "PLUGIN_OPERATOR_COLLISION",
296
- `Plugin operator "${chars}" conflicts with built-in operator (type: ${builtInSecondMap[second]}). Built-in operators cannot be overridden.`,
297
- { operator: chars, builtinType: builtInSecondMap[second] }
298
- );
299
- }
300
- if (first === 60 && second === 60) {
301
- throw chunkB4HBEFTB_cjs.ErrorFactory.config(
302
- "PLUGIN_OPERATOR_COLLISION",
303
- `Plugin operator "${chars}" conflicts with built-in operator (type: LSHIFT). Built-in operators cannot be overridden.`,
304
- { operator: chars, builtinType: "LSHIFT" }
305
- );
306
- }
307
- if (first === 62 && second === 62) {
308
- throw chunkB4HBEFTB_cjs.ErrorFactory.config(
309
- "PLUGIN_OPERATOR_COLLISION",
310
- `Plugin operator "${chars}" conflicts with built-in operator (type: RSHIFT). Built-in operators cannot be overridden.`,
311
- { operator: chars, builtinType: "RSHIFT" }
312
- );
313
- }
314
- if (first === 47 && second === 47) {
315
- throw chunkB4HBEFTB_cjs.ErrorFactory.config(
316
- "PLUGIN_OPERATOR_COLLISION",
317
- `Plugin operator "${chars}" conflicts with built-in comment sequence. Comment sequences cannot be overridden.`,
318
- { operator: chars, builtinType: "COMMENT" }
319
- );
320
- }
321
- let inner = this.pluginOperators.get(first);
322
- if (!inner) {
323
- inner = /* @__PURE__ */ new Map();
324
- this.pluginOperators.set(first, inner);
325
- }
326
- inner.set(second, tokenType);
327
- }
328
- }
329
- }
330
- if (plugin.units) {
331
- for (const unit of plugin.units) {
332
- if (chunkAQNHHJMJ_cjs.knownUnits.has(unit)) {
333
- throw chunkB4HBEFTB_cjs.ErrorFactory.config(
334
- "PLUGIN_UNIT_COLLISION",
335
- `Plugin unit "${unit}" conflicts with a built-in unit. Built-in units cannot be overridden.`,
336
- { unit }
337
- );
338
- }
339
- this.pluginUnits.add(unit);
340
- }
341
- this.rebuildMergedCollections();
342
- }
343
- if (plugin.rawLinePatterns) {
344
- this.pluginRawLinePatterns.push(...plugin.rawLinePatterns);
345
- }
346
- }
347
- /**
348
- * Unregister a plugin, removing its custom tokens from the lexer.
349
- *
350
- * This is the inverse of registerVocabulary(). All keywords, operators,
351
- * and units registered by the plugin are removed. After
352
- * unregistration, those tokens will revert to their default behavior
353
- * (e.g., keywords become IDENT, operators become ERROR).
354
- *
355
- * Calling unregisterVocabulary with a plugin that was never registered
356
- * is safe, it simply has no effect.
357
- */
358
- unregisterVocabulary(plugin) {
359
- if (plugin.keywords) {
360
- for (const keyword of Object.keys(plugin.keywords)) {
361
- this.pluginKeywordMap.delete(keyword.toLowerCase());
362
- }
363
- this.rebuildMergedCollections();
364
- }
365
- if (plugin.operators) {
366
- for (const chars of Object.keys(plugin.operators)) {
367
- if (chars.length === 2) {
368
- const first = chars.charCodeAt(0);
369
- const second = chars.charCodeAt(1);
370
- const inner = this.pluginOperators.get(first);
371
- if (inner) {
372
- inner.delete(second);
373
- if (inner.size === 0) {
374
- this.pluginOperators.delete(first);
375
- }
376
- }
377
- }
378
- }
379
- this.hasPluginOps = this.pluginOperators.size > 0;
380
- }
381
- if (plugin.units) {
382
- for (const unit of plugin.units) {
383
- this.pluginUnits.delete(unit);
384
- }
385
- this.rebuildMergedCollections();
386
- }
387
- if (plugin.rawLinePatterns) {
388
- const toRemove = new Set(plugin.rawLinePatterns);
389
- this.pluginRawLinePatterns = this.pluginRawLinePatterns.filter((r) => !toRemove.has(r));
390
- }
391
- }
392
- reset(input) {
393
- this.input = input;
394
- this.pos = 0;
395
- this.len = input.length;
396
- this.line = 1;
397
- this.lineStartPos = 0;
398
- this.pendingRawLineToken = this.pluginRawLinePatterns.length > 0 ? this.matchRawLine(input) : null;
399
- }
400
- /**
401
- * Scan a full document text in a single pass, classifying each line and
402
- * tokenizing non-skipped lines.
403
- *
404
- * Replaces the separate classifyLine() + findInlineSolves() + per-line
405
- * reset() + tokenizeAll() pattern with a single character-by-character
406
- * walk through the entire document. Key benefits:
407
- *
408
- * - **Single reset()**: `this.pos`, `this.len`, `this.line`, and
409
- * `this.lineStartPos` are set once for the whole document, not per-line.
410
- * - **Single classification**: classifyLine() runs once per line inline;
411
- * skipped lines are jumped over without tokenization.
412
- * - **Shared tokenization**: Non-skipped lines are tokenized using the
413
- * existing state machine, yielding Token[] without per-line reset().
414
- * - **Inline solve detection**: findInlineSolves() is called only for
415
- * lines that classifyLine() marks as having inline solves.
416
- *
417
- * Tokenization is scoped to each line by temporarily restricting
418
- * `this.len` to the line end position, so the [Symbol.iterator]
419
- * generator naturally stops at the line boundary. After tokenization,
420
- * `this.len` is restored and `this.pos` advances past the newline.
421
- *
422
- * @param text The full document text (with newlines).
423
- * @returns Array of ScanLineResult, one per line, in document order.
424
- */
425
- scanDocument(text) {
426
- this.input = text;
427
- this.pos = 0;
428
- this.len = text.length;
429
- this.line = 1;
430
- this.lineStartPos = 0;
431
- const results = [];
432
- const input = this.input;
433
- const docLen = this.len;
434
- while (this.pos < docLen) {
435
- const lineStart = this.pos;
436
- let lineEnd = this.pos;
437
- while (lineEnd < docLen) {
438
- const cc = input.charCodeAt(lineEnd);
439
- if (cc === 10 || cc === 13) break;
440
- lineEnd++;
441
- }
442
- const lineNumber = this.line;
443
- const classification = this.classifyFromPositions(lineStart, lineEnd);
444
- const lineText = input.slice(lineStart, lineEnd);
445
- let tokens = [];
446
- if (!classification.skip) {
447
- const rawToken = this.pluginRawLinePatterns.length > 0 ? this.matchRawLine(lineText) : null;
448
- if (rawToken) {
449
- tokens = [rawToken];
450
- } else {
451
- const savedLen = this.len;
452
- this.len = lineEnd;
453
- if (classification.contentOffset !== void 0) this.pos = classification.contentOffset;
454
- tokens = Array.from(this);
455
- this.len = savedLen;
456
- }
457
- }
458
- let inlineSolves = [];
459
- if (classification.hasInlineSolve) {
460
- if (!classification.skip && tokens.length > 0) {
461
- const charSpans = this.findInlineSolves(lineText);
462
- inlineSolves = this._inlineSolveSpans.map((span, i) => ({
463
- start: charSpans[i]?.start ?? 0,
464
- end: charSpans[i]?.end ?? 0,
465
- expression: charSpans[i]?.expression ?? "",
466
- columnNumber: charSpans[i]?.columnNumber ?? span.columnNumber,
467
- startTokenIndex: span.startTokenIndex,
468
- endTokenIndex: span.endTokenIndex
469
- }));
470
- } else {
471
- inlineSolves = this.findInlineSolves(lineText);
472
- }
473
- }
474
- results.push({
475
- text: lineText,
476
- lineNumber,
477
- startOffset: lineStart,
478
- endOffset: lineEnd,
479
- classification,
480
- tokens,
481
- inlineSolves
482
- });
483
- this.pos = lineEnd;
484
- if (this.pos < docLen) {
485
- const nlChar = input.charCodeAt(this.pos);
486
- if (nlChar === 13) {
487
- this.pos++;
488
- if (this.pos < docLen && input.charCodeAt(this.pos) === 10) {
489
- this.pos++;
490
- }
491
- } else if (nlChar === 10) {
492
- this.pos++;
493
- }
494
- }
495
- this.line++;
496
- this.lineStartPos = this.pos;
497
- }
498
- return results;
499
- }
500
- /**
501
- * Tokenize an expression string into an array of Tokens.
502
- *
503
- * Delegates to the lazy [Symbol.iterator]() generator and collects all
504
- * yielded tokens via Array.from(). For memory-sensitive use cases, prefer
505
- * iterating the lexer directly with for...of to avoid array allocation.
506
- *
507
- * Optimizations:
508
- * - CHAR_CLASS jump table (Uint8Array) → switch on small integers
509
- * - Direct character-code dispatch (c0 cached pattern)
510
- * - Mathematical digit parsing (integer math, not slice+parseFloat)
511
- * - Inline operator tokenizer with two-char peek-ahead
512
- * - Whitespace eliminated in-lexer (never emitted)
513
- * - 0-char and 1-char fast paths
514
- */
515
- tokenizeAll() {
516
- if (this.pendingRawLineToken) {
517
- this._inlineSolveSpans = [];
518
- return [this.pendingRawLineToken];
519
- }
520
- return Array.from(this);
521
- }
522
- // ── Lazy iterator ─────────────────────────────────────────────────────
523
- /**
524
- * Lazy token-by-token generator. Yields each token without allocating an
525
- * intermediate Token[] array. Supports for...of and spread usage.
526
- *
527
- * Usage:
528
- * for (const t of lexer) { ... } // lazy, no array allocation
529
- * const tokens = [...lexer]; // materializes via spread
530
- * const tokens = lexer.tokenizeAll(); // materializes via Array.from()
531
- *
532
- * IMPORTANT: This generator captures `this.len` ONCE at creation time
533
- * (const len = this.len). `scanDocument()` relies on this behavior to
534
- * scope tokenization to a single line by temporarily restricting
535
- * `this.len` to the line end position before creating the iterator.
536
- * Do NOT refactor to re-read `this.len` mid-loop without also updating
537
- * `scanDocument()`.
538
- */
539
- *[Symbol.iterator]() {
540
- const len = this.len;
541
- if (len === 0) {
542
- this._inlineSolveSpans = [];
543
- return;
544
- }
545
- let tokenIndex = 0;
546
- let openSpan = null;
547
- const collectedSpans = [];
548
- if (len === 1) {
549
- const c0 = this.input.charCodeAt(0);
550
- const cc = _ExpressionLexer.CHAR_CLASS[c0] ?? 0 /* SKIP */;
551
- switch (cc) {
552
- case 2 /* DIGIT */:
553
- case 4 /* DOT */:
554
- yield new LexerToken("NUMBER", chunkQFTDTX6K_cjs.tokenTypeId("NUMBER"), this.input, this.input, 0, 0, 1, 1);
555
- tokenIndex++;
556
- break;
557
- case 3 /* ALPHA */: {
558
- const input2 = this.input;
559
- const identLower = input2.toLowerCase();
560
- if (this.mergedUnits.has(input2)) {
561
- yield new LexerToken("UNIT", chunkQFTDTX6K_cjs.tokenTypeId("UNIT"), input2, input2, 0, 0, 1, 1);
562
- } else {
563
- const kwType = this.mergedKeywords.get(identLower);
564
- if (kwType) {
565
- yield new LexerToken(kwType, chunkQFTDTX6K_cjs.tokenTypeId(kwType), input2, input2, 0, 0, 1, 1);
566
- } else {
567
- yield new LexerToken("IDENT", chunkQFTDTX6K_cjs.tokenTypeId("IDENT"), input2, input2, 0, 0, 1, 1);
568
- }
569
- }
570
- tokenIndex++;
571
- break;
572
- }
573
- case 5 /* OPERATOR */: {
574
- const opType = OP_MAP[c0];
575
- if (opType) {
576
- yield new LexerToken(opType, chunkQFTDTX6K_cjs.tokenTypeId(opType), this.input, this.input, 0, 0, 1, 1);
577
- tokenIndex++;
578
- }
579
- break;
580
- }
581
- case 6 /* QUOTE */:
582
- this.pos = 0;
583
- yield this.tokenizeString();
584
- tokenIndex++;
585
- break;
586
- case 7 /* HASH */:
587
- this.pos = 0;
588
- yield this.tokenizeComment();
589
- tokenIndex++;
590
- break;
591
- case 8 /* DOLLAR */:
592
- yield new LexerToken("DOLLAR", chunkQFTDTX6K_cjs.tokenTypeId("DOLLAR"), "$", "$", 0, 0, 1, 1);
593
- tokenIndex++;
594
- break;
595
- case 11 /* BACKTICK */:
596
- yield new LexerToken("BACKTICK_OPEN", chunkQFTDTX6K_cjs.tokenTypeId("BACKTICK_OPEN"), "`", "`", 0, 0, 1, 1);
597
- tokenIndex++;
598
- break;
599
- default: {
600
- if (isUnicodeSpace(c0)) ; else if (c0 === 215) {
601
- yield new LexerToken("STAR", chunkQFTDTX6K_cjs.tokenTypeId("STAR"), "\xD7", "\xD7", 0, 0, 1, 1);
602
- tokenIndex++;
603
- } else if (c0 === 247) {
604
- yield new LexerToken("SLASH", chunkQFTDTX6K_cjs.tokenTypeId("SLASH"), "\xF7", "\xF7", 0, 0, 1, 1);
605
- tokenIndex++;
606
- } else if (c0 === 177) {
607
- yield new LexerToken("PLUS_MINUS", chunkQFTDTX6K_cjs.tokenTypeId("PLUS_MINUS"), "\xB1", "\xB1", 0, 0, 1, 1);
608
- tokenIndex++;
609
- } else if (c0 === 8800) {
610
- yield new LexerToken("NEQ", chunkQFTDTX6K_cjs.tokenTypeId("NEQ"), "\u2260", "\u2260", 0, 0, 1, 1);
611
- tokenIndex++;
612
- } else if (c0 === 163) {
613
- yield new LexerToken("POUND", chunkQFTDTX6K_cjs.tokenTypeId("POUND"), "\xA3", "\xA3", 0, 0, 1, 1);
614
- tokenIndex++;
615
- } else if (c0 === 8364) {
616
- yield new LexerToken("EURO", chunkQFTDTX6K_cjs.tokenTypeId("EURO"), "\u20AC", "\u20AC", 0, 0, 1, 1);
617
- tokenIndex++;
618
- } else if (c0 === 165) {
619
- yield new LexerToken("YEN", chunkQFTDTX6K_cjs.tokenTypeId("YEN"), "\xA5", "\xA5", 0, 0, 1, 1);
620
- tokenIndex++;
621
- } else if (c0 === 8381) {
622
- yield new LexerToken("RUBLE", chunkQFTDTX6K_cjs.tokenTypeId("RUBLE"), "\u20BD", "\u20BD", 0, 0, 1, 1);
623
- tokenIndex++;
624
- } else if (c0 === 8361) {
625
- yield new LexerToken("WON", chunkQFTDTX6K_cjs.tokenTypeId("WON"), "\u20A9", "\u20A9", 0, 0, 1, 1);
626
- tokenIndex++;
627
- } else if (c0 === 8377) {
628
- yield new LexerToken("CURRENCY_SYMBOL", chunkQFTDTX6K_cjs.tokenTypeId("CURRENCY_SYMBOL"), "\u20B9", "\u20B9", 0, 0, 1, 1);
629
- tokenIndex++;
630
- } else if (c0 === 8378) {
631
- yield new LexerToken("CURRENCY_SYMBOL", chunkQFTDTX6K_cjs.tokenTypeId("CURRENCY_SYMBOL"), "\u20BA", "\u20BA", 0, 0, 1, 1);
632
- tokenIndex++;
633
- } else if (c0 === 8372) {
634
- yield new LexerToken("CURRENCY_SYMBOL", chunkQFTDTX6K_cjs.tokenTypeId("CURRENCY_SYMBOL"), "\u20B4", "\u20B4", 0, 0, 1, 1);
635
- tokenIndex++;
636
- } else if (c0 === 8362) {
637
- yield new LexerToken("CURRENCY_SYMBOL", chunkQFTDTX6K_cjs.tokenTypeId("CURRENCY_SYMBOL"), "\u20AA", "\u20AA", 0, 0, 1, 1);
638
- tokenIndex++;
639
- } else if (c0 === 8363) {
640
- yield new LexerToken("CURRENCY_SYMBOL", chunkQFTDTX6K_cjs.tokenTypeId("CURRENCY_SYMBOL"), "\u20AB", "\u20AB", 0, 0, 1, 1);
641
- tokenIndex++;
642
- } else if (c0 === 8358) {
643
- yield new LexerToken("CURRENCY_SYMBOL", chunkQFTDTX6K_cjs.tokenTypeId("CURRENCY_SYMBOL"), "\u20A6", "\u20A6", 0, 0, 1, 1);
644
- tokenIndex++;
645
- } else if (c0 === 8369) {
646
- yield new LexerToken("CURRENCY_SYMBOL", chunkQFTDTX6K_cjs.tokenTypeId("CURRENCY_SYMBOL"), "\u20B1", "\u20B1", 0, 0, 1, 1);
647
- tokenIndex++;
648
- } else if (c0 >= 128) {
649
- yield new LexerToken("IDENT", chunkQFTDTX6K_cjs.tokenTypeId("IDENT"), this.input, this.input, 0, 0, 1, 1);
650
- tokenIndex++;
651
- }
652
- break;
653
- }
654
- }
655
- this._inlineSolveSpans = collectedSpans;
656
- return;
657
- }
658
- const input = this.input;
659
- this.groupingStack.length = 0;
660
- while (this.pos < len) {
661
- const c0 = input.charCodeAt(this.pos);
662
- const cc = _ExpressionLexer.CHAR_CLASS[c0] ?? 0 /* SKIP */;
663
- if (openSpan && c0 === 92 && this.pos + 1 < len && input.charCodeAt(this.pos + 1) === 96) {
664
- this.pos += 2;
665
- continue;
666
- }
667
- switch (cc) {
668
- // ── Whitespace, skip entirely, track newlines ────────────────
669
- case 1 /* WHITESPACE */:
670
- this.pos++;
671
- if (c0 === 10) {
672
- this.line++;
673
- this.lineStartPos = this.pos;
674
- this.groupingStack.length = 0;
675
- } else if (c0 === 13) {
676
- this.line++;
677
- if (this.pos < len && input.charCodeAt(this.pos) === 10) {
678
- this.pos++;
679
- }
680
- this.lineStartPos = this.pos;
681
- this.groupingStack.length = 0;
682
- }
683
- break;
684
- // ── Digit, inline number tokenizer ───────────────────────────
685
- case 2 /* DIGIT */:
686
- yield this.tokenizeNumber();
687
- tokenIndex++;
688
- break;
689
- // ── Alpha / underscore, identifier or keyword ────────────────
690
- case 3 /* ALPHA */: {
691
- const token = this.tokenizeIdentifier();
692
- if (token.type === "INLINE_SOLVE_START") {
693
- openSpan = { startTokenIndex: tokenIndex, startColumn: token.col };
694
- }
695
- yield token;
696
- tokenIndex++;
697
- break;
698
- }
699
- // ── Dot, could be decimal (.5) or DOT token ─────────────────
700
- case 4 /* DOT */:
701
- if (this.pos + 1 < len) {
702
- const nextCc = _ExpressionLexer.CHAR_CLASS[input.charCodeAt(this.pos + 1)] ?? 0 /* SKIP */;
703
- if (nextCc === 2 /* DIGIT */) {
704
- yield this.tokenizeNumber();
705
- } else {
706
- const col = this.pos - this.lineStartPos + 1;
707
- yield new LexerToken("DOT", chunkQFTDTX6K_cjs.tokenTypeId("DOT"), ".", ".", this.pos, 0, this.line, col);
708
- this.pos++;
709
- }
710
- } else {
711
- const col = this.pos - this.lineStartPos + 1;
712
- yield new LexerToken("DOT", chunkQFTDTX6K_cjs.tokenTypeId("DOT"), ".", ".", this.pos, 0, this.line, col);
713
- this.pos++;
714
- }
715
- tokenIndex++;
716
- break;
717
- // ── Operator / punctuation ────────────────────────────────────
718
- case 5 /* OPERATOR */:
719
- yield this.tokenizeOperator();
720
- tokenIndex++;
721
- break;
722
- // ── String literal ────────────────────────────────────────────
723
- case 6 /* QUOTE */:
724
- yield this.tokenizeString();
725
- tokenIndex++;
726
- break;
727
- // ── Comment (# or //) ─────────────────────────────────────────
728
- case 7 /* HASH */:
729
- yield this.tokenizeComment();
730
- tokenIndex++;
731
- break;
732
- // ── Dollar sign $ ─────────────────────────────────────────────
733
- case 8 /* DOLLAR */: {
734
- const col = this.pos - this.lineStartPos + 1;
735
- yield new LexerToken("DOLLAR", chunkQFTDTX6K_cjs.tokenTypeId("DOLLAR"), "$", "$", this.pos, 0, this.line, col);
736
- this.pos++;
737
- tokenIndex++;
738
- break;
739
- }
740
- // ── Backtick ` ───────────────────────────────────────────────
741
- case 11 /* BACKTICK */: {
742
- const col = this.pos - this.lineStartPos + 1;
743
- yield new LexerToken("BACKTICK_OPEN", chunkQFTDTX6K_cjs.tokenTypeId("BACKTICK_OPEN"), "`", "`", this.pos, 0, this.line, col);
744
- this.pos++;
745
- if (openSpan) {
746
- const span = openSpan;
747
- collectedSpans.push({
748
- start: 0,
749
- end: 0,
750
- expression: "",
751
- columnNumber: span.startColumn,
752
- startTokenIndex: span.startTokenIndex,
753
- endTokenIndex: tokenIndex
754
- });
755
- openSpan = null;
756
- }
757
- tokenIndex++;
758
- break;
759
- }
760
- // ── Non-ASCII characters ─────────────────────────────────────
761
- default: {
762
- const col = this.pos - this.lineStartPos + 1;
763
- if (isUnicodeSpace(c0)) {
764
- this.pos++;
765
- if (c0 === 8232 || c0 === 8233 || c0 === 133) {
766
- this.line++;
767
- this.lineStartPos = this.pos;
768
- }
769
- } else if (c0 === 215) {
770
- yield new LexerToken("STAR", chunkQFTDTX6K_cjs.tokenTypeId("STAR"), "\xD7", "\xD7", this.pos, 0, this.line, col);
771
- this.pos++;
772
- tokenIndex++;
773
- } else if (c0 === 247) {
774
- yield new LexerToken("SLASH", chunkQFTDTX6K_cjs.tokenTypeId("SLASH"), "\xF7", "\xF7", this.pos, 0, this.line, col);
775
- this.pos++;
776
- tokenIndex++;
777
- } else if (c0 === 177) {
778
- yield new LexerToken("PLUS_MINUS", chunkQFTDTX6K_cjs.tokenTypeId("PLUS_MINUS"), "\xB1", "\xB1", this.pos, 0, this.line, col);
779
- this.pos++;
780
- tokenIndex++;
781
- } else if (c0 === 8800) {
782
- yield new LexerToken("NEQ", chunkQFTDTX6K_cjs.tokenTypeId("NEQ"), "\u2260", "\u2260", this.pos, 0, this.line, col);
783
- this.pos++;
784
- tokenIndex++;
785
- } else if (c0 === 163) {
786
- yield new LexerToken("POUND", chunkQFTDTX6K_cjs.tokenTypeId("POUND"), "\xA3", "\xA3", this.pos, 0, this.line, col);
787
- this.pos++;
788
- tokenIndex++;
789
- } else if (c0 === 8364) {
790
- yield new LexerToken("EURO", chunkQFTDTX6K_cjs.tokenTypeId("EURO"), "\u20AC", "\u20AC", this.pos, 0, this.line, col);
791
- this.pos++;
792
- tokenIndex++;
793
- } else if (c0 === 165) {
794
- yield new LexerToken("YEN", chunkQFTDTX6K_cjs.tokenTypeId("YEN"), "\xA5", "\xA5", this.pos, 0, this.line, col);
795
- this.pos++;
796
- tokenIndex++;
797
- } else if (c0 === 8381) {
798
- yield new LexerToken("RUBLE", chunkQFTDTX6K_cjs.tokenTypeId("RUBLE"), "\u20BD", "\u20BD", this.pos, 0, this.line, col);
799
- this.pos++;
800
- tokenIndex++;
801
- } else if (c0 === 8361) {
802
- yield new LexerToken("WON", chunkQFTDTX6K_cjs.tokenTypeId("WON"), "\u20A9", "\u20A9", this.pos, 0, this.line, col);
803
- this.pos++;
804
- tokenIndex++;
805
- } else if (c0 === 8377) {
806
- yield new LexerToken("CURRENCY_SYMBOL", chunkQFTDTX6K_cjs.tokenTypeId("CURRENCY_SYMBOL"), "\u20B9", "\u20B9", this.pos, 0, this.line, col);
807
- this.pos++;
808
- tokenIndex++;
809
- } else if (c0 === 8378) {
810
- yield new LexerToken("CURRENCY_SYMBOL", chunkQFTDTX6K_cjs.tokenTypeId("CURRENCY_SYMBOL"), "\u20BA", "\u20BA", this.pos, 0, this.line, col);
811
- this.pos++;
812
- tokenIndex++;
813
- } else if (c0 === 8372) {
814
- yield new LexerToken("CURRENCY_SYMBOL", chunkQFTDTX6K_cjs.tokenTypeId("CURRENCY_SYMBOL"), "\u20B4", "\u20B4", this.pos, 0, this.line, col);
815
- this.pos++;
816
- tokenIndex++;
817
- } else if (c0 === 8362) {
818
- yield new LexerToken("CURRENCY_SYMBOL", chunkQFTDTX6K_cjs.tokenTypeId("CURRENCY_SYMBOL"), "\u20AA", "\u20AA", this.pos, 0, this.line, col);
819
- this.pos++;
820
- tokenIndex++;
821
- } else if (c0 === 8363) {
822
- yield new LexerToken("CURRENCY_SYMBOL", chunkQFTDTX6K_cjs.tokenTypeId("CURRENCY_SYMBOL"), "\u20AB", "\u20AB", this.pos, 0, this.line, col);
823
- this.pos++;
824
- tokenIndex++;
825
- } else if (c0 === 8358) {
826
- yield new LexerToken("CURRENCY_SYMBOL", chunkQFTDTX6K_cjs.tokenTypeId("CURRENCY_SYMBOL"), "\u20A6", "\u20A6", this.pos, 0, this.line, col);
827
- this.pos++;
828
- tokenIndex++;
829
- } else if (c0 === 8369) {
830
- yield new LexerToken("CURRENCY_SYMBOL", chunkQFTDTX6K_cjs.tokenTypeId("CURRENCY_SYMBOL"), "\u20B1", "\u20B1", this.pos, 0, this.line, col);
831
- this.pos++;
832
- tokenIndex++;
833
- } else if (c0 >= 128) {
834
- yield this.tokenizeIdentifier();
835
- tokenIndex++;
836
- } else {
837
- this.pos++;
838
- }
839
- break;
840
- }
841
- }
842
- }
843
- this._inlineSolveSpans = collectedSpans;
844
- }
845
- // ── Inline number tokenizer ────────────────────────────────────────────
846
- /**
847
- * Character-by-character number parsing.
848
- *
849
- * Supports: integers, floats, scientific notation (1.5e10, 1.5e-10),
850
- * hex (0xFF), binary (0b1010), octal (0o17), BigInt suffix (123n),
851
- * thousands separators (1,234 or 1.234.567).
852
- *
853
- * Returns a LexerToken and advances `this.pos` past the number.
854
- */
855
- tokenizeNumber() {
856
- const input = this.input;
857
- const len = this.len;
858
- let pos = this.pos;
859
- const start = pos;
860
- const startCol = pos - this.lineStartPos + 1;
861
- let cc;
862
- if (input.charCodeAt(pos) === 48 && pos + 1 < len) {
863
- const next = input.charCodeAt(pos + 1);
864
- if (next === 120 || next === 88) {
865
- pos += 2;
866
- while (pos < len && (cc = input.charCodeAt(pos), cc >= 48 && cc <= 57 || cc >= 65 && cc <= 70 || cc >= 97 && cc <= 102)) {
867
- pos++;
868
- }
869
- const text2 = input.slice(start, pos);
870
- this.pos = pos;
871
- return new LexerToken("NUMBER", chunkQFTDTX6K_cjs.tokenTypeId("NUMBER"), text2, text2, start, 0, this.line, startCol);
872
- }
873
- if (next === 98 || next === 66) {
874
- pos += 2;
875
- while (pos < len && (cc = input.charCodeAt(pos), cc === 48 || cc === 49)) {
876
- pos++;
877
- }
878
- const text2 = input.slice(start, pos);
879
- this.pos = pos;
880
- return new LexerToken("NUMBER", chunkQFTDTX6K_cjs.tokenTypeId("NUMBER"), text2, text2, start, 0, this.line, startCol);
881
- }
882
- if (next === 111 || next === 79) {
883
- pos += 2;
884
- while (pos < len && (cc = input.charCodeAt(pos), cc >= 48 && cc <= 55)) {
885
- pos++;
886
- }
887
- const text2 = input.slice(start, pos);
888
- this.pos = pos;
889
- return new LexerToken("NUMBER", chunkQFTDTX6K_cjs.tokenTypeId("NUMBER"), text2, text2, start, 0, this.line, startCol);
890
- }
891
- }
892
- let hasIntPart = false;
893
- while (pos < len && (cc = input.charCodeAt(pos), cc >= 48 && cc <= 57)) {
894
- hasIntPart = true;
895
- pos++;
896
- }
897
- while (hasIntPart && pos < len && (input.charCodeAt(pos) === 44 || input.charCodeAt(pos) === 46)) {
898
- if (input.charCodeAt(pos) === 44 && this.groupingStack.length > 0 && this.groupingStack[this.groupingStack.length - 1]) {
899
- break;
900
- }
901
- if (pos + 4 <= len) {
902
- const d1 = input.charCodeAt(pos + 1);
903
- const d2 = input.charCodeAt(pos + 2);
904
- const d3 = input.charCodeAt(pos + 3);
905
- const d4 = pos + 4 < len ? input.charCodeAt(pos + 4) : -1;
906
- const isGroupOfExactlyThree = !(d4 >= 48 && d4 <= 57);
907
- if (d1 >= 48 && d1 <= 57 && d2 >= 48 && d2 <= 57 && d3 >= 48 && d3 <= 57 && isGroupOfExactlyThree) {
908
- pos += 4;
909
- hasIntPart = true;
910
- continue;
911
- }
912
- }
913
- break;
914
- }
915
- let hasDecimal = false;
916
- if (pos < len && input.charCodeAt(pos) === 46) {
917
- if (pos + 1 < len) {
918
- const nextCc = input.charCodeAt(pos + 1);
919
- if (nextCc >= 48 && nextCc <= 57) {
920
- hasDecimal = true;
921
- pos++;
922
- while (pos < len && (cc = input.charCodeAt(pos), cc >= 48 && cc <= 57)) {
923
- pos++;
924
- }
925
- }
926
- }
927
- }
928
- let hasExponent = false;
929
- if (pos < len) {
930
- const ec = input.charCodeAt(pos);
931
- if (ec === 101 || ec === 69) {
932
- if (pos + 1 < len) {
933
- const next = input.charCodeAt(pos + 1);
934
- if (next >= 48 && next <= 57 || next === 43 || next === 45) {
935
- hasExponent = true;
936
- pos++;
937
- if (next === 43 || next === 45) pos++;
938
- while (pos < len && (cc = input.charCodeAt(pos), cc >= 48 && cc <= 57)) {
939
- pos++;
940
- }
941
- }
942
- }
943
- }
944
- }
945
- if (pos < len && input.charCodeAt(pos) === 110) {
946
- if (hasIntPart && !hasDecimal && !hasExponent) {
947
- pos++;
948
- const text2 = input.slice(start, pos);
949
- this.pos = pos;
950
- return new LexerToken("BIGINT", chunkQFTDTX6K_cjs.tokenTypeId("BIGINT"), text2, text2, start, 0, this.line, startCol);
951
- }
952
- }
953
- const text = input.slice(start, pos);
954
- this.pos = pos;
955
- return new LexerToken("NUMBER", chunkQFTDTX6K_cjs.tokenTypeId("NUMBER"), text, text, start, 0, this.line, startCol);
956
- }
957
- // ── Inline identifier / keyword tokenizer ──────────────────────────────
958
- /**
959
- * Reads [a-zA-Z_][a-zA-Z0-9_]* and resolves to:
960
- * - A unit type (via knownUnits, case-sensitive)
961
- * - A keyword type (via locale keywordMap, case-insensitive)
962
- * - IDENT if none of the above
963
- *
964
- * Multi-word phrases (e.g., "to the power of") are handled by the
965
- * TokenNormalizer post-lexer pass, not the lexer.
966
- */
967
- tokenizeIdentifier() {
968
- const input = this.input;
969
- const len = this.len;
970
- let pos = this.pos;
971
- const start = pos;
972
- const startCol = pos - this.lineStartPos + 1;
973
- let cc;
974
- while (pos < len && (cc = input.charCodeAt(pos), cc >= 48 && cc <= 57 || // 0-9
975
- cc >= 65 && cc <= 90 || // A-Z
976
- cc >= 97 && cc <= 122 || // a-z
977
- cc === 95 || // _
978
- cc >= 128 && !isUnicodeSpace(cc))) {
979
- pos++;
980
- }
981
- const identText = input.slice(start, pos);
982
- const identLower = identText.toLowerCase();
983
- if (identLower === "s" && pos < len && input.charCodeAt(pos) === 96) {
984
- pos++;
985
- this.pos = pos;
986
- const fullText = input.slice(start, pos);
987
- return new LexerToken("INLINE_SOLVE_START", chunkQFTDTX6K_cjs.tokenTypeId("INLINE_SOLVE_START"), fullText, fullText, start, 0, this.line, startCol);
988
- }
989
- const isKnownUnit = this.mergedUnits.has(identText);
990
- if (isKnownUnit) {
991
- if (!this.isFollowedByLParen(pos)) {
992
- this.pos = pos;
993
- return new LexerToken("UNIT", chunkQFTDTX6K_cjs.tokenTypeId("UNIT"), identText, identText, start, 0, this.line, startCol);
994
- }
995
- }
996
- const localeKwType = this.mergedKeywords.get(identLower);
997
- if (localeKwType) {
998
- this.pos = pos;
999
- return new LexerToken(localeKwType, chunkQFTDTX6K_cjs.tokenTypeId(localeKwType), identText, identText, start, 0, this.line, startCol);
1000
- }
1001
- this.pos = pos;
1002
- return new LexerToken("IDENT", chunkQFTDTX6K_cjs.tokenTypeId("IDENT"), identText, identText, start, 0, this.line, startCol);
1003
- }
1004
- /**
1005
- * Peek past in-expression whitespace (space, tab) from `pos` to check
1006
- * if the next significant character is '('.
1007
- */
1008
- isFollowedByLParen(pos) {
1009
- const len = this.len;
1010
- let lookPos = pos;
1011
- while (lookPos < len) {
1012
- const cc = this.input.charCodeAt(lookPos);
1013
- if (cc === 40) return true;
1014
- if (cc !== 32 && cc !== 9) break;
1015
- lookPos++;
1016
- }
1017
- return false;
1018
- }
1019
- // ── Inline operator tokenizer ─────────────────────────────────────────
1020
- /**
1021
- * Whether the `(` at `parenPos` opens a function call rather than a bare
1022
- * grouping, deciding whether a comma inside it is a separator or a thousands
1023
- * group (see {@link groupingStack}).
1024
- *
1025
- * It is a call when the nearest non-whitespace character before it belongs to
1026
- * the value the call applies to: a closing `)`/`]` (a call on a result), or an
1027
- * IDENTIFIER (`rgb(`, `vec2(`). A run of digits alone is a number, not an
1028
- * identifier, so `2(1,000)` is implicit multiplication over the grouping
1029
- * `(1,000)`, not a call, while `vec2(` and `atan2(` (identifiers that end in a
1030
- * digit) are calls. A `(` after an operator, a comma, or the line start is a
1031
- * grouping.
1032
- */
1033
- precededByCallTarget(parenPos) {
1034
- const input = this.input;
1035
- const start = this.lineStartPos;
1036
- let i = parenPos - 1;
1037
- while (i >= start && (input.charCodeAt(i) === 32 || input.charCodeAt(i) === 9)) i--;
1038
- if (i < start) return false;
1039
- const c = input.charCodeAt(i);
1040
- const isWord = (ch) => ch >= 48 && ch <= 57 || ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || ch === 95;
1041
- const isAlpha = (ch) => ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || ch === 95;
1042
- if (!isWord(c)) return false;
1043
- const wordEnd = i + 1;
1044
- let hasAlpha = false;
1045
- while (i >= start) {
1046
- const ch = input.charCodeAt(i);
1047
- if (!isWord(ch)) break;
1048
- if (isAlpha(ch)) hasAlpha = true;
1049
- i--;
1050
- }
1051
- if (!hasAlpha) return false;
1052
- const word = input.slice(i + 1, wordEnd).toLowerCase();
1053
- const keywordType = this.mergedKeywords.get(word);
1054
- return keywordType === void 0 || keywordType === "FUNC";
1055
- }
1056
- /**
1057
- * Reads an operator/punctuation token.
1058
- * Handles two-char operators (==, !=, >=, <=, **) and the special
1059
- * cases << (LSHIFT) and >> (RSHIFT).
1060
- */
1061
- tokenizeOperator() {
1062
- const input = this.input;
1063
- const pos = this.pos;
1064
- const col = pos - this.lineStartPos + 1;
1065
- const c0 = input.charCodeAt(pos);
1066
- const len = this.len;
1067
- if (pos + 1 < len) {
1068
- const c1 = input.charCodeAt(pos + 1);
1069
- const secondMap = TWO_CHAR_OPS[c0];
1070
- if (secondMap) {
1071
- const twoCharType = secondMap[c1];
1072
- if (twoCharType) {
1073
- const text2 = input.slice(pos, pos + 2);
1074
- this.pos = pos + 2;
1075
- return new LexerToken(twoCharType, chunkQFTDTX6K_cjs.tokenTypeId(twoCharType), text2, text2, pos, 0, this.line, col);
1076
- }
1077
- }
1078
- if (c0 === 47 && c1 === 47) {
1079
- let commentPos = pos + 2;
1080
- while (commentPos < len) {
1081
- const cc = input.charCodeAt(commentPos);
1082
- if (cc === 10 || cc === 13) break;
1083
- commentPos++;
1084
- }
1085
- const text2 = input.slice(pos, commentPos);
1086
- this.pos = commentPos;
1087
- return new LexerToken("COMMENT", chunkQFTDTX6K_cjs.tokenTypeId("COMMENT"), text2, text2, pos, 0, this.line, col);
1088
- }
1089
- if (c0 === 60 && c1 === 60) {
1090
- this.pos = pos + 2;
1091
- return new LexerToken("LSHIFT", chunkQFTDTX6K_cjs.tokenTypeId("LSHIFT"), "<<", "<<", pos, 0, this.line, col);
1092
- }
1093
- if (c0 === 62 && c1 === 62) {
1094
- if (input.charCodeAt(pos + 2) === 62) {
1095
- this.pos = pos + 3;
1096
- return new LexerToken("URSHIFT", chunkQFTDTX6K_cjs.tokenTypeId("URSHIFT"), ">>>", ">>>", pos, 0, this.line, col);
1097
- }
1098
- this.pos = pos + 2;
1099
- return new LexerToken("RSHIFT", chunkQFTDTX6K_cjs.tokenTypeId("RSHIFT"), ">>", ">>", pos, 0, this.line, col);
1100
- }
1101
- if (this.hasPluginOps) {
1102
- const pluginInner = this.pluginOperators.get(c0);
1103
- if (pluginInner) {
1104
- const pluginType = pluginInner.get(c1);
1105
- if (pluginType) {
1106
- const text2 = input.slice(pos, pos + 2);
1107
- this.pos = pos + 2;
1108
- return new LexerToken(pluginType, chunkQFTDTX6K_cjs.tokenTypeId(pluginType), text2, text2, pos, 0, this.line, col);
1109
- }
1110
- }
1111
- }
1112
- }
1113
- this.pos = pos + 1;
1114
- if (c0 === 91) {
1115
- this.groupingStack.push(true);
1116
- } else if (c0 === 40) {
1117
- this.groupingStack.push(this.precededByCallTarget(pos));
1118
- } else if (c0 === 41 || c0 === 93) {
1119
- if (this.groupingStack.length > 0) this.groupingStack.pop();
1120
- }
1121
- const opType = OP_MAP[c0];
1122
- const text = input.charAt(pos);
1123
- return new LexerToken(opType || "ERROR", chunkQFTDTX6K_cjs.tokenTypeId(opType || "ERROR"), text, text, pos, 0, this.line, col);
1124
- }
1125
- // ── String literal tokenizer ──────────────────────────────────────────
1126
- /**
1127
- * Reads a double-quoted string literal. Supports backslash escapes.
1128
- *
1129
- * `text` is the raw source slice, quotes included, because that is what
1130
- * `offset` + `text.length` has to span for a host to underline the literal.
1131
- * `value` is the PAYLOAD, quotes excluded, because that is what
1132
- * `PUSH_STRING` puts into the Value.
1133
- *
1134
- * The two used to be the same string. `"abc"` carried the five characters
1135
- * `"abc"` as its value, which was invisible on screen (the formatter prints
1136
- * the payload raw and the retained quotes landed where a display would have
1137
- * put them back) and not invisible anywhere else: `parseFloat('"5"')` is NaN
1138
- * whatever the digits say, so `"5" + 5` answered 5.
1139
- *
1140
- * An unterminated literal is an error rather than a string that happens to
1141
- * reach the end of the line. It used to return what it had, so `"abc` and
1142
- * `"abc"` were indistinguishable by payload once the quotes were stripped,
1143
- * which is the other half of why they are stripped here rather than later.
1144
- */
1145
- tokenizeString() {
1146
- const input = this.input;
1147
- const len = this.len;
1148
- const start = this.pos;
1149
- const startCol = start - this.lineStartPos + 1;
1150
- let pos = start + 1;
1151
- let lineBreaks = 0;
1152
- while (pos < len) {
1153
- const c0 = input.charCodeAt(pos);
1154
- if (c0 === 34) {
1155
- pos++;
1156
- const text = input.slice(start, pos);
1157
- const value = input.slice(start + 1, pos - 1);
1158
- this.pos = pos;
1159
- return new LexerToken("STRING", chunkQFTDTX6K_cjs.tokenTypeId("STRING"), value, text, start, lineBreaks, this.line, startCol);
1160
- }
1161
- if (c0 === 92 && pos + 1 < len) {
1162
- pos += 2;
1163
- continue;
1164
- }
1165
- if (c0 === 10) {
1166
- this.line++;
1167
- this.lineStartPos = pos + 1;
1168
- lineBreaks++;
1169
- }
1170
- pos++;
1171
- }
1172
- this.pos = pos;
1173
- throw chunkB4HBEFTB_cjs.ErrorFactory.parsing(
1174
- "UNTERMINATED_STRING",
1175
- `Unterminated string literal: ${input.slice(start, pos)}`,
1176
- { literal: input.slice(start, pos), offset: start }
1177
- );
1178
- }
1179
- // ── Markdown line scanner (Phase B) ───────────────────────────────────
1180
- /**
1181
- * L1 expression gating: quickly determine if a line contains any
1182
- * characters that indicate an expression (digits, operators, currency,
1183
- * backticks, parentheses, etc.).
1184
- *
1185
- * Pure prose lines (e.g., "The quick brown fox jumps over the lazy dog")
1186
- * return false and can be skipped without full tokenization (L2).
1187
- *
1188
- * This is a fast character-by-character scan that stops at the first
1189
- * expression indicator. Called once per line in classifyFromPositions().
1190
- */
1191
- static hasExpressionIndicators(input, start, end) {
1192
- const indicatorCodes = EXPRESSION_INDICATOR_CODES;
1193
- for (let i = start; i < end; i++) {
1194
- const cc = input.charCodeAt(i);
1195
- if (indicatorCodes.has(cc)) return true;
1196
- if (cc >= 128) {
1197
- if (cc === 215 || cc === 247 || cc === 8800 || cc === 163 || cc === 8364 || cc === 165 || cc === 8381 || cc === 8361) {
1198
- return true;
1199
- }
1200
- }
1201
- }
1202
- return false;
1203
- }
1204
- /**
1205
- * Classify a line by its character positions within this.input.
1206
- * Reads directly from this.input using start/end boundaries.
1207
- * DOES NOT modify this.pos, purely a read-only classifier.
1208
- */
1209
- /**
1210
- * Advance past the whitespace after a list marker, and past a task-item
1211
- * checkbox if one follows.
1212
- *
1213
- * The checkbox is included because it is markup by the same argument the
1214
- * marker is, and because leaving it stopped the line dead: `- [ ] 100 + 20`
1215
- * lexed `[ ]` as a matrix literal and reported that a matrix cannot be
1216
- * empty, which tells a user writing a to-do list nothing they can act on.
1217
- *
1218
- * @param from - Offset just past the marker character.
1219
- * @param end - Line end, never read past.
1220
- * @returns Offset of the first evaluable character.
1221
- */
1222
- skipMarkerGap(from, end) {
1223
- const input = this.input;
1224
- let pos = from;
1225
- while (pos < end && (input.charCodeAt(pos) === 32 || input.charCodeAt(pos) === 9)) pos++;
1226
- if (pos + 2 < end && input.charCodeAt(pos) === 91 && input.charCodeAt(pos + 2) === 93) {
1227
- let after = pos + 3;
1228
- while (after < end && (input.charCodeAt(after) === 32 || input.charCodeAt(after) === 9)) after++;
1229
- if (after > pos + 3) return after;
1230
- }
1231
- return pos;
1232
- }
1233
- /**
1234
- * The end offset (exclusive) of a `#hex` colour literal starting at `hashPos`,
1235
- * or -1 if the run there is not one. A colour is `#` followed by EXACTLY 3, 4,
1236
- * 6 or 8 hex digits (the CSS forms `#rgb`/`#rgba`/`#rrggbb`/`#rrggbbaa`) and
1237
- * then a boundary, not a longer word or number. This is the one predicate that
1238
- * carves colours out of the two things `#` otherwise means, a markdown heading
1239
- * at line start and a comment mid-line, and it is pure character logic so line
1240
- * classification stays vocabulary-independent. Examples: `#f00`, `#ff0000`,
1241
- * `#deadbeef` match; `# Heading` (space), `#tag`/`#todo` (non-hex letter),
1242
- * `#12345` (length 5), `#ff0000zz` (trailing word) do not.
1243
- */
1244
- matchHexColourEnd(hashPos, end) {
1245
- const input = this.input;
1246
- let p = hashPos + 1;
1247
- let n = 0;
1248
- while (p < end) {
1249
- const c = input.charCodeAt(p);
1250
- const isHex = c >= 48 && c <= 57 || c >= 65 && c <= 70 || c >= 97 && c <= 102;
1251
- if (!isHex) break;
1252
- n++;
1253
- p++;
1254
- }
1255
- if (n !== 3 && n !== 4 && n !== 6 && n !== 8) return -1;
1256
- if (p < end) {
1257
- const c = input.charCodeAt(p);
1258
- const isWord = c >= 48 && c <= 57 || c >= 65 && c <= 90 || c >= 97 && c <= 122 || c === 95;
1259
- if (isWord) return -1;
1260
- }
1261
- return p;
1262
- }
1263
- classifyFromPositions(start, end) {
1264
- const len = end;
1265
- if (start >= len) {
1266
- return { type: "empty", skip: true, hasInlineSolve: false };
1267
- }
1268
- const input = this.input;
1269
- let pos = start;
1270
- while (pos < len) {
1271
- const cc = input.charCodeAt(pos);
1272
- if (cc !== 32 && cc !== 9) break;
1273
- pos++;
1274
- }
1275
- if (pos >= len) {
1276
- return { type: "empty", skip: true, hasInlineSolve: false };
1277
- }
1278
- const c0 = input.charCodeAt(pos);
1279
- let hasInline;
1280
- if (c0 === 35) {
1281
- if (this.matchHexColourEnd(pos, len) !== -1) {
1282
- if (hasInline === void 0) {
1283
- const idx = input.indexOf("s`", pos);
1284
- hasInline = idx !== -1 && idx < len;
1285
- }
1286
- return { type: "expression", skip: false, hasInlineSolve: hasInline };
1287
- }
1288
- let hashCount = 1;
1289
- while (pos + hashCount < len && input.charCodeAt(pos + hashCount) === 35) {
1290
- hashCount++;
1291
- }
1292
- if (hashCount <= 6 && pos + hashCount < len && input.charCodeAt(pos + hashCount) === 32) {
1293
- return { type: "heading", skip: true, hasInlineSolve: false };
1294
- }
1295
- return { type: "heading", skip: true, hasInlineSolve: false };
1296
- }
1297
- if (c0 === 62) {
1298
- if (pos + 1 < len && input.charCodeAt(pos + 1) === 32) {
1299
- return { type: "blockquote", skip: true, hasInlineSolve: false };
1300
- }
1301
- }
1302
- if (c0 === 96 && pos + 2 < len && input.charCodeAt(pos + 1) === 96 && input.charCodeAt(pos + 2) === 96) {
1303
- return { type: "code_fence", skip: true, hasInlineSolve: false };
1304
- }
1305
- if (c0 === 126 && pos + 2 < len && input.charCodeAt(pos + 1) === 126 && input.charCodeAt(pos + 2) === 126) {
1306
- return { type: "code_fence", skip: true, hasInlineSolve: false };
1307
- }
1308
- if (c0 === 36 && pos + 1 < len && input.charCodeAt(pos + 1) === 36) {
1309
- return { type: "math_fence", skip: true, hasInlineSolve: false };
1310
- }
1311
- if (c0 === 45 || c0 === 42 || c0 === 95) {
1312
- let count = 1;
1313
- while (pos + count < len && input.charCodeAt(pos + count) === c0) {
1314
- count++;
1315
- }
1316
- if (count >= 3) {
1317
- let trailPos = pos + count;
1318
- while (trailPos < len && (input.charCodeAt(trailPos) === 32 || input.charCodeAt(trailPos) === 9)) {
1319
- trailPos++;
1320
- }
1321
- if (trailPos >= len) {
1322
- return { type: "hr", skip: true, hasInlineSolve: false };
1323
- }
1324
- }
1325
- }
1326
- if ((c0 === 45 || c0 === 42 || c0 === 43) && pos + 1 < len && input.charCodeAt(pos + 1) === 32) {
1327
- if (hasInline === void 0) {
1328
- const idx = input.indexOf("s`", pos);
1329
- hasInline = idx !== -1 && idx < len;
1330
- }
1331
- return { type: "list", skip: false, hasInlineSolve: hasInline, contentOffset: this.skipMarkerGap(pos + 1, len) };
1332
- }
1333
- if (c0 >= 48 && c0 <= 57) {
1334
- let digitPos = pos;
1335
- while (digitPos < len && input.charCodeAt(digitPos) >= 48 && input.charCodeAt(digitPos) <= 57) {
1336
- digitPos++;
1337
- }
1338
- if (digitPos < len && input.charCodeAt(digitPos) === 46) {
1339
- if (digitPos + 1 < len && input.charCodeAt(digitPos + 1) === 32) {
1340
- if (hasInline === void 0) {
1341
- const idx = input.indexOf("s`", pos);
1342
- hasInline = idx !== -1 && idx < len;
1343
- }
1344
- return { type: "list", skip: false, hasInlineSolve: hasInline, contentOffset: this.skipMarkerGap(digitPos + 1, len) };
1345
- }
1346
- }
1347
- }
1348
- if (c0 === 124) {
1349
- let tPos = pos + 1;
1350
- while (tPos < len) {
1351
- const tc = input.charCodeAt(tPos);
1352
- if (tc !== 45 && tc !== 58 && tc !== 124 && tc !== 32 && tc !== 9 && tc !== 13) break;
1353
- tPos++;
1354
- }
1355
- if (tPos >= len) {
1356
- return { type: "table_separator", skip: true, hasInlineSolve: false };
1357
- }
1358
- }
1359
- if (c0 === 91 && pos + 1 < len && input.charCodeAt(pos + 1) === 91) {
1360
- const closePos = input.indexOf("]]", pos + 2);
1361
- if (closePos !== -1 && closePos < len) {
1362
- let trailPos = closePos + 2;
1363
- while (trailPos < len && (input.charCodeAt(trailPos) === 32 || input.charCodeAt(trailPos) === 9)) {
1364
- trailPos++;
1365
- }
1366
- if (trailPos >= len) {
1367
- return { type: "wikilink", skip: true, hasInlineSolve: false };
1368
- }
1369
- }
1370
- }
1371
- if (c0 === 33 && pos + 2 < len && input.charCodeAt(pos + 1) === 91 && input.charCodeAt(pos + 2) === 91) {
1372
- const closePos = input.indexOf("]]", pos + 3);
1373
- if (closePos !== -1 && closePos < len) {
1374
- let trailPos = closePos + 2;
1375
- while (trailPos < len && (input.charCodeAt(trailPos) === 32 || input.charCodeAt(trailPos) === 9)) {
1376
- trailPos++;
1377
- }
1378
- if (trailPos >= len) {
1379
- return { type: "wikilink", skip: true, hasInlineSolve: false };
1380
- }
1381
- }
1382
- }
1383
- if (c0 === 47 && pos + 1 < len && input.charCodeAt(pos + 1) === 47) {
1384
- return { type: "comment", skip: true, hasInlineSolve: false };
1385
- }
1386
- if (c0 === 62) {
1387
- let trail = pos + 1;
1388
- while (trail < len && (input.charCodeAt(trail) === 32 || input.charCodeAt(trail) === 9)) trail++;
1389
- if (trail >= len) return { type: "blockquote", skip: true, hasInlineSolve: false };
1390
- }
1391
- if (c0 === 45 || c0 === 42 || c0 === 43) {
1392
- let trail = pos + 1;
1393
- while (trail < len && (input.charCodeAt(trail) === 32 || input.charCodeAt(trail) === 9)) trail++;
1394
- if (trail >= len) return { type: "list", skip: false, hasInlineSolve: false };
1395
- }
1396
- if (hasInline === void 0) {
1397
- const idx = input.indexOf("s`", pos);
1398
- hasInline = idx !== -1 && idx < len;
1399
- }
1400
- if (!hasInline) {
1401
- let onlySkippable = true;
1402
- for (let i = pos; i < len; i++) {
1403
- const code = input.charCodeAt(i);
1404
- if (code >= 128 || _ExpressionLexer.CHAR_CLASS[code] > 1 /* WHITESPACE */) {
1405
- onlySkippable = false;
1406
- break;
1407
- }
1408
- }
1409
- if (onlySkippable) {
1410
- return { type: "empty", skip: true, hasInlineSolve: false };
1411
- }
1412
- }
1413
- return { type: "expression", skip: false, hasInlineSolve: hasInline };
1414
- }
1415
- /**
1416
- * Classify a single line of markdown text.
1417
- */
1418
- classifyLine(lineText) {
1419
- const savedInput = this.input;
1420
- const savedLen = this.len;
1421
- const savedPos = this.pos;
1422
- this.input = lineText;
1423
- this.len = lineText.length;
1424
- this.pos = 0;
1425
- const result = this.classifyFromPositions(0, lineText.length);
1426
- this.input = savedInput;
1427
- this.len = savedLen;
1428
- this.pos = savedPos;
1429
- return result;
1430
- }
1431
- /**
1432
- * Every keyword this lexer currently recognizes, locale keywords
1433
- * (`pi`, `sqrt`, `convert`, ...) merged with any plugin-contributed ones
1434
- * from `registerVocabulary()` (e.g. a package's custom keywords), mapped to
1435
- * the token type they lex to. A snapshot copy, not a live reference
1436
- * mutating the return value has no effect on the lexer.
1437
- */
1438
- getKeywords() {
1439
- return Object.fromEntries(this.mergedKeywords);
1440
- }
1441
- /**
1442
- * Find all inline solve markers in a line with precise coordinate mapping.
1443
- */
1444
- findInlineSolves(lineText) {
1445
- const results = [];
1446
- const len = lineText.length;
1447
- let pos = 0;
1448
- while (pos < len) {
1449
- const sPos = lineText.indexOf("s`", pos);
1450
- if (sPos === -1) break;
1451
- const exprStart = sPos + 2;
1452
- let exprEnd = exprStart;
1453
- while (exprEnd < len) {
1454
- const cc = lineText.charCodeAt(exprEnd);
1455
- if (cc === 92 && exprEnd + 1 < len) {
1456
- exprEnd += 2;
1457
- continue;
1458
- }
1459
- if (cc === 96) break;
1460
- exprEnd++;
1461
- }
1462
- if (exprEnd >= len) {
1463
- exprEnd = len;
1464
- }
1465
- const expression = lineText.slice(exprStart, exprEnd);
1466
- const end = exprEnd < len ? exprEnd + 1 : exprEnd;
1467
- results.push({
1468
- start: sPos,
1469
- end,
1470
- expression,
1471
- columnNumber: sPos + 1
1472
- });
1473
- pos = end;
1474
- }
1475
- return results;
1476
- }
1477
- // ── Comment tokenizer ─────────────────────────────────────────────────
1478
- /**
1479
- * Reads a comment: # to end of line, or // to end of line.
1480
- */
1481
- tokenizeComment() {
1482
- const input = this.input;
1483
- const len = this.len;
1484
- const start = this.pos;
1485
- const startCol = start - this.lineStartPos + 1;
1486
- if (input.charCodeAt(start) === 35) {
1487
- const hexEnd = this.matchHexColourEnd(start, len);
1488
- if (hexEnd !== -1) {
1489
- const text2 = input.slice(start, hexEnd);
1490
- this.pos = hexEnd;
1491
- return new LexerToken("HEX_COLOUR", chunkQFTDTX6K_cjs.tokenTypeId("HEX_COLOUR"), text2, text2, start, 0, this.line, startCol);
1492
- }
1493
- }
1494
- let pos = this.pos;
1495
- if (pos + 1 < len && input.charCodeAt(pos + 1) === 47) {
1496
- pos += 2;
1497
- } else {
1498
- pos++;
1499
- }
1500
- while (pos < len) {
1501
- const c0 = input.charCodeAt(pos);
1502
- if (c0 === 10 || c0 === 13) break;
1503
- pos++;
1504
- }
1505
- const text = input.slice(start, pos);
1506
- this.pos = pos;
1507
- return new LexerToken("COMMENT", chunkQFTDTX6K_cjs.tokenTypeId("COMMENT"), text, text, start, 0, this.line, startCol);
1508
- }
1509
- };
1510
- _ExpressionLexer.CHAR_CLASS = buildCharClassTable();
1511
- var ExpressionLexer = _ExpressionLexer;
1512
-
1513
- exports.ExpressionLexer = ExpressionLexer;
1514
- exports.LexerToken = LexerToken;
1515
- //# sourceMappingURL=chunk-ZMW6NU2K.cjs.map
1516
- //# sourceMappingURL=chunk-ZMW6NU2K.cjs.map