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,829 +0,0 @@
1
- 'use strict';
2
-
3
- var chunkXA4CKRML_cjs = require('./chunk-XA4CKRML.cjs');
4
- var chunkJ45BCEZ4_cjs = require('./chunk-J45BCEZ4.cjs');
5
- var chunkQFTDTX6K_cjs = require('./chunk-QFTDTX6K.cjs');
6
- var chunkOUHT5Z36_cjs = require('./chunk-OUHT5Z36.cjs');
7
- var chunkB4HBEFTB_cjs = require('./chunk-B4HBEFTB.cjs');
8
-
9
- // src/parser/registry/ParseletRegistry.ts
10
- function bindingPowersOf(parselet) {
11
- return parselet;
12
- }
13
- var ParseletRegistry = class {
14
- constructor() {
15
- // String-keyed maps (kept for diagnostics + backwards compat)
16
- this.prefixParselets = /* @__PURE__ */ new Map();
17
- this.infixParselets = /* @__PURE__ */ new Map();
18
- // Integer-keyed maps for parser hot path
19
- this.prefixById = /* @__PURE__ */ new Map();
20
- this.infixById = /* @__PURE__ */ new Map();
21
- }
22
- /**
23
- * Register a prefix parselet for `tokenType`.
24
- *
25
- * If another parselet is already registered for this token type, it is
26
- * silently overwritten by default (`Map.set()` semantics), the old
27
- * parselet is simply unreachable from then on, with no error. This is
28
- * a real footgun for third-party packages: two packages independently
29
- * choosing the same custom token type will collide with zero signal
30
- * about which one "won". Mirrors ResolverRegistry.register()'s and
31
- * ExpressionEngine.registerPackage()'s existing "warn and replace"
32
- * pattern for the same class of problem at the resolver-namespace and
33
- * package-name levels.
34
- *
35
- * Note: this warns about registry-level collisions only. It does NOT
36
- * detect the separate case where `tokenType` is one of PrecedenceParser's
37
- * Tier-1 fast-path token types (NUMBER, STRING, IDENT, LPAREN, MINUS,
38
- * PLUS, and the Tier-1 infix operators), those are deliberately kept
39
- * registered here for introspection/diagnostics even though Tier-1
40
- * always intercepts them before this registry is consulted (see
41
- * PrecedenceParser.parsePrefix()'s docs), so warning there would
42
- * misfire on that intentional, already-documented pattern.
43
- */
44
- registerPrefix(tokenType, parselet) {
45
- const existing = this.prefixParselets.get(tokenType);
46
- if (existing && existing !== parselet) {
47
- console.warn(
48
- `[ParseletRegistry] Prefix parselet for token "${tokenType}" is already registered (category: "${existing.category ?? "unknown"}"). Overwriting with a new parselet (category: "${parselet.category ?? "unknown"}") \u2014 the previous parselet is now unreachable. Two packages may be claiming the same token type.`
49
- );
50
- }
51
- this.prefixParselets.set(tokenType, parselet);
52
- this.prefixById.set(chunkQFTDTX6K_cjs.tokenTypeId(tokenType), parselet);
53
- }
54
- /** Register an infix parselet for `tokenType`. See {@link registerPrefix} for the collision-warning behavior this mirrors. */
55
- registerInfix(tokenType, parselet) {
56
- const existing = this.infixParselets.get(tokenType);
57
- if (existing && existing !== parselet) {
58
- console.warn(
59
- `[ParseletRegistry] Infix parselet for token "${tokenType}" is already registered (category: "${existing.category ?? "unknown"}"). Overwriting with a new parselet (category: "${parselet.category ?? "unknown"}") \u2014 the previous parselet is now unreachable. Two packages may be claiming the same token type.`
60
- );
61
- }
62
- this.infixParselets.set(tokenType, parselet);
63
- this.infixById.set(chunkQFTDTX6K_cjs.tokenTypeId(tokenType), parselet);
64
- }
65
- /**
66
- * Iterate all registered prefix parselets for diagnostic display.
67
- *
68
- * `PrefixParselet` declares no binding power, and this used to read a field
69
- * of that name and report 0 for every one of them. 0 is not a neutral
70
- * wrong answer: it is the value that means "not an operator, stop the
71
- * expression", so a host drawing a table from this was told none of them
72
- * bind at all. A prefix parselet in this parser has no per-parselet power
73
- * to report, they all bind at the prefix level and each chooses for itself
74
- * at what power to parse its own operand, so that level is what is
75
- * reported. A parselet that does carry its own `bindingPower` still wins.
76
- */
77
- getAllPrefix() {
78
- const result = [];
79
- for (const [tokenType, parselet] of this.prefixParselets) {
80
- result.push({
81
- tokenType,
82
- bindingPower: bindingPowersOf(parselet).bindingPower ?? chunkJ45BCEZ4_cjs.BindingPower.Prefix,
83
- category: parselet.category
84
- });
85
- }
86
- return result;
87
- }
88
- /**
89
- * Iterate all registered infix parselets for diagnostic display.
90
- *
91
- * The field an `InfixParselet` actually declares is `bindingPower`. This
92
- * used to read `leftBindingPower` and `rightBindingPower`, which no
93
- * parselet in this codebase declares, so both reads were `undefined`, both
94
- * fell to the `?? 0` default, and the public `getParseletRegistry()`
95
- * reported a binding power of 0 for every one of the ~60 infix operators.
96
- * A host building a precedence table from it was told `*` and `+` bind
97
- * equally, and that neither binds at all.
98
- *
99
- * The left/right split: `bindingPower` is the LEFT power, and the right is
100
- * one higher. That is the standard encoding for a left-associative
101
- * operator, and it is what the parser itself does, see
102
- * `PrecedenceParser.parseExpression()`'s `bp + 1` for the right operand.
103
- * Every operator is reported that way, `^` included. Associativity is not
104
- * something a parselet declares, it is a property of how each one calls
105
- * `parseExpression`, so this API cannot report it without a new field on
106
- * the interface. See {@link ParseletBindingPowers} for why scraping a
107
- * plausible-looking one off the parselet is worse than not reporting it.
108
- */
109
- getAllInfix() {
110
- const result = [];
111
- for (const [tokenType, parselet] of this.infixParselets) {
112
- const left = bindingPowersOf(parselet).bindingPower ?? 0;
113
- result.push({
114
- tokenType,
115
- leftBindingPower: left,
116
- rightBindingPower: left + 1,
117
- category: parselet.category
118
- });
119
- }
120
- return result;
121
- }
122
- /** Number of registered prefix parselets. */
123
- get prefixCount() {
124
- return this.prefixParselets.size;
125
- }
126
- /** Number of registered infix parselets. */
127
- get infixCount() {
128
- return this.infixParselets.size;
129
- }
130
- /**
131
- * Get prefix parselet by string token type OR integer typeId.
132
- * Fast path for integer IDs (Parser hot path), fallback for strings
133
- * (diagnostics, error messages, backwards compatibility).
134
- */
135
- getPrefix(tokenType) {
136
- if (typeof tokenType === "number") return this.prefixById.get(tokenType);
137
- return this.prefixParselets.get(tokenType);
138
- }
139
- /**
140
- * Get infix parselet by string token type OR integer typeId.
141
- * Fast path for integer IDs (Parser hot path), fallback for strings.
142
- */
143
- getInfix(tokenType) {
144
- if (typeof tokenType === "number") return this.infixById.get(tokenType);
145
- return this.infixParselets.get(tokenType);
146
- }
147
- hasPrefix(tokenType) {
148
- return this.prefixParselets.has(tokenType);
149
- }
150
- hasInfix(tokenType) {
151
- return this.infixParselets.has(tokenType);
152
- }
153
- clear() {
154
- this.prefixParselets.clear();
155
- this.infixParselets.clear();
156
- this.prefixById.clear();
157
- this.infixById.clear();
158
- }
159
- };
160
- var sharedParseletRegistry = new ParseletRegistry();
161
-
162
- // src/parser/PrecedenceParser.ts
163
- var CHAINED_DOT_THOUSANDS_GROUPS = /^\d{1,3}(\.\d{3}){2,}$/;
164
- var PLAIN_DECIMAL = /^\d*\.\d*$/;
165
- var _PrecedenceParser = class _PrecedenceParser {
166
- constructor(parseletRegistry, maxDepth = 50, localeCode = "en") {
167
- this.tokens = [];
168
- this.current = 0;
169
- this.depth = 0;
170
- this.currentExpression = "";
171
- /**
172
- * The binding power the current infix parselet is being invoked at, i.e. the
173
- * `minBp` of the expression it sits inside. Set immediately before each Tier-2
174
- * parselet runs. A parselet that decides whether to swallow a following
175
- * loose operator (UomLiteralParselet with a trailing `in`/`to`) reads this to
176
- * respect precedence it cannot otherwise see: `120 km / 2 hours in kph` must
177
- * group as `(120 km / 2 hours) in kph`, not `120 km / (2 hours in kph)`.
178
- */
179
- this.infixMinBindingPower = 0;
180
- this.registry = parseletRegistry;
181
- this.maxDepth = maxDepth;
182
- this.localeCode = localeCode;
183
- }
184
- /** Get locale code for NumberParselet to normalize separators */
185
- getLocaleCode() {
186
- return this.localeCode;
187
- }
188
- /**
189
- * Set the diagnostic pipeline for parselet matching events.
190
- * Cleared after each non-cached parse to avoid holding refs.
191
- */
192
- setDiagnosticPipeline(pipeline, expression) {
193
- this.diagnosticPipeline = pipeline;
194
- this.currentExpression = expression ?? "";
195
- }
196
- /**
197
- * Load tokens for parsing. Identical to Parser.load().
198
- *
199
- * @param hasParens - if false, skips the O(n) paren balance scan (~90% of expressions)
200
- */
201
- load(tokens, hasParens) {
202
- if (hasParens === false) {
203
- this.tokens = tokens;
204
- this.current = 0;
205
- this.depth = 0;
206
- return;
207
- }
208
- const LPAREN_ID = chunkQFTDTX6K_cjs.tokenTypeId(chunkQFTDTX6K_cjs.TokenTypes.LPAREN);
209
- const RPAREN_ID = chunkQFTDTX6K_cjs.tokenTypeId(chunkQFTDTX6K_cjs.TokenTypes.RPAREN);
210
- let openCount = 0;
211
- for (let i = 0; i < tokens.length; i++) {
212
- if (tokens[i].typeId === LPAREN_ID) openCount++;
213
- else if (tokens[i].typeId === RPAREN_ID) openCount--;
214
- }
215
- this.tokens = openCount === 0 ? tokens : this.balanceParens(tokens, openCount);
216
- this.current = 0;
217
- this.depth = 0;
218
- }
219
- /**
220
- * Auto-balance unmatched parentheses.
221
- */
222
- balanceParens(tokens, openCount) {
223
- const result = tokens.slice();
224
- if (openCount > 0) {
225
- const RPAREN_ID = chunkQFTDTX6K_cjs.tokenTypeId(chunkQFTDTX6K_cjs.TokenTypes.RPAREN);
226
- for (let i = 0; i < openCount; i++) {
227
- const lastToken = tokens[tokens.length - 1];
228
- result.push({
229
- type: chunkQFTDTX6K_cjs.TokenTypes.RPAREN,
230
- typeId: RPAREN_ID,
231
- value: ")",
232
- text: ")",
233
- offset: lastToken ? lastToken.offset + lastToken.text.length : 0,
234
- lineBreaks: 0,
235
- line: lastToken ? lastToken.line : 1,
236
- col: lastToken ? lastToken.col + lastToken.text.length : 1
237
- });
238
- }
239
- } else if (openCount < 0) {
240
- const LPAREN_ID = chunkQFTDTX6K_cjs.tokenTypeId(chunkQFTDTX6K_cjs.TokenTypes.LPAREN);
241
- for (let i = 0; i < -openCount; i++) {
242
- result.unshift({
243
- type: chunkQFTDTX6K_cjs.TokenTypes.LPAREN,
244
- typeId: LPAREN_ID,
245
- value: "(",
246
- text: "(",
247
- offset: 0,
248
- lineBreaks: 0,
249
- line: 1,
250
- col: 1
251
- });
252
- }
253
- }
254
- return result;
255
- }
256
- // ═══════════════════════════════════════════════════════════════════════════════
257
- // Main entry point: precedence climbing parse expression
258
- // ═══════════════════════════════════════════════════════════════════════════════
259
- /**
260
- * Parse a full expression starting at the current token position.
261
- *
262
- * @param minBp - minimum binding power (precedence climbing threshold).
263
- * For left-associative operators, the recursive call uses `bp + 1`.
264
- * For right-associative operators (^), it uses `bp - 1`.
265
- * @param _builder - accepted for parselet API compatibility; always uses `this.builder`.
266
- */
267
- parseExpression(minBp = 0, _builder) {
268
- if (_builder) {
269
- this.builder = _builder;
270
- }
271
- this.depth++;
272
- if (this.depth > this.maxDepth) {
273
- this.depth--;
274
- throw chunkB4HBEFTB_cjs.ErrorFactory.parsing(
275
- "NESTING_DEPTH_EXCEEDED",
276
- `Parse nesting depth ${this.depth} exceeds maximum of ${this.maxDepth}`,
277
- { maxDepth: this.maxDepth, currentDepth: this.depth }
278
- );
279
- }
280
- const token = this.consume();
281
- if (!token) {
282
- this.depth--;
283
- throw chunkB4HBEFTB_cjs.ErrorFactory.parsing("UNEXPECTED_END", "Unexpected end of expression");
284
- }
285
- this.parsePrefix(token);
286
- const tokens = this.tokens;
287
- const len = tokens.length;
288
- const bpTable = _PrecedenceParser.BP_TABLE;
289
- const registry = this.registry;
290
- const builder = this.builder;
291
- let idx = this.current;
292
- while (idx < len) {
293
- const lookahead = tokens[idx];
294
- if (!lookahead) break;
295
- const bp = bpTable[lookahead.typeId];
296
- if (bp > 0) {
297
- if (bp <= minBp) break;
298
- if (this.diagnosticPipeline) {
299
- const infixParselet = registry.getInfix(lookahead.typeId);
300
- if (infixParselet) {
301
- this.fireParseletMatched(infixParselet, lookahead, false, bp);
302
- }
303
- }
304
- this.current = ++idx;
305
- const typeId = lookahead.typeId;
306
- if (typeId === _PrecedenceParser.PERCENT_ID) {
307
- builder.emitOpcode(10 /* PUSH_NUMBER */);
308
- builder.emitNumber(100);
309
- builder.emitOpcode(23 /* DIV */);
310
- builder.emitOpcode(74 /* TO_PERCENTAGE */);
311
- } else if (typeId === _PrecedenceParser.CARET_ID && this.tryEmitMatrixCaretOp(builder)) ; else {
312
- const rightBp = typeId === _PrecedenceParser.CARET_ID ? bp - 1 : bp + 1;
313
- this.parseExpression(rightBp, builder);
314
- builder.emitOpcode(_PrecedenceParser.INFIX_OPCODE[typeId]);
315
- }
316
- } else {
317
- const infixParselet = registry.getInfix(lookahead.typeId);
318
- if (!infixParselet) break;
319
- if (infixParselet.bindingPower <= minBp) break;
320
- this.current = ++idx;
321
- if (this.diagnosticPipeline) {
322
- this.fireParseletMatched(infixParselet, lookahead, false, infixParselet.bindingPower);
323
- }
324
- this.infixMinBindingPower = minBp;
325
- infixParselet.parse(this, token, lookahead, builder);
326
- }
327
- idx = this.current;
328
- }
329
- this.current = idx;
330
- this.depth--;
331
- }
332
- // ═══════════════════════════════════════════════════════════════════════════════
333
- // Prefix dispatch: inline switch for built-ins, parselet registry for plugins
334
- // ═══════════════════════════════════════════════════════════════════════════════
335
- /**
336
- * Parse a prefix token. Built-in tokens (NUMBER, IDENT, LPAREN, etc.) are
337
- * handled inline with zero registry lookup. Everything else falls through
338
- * to the parselet registry (Tier 2).
339
- */
340
- parsePrefix(token) {
341
- const builder = this.builder;
342
- const typeId = token.typeId;
343
- if (this.diagnosticPipeline) {
344
- const parselet = this.registry.getPrefix(typeId);
345
- if (parselet) {
346
- this.fireParseletMatched(parselet, token, true);
347
- }
348
- }
349
- switch (typeId) {
350
- // ── Numeric literals ──────────────────────────────────────────────────
351
- case _PrecedenceParser.NUMBER_ID: {
352
- let v;
353
- let decimalText = null;
354
- const raw = token.value;
355
- if (raw.startsWith("0x") || raw.startsWith("0X")) {
356
- v = parseInt(raw, 16);
357
- if (Number.isNaN(v)) {
358
- throw chunkB4HBEFTB_cjs.ErrorFactory.parsing("INVALID_NUMBER_LITERAL", `Invalid hex literal: "${raw}"`, { raw });
359
- }
360
- } else if (raw.startsWith("0b") || raw.startsWith("0B")) {
361
- v = parseInt(raw.slice(2), 2);
362
- if (Number.isNaN(v)) {
363
- throw chunkB4HBEFTB_cjs.ErrorFactory.parsing("INVALID_NUMBER_LITERAL", `Invalid binary literal: "${raw}"`, { raw });
364
- }
365
- } else if (raw.startsWith("0o") || raw.startsWith("0O")) {
366
- v = parseInt(raw.slice(2), 8);
367
- if (Number.isNaN(v)) {
368
- throw chunkB4HBEFTB_cjs.ErrorFactory.parsing("INVALID_NUMBER_LITERAL", `Invalid octal literal: "${raw}"`, { raw });
369
- }
370
- } else if (CHAINED_DOT_THOUSANDS_GROUPS.test(raw)) {
371
- v = parseFloat(raw.split(".").join(""));
372
- } else {
373
- const locale = chunkOUHT5Z36_cjs.getLocale(this.localeCode);
374
- const decimalSep = locale.display.decimalSeparator;
375
- const thousandsSep = locale.display.thousandsSeparator;
376
- let normalized = raw;
377
- if (thousandsSep) {
378
- normalized = normalized.split(thousandsSep).join("");
379
- }
380
- if (decimalSep && decimalSep !== ".") {
381
- normalized = normalized.replace(decimalSep, ".");
382
- }
383
- v = parseFloat(normalized);
384
- if (PLAIN_DECIMAL.test(normalized)) decimalText = normalized;
385
- }
386
- if (decimalText !== null) {
387
- builder.emitOpcode(16 /* PUSH_DECIMAL */);
388
- builder.emitString(decimalText);
389
- return;
390
- }
391
- builder.emitOpcode(10 /* PUSH_NUMBER */);
392
- builder.emitNumber(v);
393
- return;
394
- }
395
- case _PrecedenceParser.BIGINT_ID: {
396
- builder.emitOpcode(11 /* PUSH_BIGINT */);
397
- builder.emitString(chunkJ45BCEZ4_cjs.bigIntLiteralDigits(token.value, this.localeCode));
398
- return;
399
- }
400
- case _PrecedenceParser.STRING_ID: {
401
- builder.emitOpcode(13 /* PUSH_STRING */);
402
- builder.emitString(token.value);
403
- return;
404
- }
405
- // ── Identifiers (variables) ────────────────────────────────────────────
406
- case _PrecedenceParser.IDENT_ID: {
407
- if (this.peek()?.typeId === _PrecedenceParser.LPAREN_ID) {
408
- this.parseUserFunctionDefOrCall(token, builder);
409
- return;
410
- }
411
- builder.emitOpcode(60 /* LOAD_VAR */);
412
- builder.emitString(token.value);
413
- return;
414
- }
415
- // ── Grouping / bare-tuple vector literal ─────────────────────────────────
416
- // `(expr)` groups for precedence; `(x, y[, z[, w]])` is the bare-tuple
417
- // vector literal documented as an alternative to vec2/vec3/vec4(...)
418
- // (wiki: Arithmetic/Vector). This Tier-1 case is what actually runs for
419
- // every LPAREN in production parsing, GroupParselet.ts mirrors this
420
- // logic for registry-introspection/diagnostic-listing purposes, but a
421
- // package can never override LPAREN's dispatch here (Tier 1 always
422
- // wins over the ParseletRegistry fallback below), so both must be kept
423
- // in sync by hand.
424
- case _PrecedenceParser.LPAREN_ID: {
425
- this.parseExpression(0, builder);
426
- let count = 1;
427
- while (this.match(chunkQFTDTX6K_cjs.TokenTypes.COMMA)) {
428
- this.parseExpression(0, builder);
429
- count++;
430
- }
431
- this.consume(chunkQFTDTX6K_cjs.TokenTypes.RPAREN);
432
- if (count > 1) {
433
- builder.emitOpcode(152 /* MAT_NEW */);
434
- builder.emitIndex(1);
435
- builder.emitIndex(count);
436
- }
437
- return;
438
- }
439
- // ── Unary operators ───────────────────────────────────────────────────
440
- case _PrecedenceParser.MINUS_ID: {
441
- this.parseExpression(chunkJ45BCEZ4_cjs.BindingPower.Prefix, builder);
442
- builder.emitOpcode(26 /* NEG */);
443
- return;
444
- }
445
- case _PrecedenceParser.PLUS_ID: {
446
- this.parseExpression(chunkJ45BCEZ4_cjs.BindingPower.Prefix, builder);
447
- builder.emitOpcode(27 /* POS */);
448
- return;
449
- }
450
- // ── Keyword constants ─────────────────────────────────────────────────
451
- case _PrecedenceParser.KEYWORD_ID: }
452
- const prefixParselet = this.registry.getPrefix(typeId);
453
- if (!prefixParselet) {
454
- throw chunkB4HBEFTB_cjs.ErrorFactory.parsing(
455
- "NO_PREFIX_PARSELET",
456
- `No prefix parselet found for token: ${token.type} ("${token.value}")`,
457
- { tokenType: token.type, tokenValue: token.value }
458
- );
459
- }
460
- prefixParselet.parse(this, token, builder);
461
- }
462
- /**
463
- * After a `^` token (already consumed by the Tier-1 infix loop above),
464
- * checks {@link CARET_SUFFIX_RULES} in order for a shape that means
465
- * something other than ordinary exponentiation: `^T` (transpose) and `^-1`
466
- * (matrix inverse, LITERALLY the integer exponent `-1`; `^-2`, `^-1.5`
467
- * etc. still mean ordinary exponentiation). On a match, the rule's `emit`
468
- * consumes that shape's own tokens and this returns `true`. On no match,
469
- * consumes NOTHING, returning `false` so the caller falls through to
470
- * ordinary `EXP` parsing.
471
- *
472
- * Every rule dispatches purely on SHAPE, never on operand type (unknowable
473
- * at parse time): `inv()`'s own handler (`VMBuiltins.ts` index 65) returns
474
- * `1/x` for a plain Number, byte-identical to what `Math.pow(x, -1)`
475
- * already computed for `x^-1` before this feature existed, and a real
476
- * matrix inverse for a Matrix, so `5^-1` still means exactly what it always
477
- * has; only a Matrix operand actually inverts.
478
- *
479
- * Adding a future `^`-suffix shape is a new table entry here, not a new
480
- * if-block. See the "Tier-1 shape-exception" pattern write-up above for
481
- * why this table can't instead be a package-registered parselet.
482
- */
483
- tryEmitMatrixCaretOp(builder) {
484
- for (const rule of _PrecedenceParser.CARET_SUFFIX_RULES) {
485
- if (rule.matches(this)) {
486
- rule.emit(this, builder);
487
- return true;
488
- }
489
- }
490
- return false;
491
- }
492
- // ═══════════════════════════════════════════════════════════════════════════════
493
- // User-defined, parameterized, reusable functions (f(x) = 2*x + 1, then f(5))
494
- // ═══════════════════════════════════════════════════════════════════════════════
495
- /**
496
- * From an LPAREN token index, scan forward tracking paren depth and
497
- * return the index of the matching RPAREN, or `null` if the parens never
498
- * balance before the token stream ends. No emission, no position
499
- * advance. Same class of technique as {@link balanceParens}'s own
500
- * pre-scan, just exposed mid-parse instead of only at `load()` time.
501
- * `openIdx` must point AT the LPAREN itself.
502
- */
503
- findMatchingRParen(openIdx) {
504
- let depth = 0;
505
- for (let i = openIdx; i < this.tokens.length; i++) {
506
- const t = this.tokens[i];
507
- if (t.typeId === _PrecedenceParser.LPAREN_ID) depth++;
508
- else if (t.typeId === _PrecedenceParser.RPAREN_ID) {
509
- depth--;
510
- if (depth === 0) return i;
511
- }
512
- }
513
- return null;
514
- }
515
- /**
516
- * Disambiguates a bare `IDENT` immediately followed by `(` between three
517
- * things, using ONLY a bracket-depth scan (no backtracking, nothing is
518
- * consumed until the shape is known):
519
- * - `f(x) = expr`, a DEFINITION: the matching `)` is followed by `=`.
520
- * - `f(5)`, a CALL to a (possibly not-yet-defined) function: anything
521
- * else. This was never valid syntax before this feature (a bare
522
- * `IDENT` immediately before `(` has no pre-existing "plain variable
523
- * read + separately grouped `(...)`" meaning to preserve, confirmed
524
- * via `BuiltinNormalizerRules.ts`'s `implicitMultiplyRule()`, which
525
- * only inserts an implicit `*` for `NUMBER/RPAREN` immediately before
526
- * `IDENT/LPAREN`, never for a bare `IDENT` immediately before
527
- * `LPAREN`). Always commits to a CALL; an unregistered name produces a
528
- * clear `UNDEFINED_FUNCTION` error at VM-execution time, the same
529
- * forward-reference philosophy `LOAD_VAR`/`UNDEFINED_VARIABLE` already
530
- * uses, rather than any parse-time registry lookup.
531
- * If the parens never balance, this falls through to the ordinary
532
- * `LOAD_VAR` path (a malformed expression surfaces its own parse error
533
- * shortly after, from the normal expression grammar).
534
- */
535
- parseUserFunctionDefOrCall(nameToken, builder) {
536
- const closeIdx = this.findMatchingRParen(this.current);
537
- if (closeIdx === null) {
538
- builder.emitOpcode(60 /* LOAD_VAR */);
539
- builder.emitString(nameToken.value);
540
- return;
541
- }
542
- const afterClose = this.tokens[closeIdx + 1];
543
- if (afterClose?.type === chunkQFTDTX6K_cjs.TokenTypes.EQUALS) {
544
- this.parseUserFunctionDefinition(nameToken, builder);
545
- } else {
546
- this.parseUserFunctionCall(nameToken, builder);
547
- }
548
- }
549
- /**
550
- * A parameter name, accepted as either `IDENT` or `UNIT`, matches this
551
- * codebase's established `:name = value` variable-name policy
552
- * (`VariableParselet.ts` explicitly accepts `UNIT`-typed tokens too, e.g.
553
- * `:b = 5` for the "b" bits unit) since common short parameter names
554
- * like `h`/`l`/`b`/`t`/`s`/`m` collide with real unit abbreviations
555
- * (hour, liter, bits, ton, second, meter, ...) and lex as `UNIT`, not
556
- * `IDENT`.
557
- */
558
- consumeParamName() {
559
- const token = this.peek();
560
- if (token?.type === chunkQFTDTX6K_cjs.TokenTypes.IDENT || token?.type === chunkQFTDTX6K_cjs.TokenTypes.UNIT) {
561
- this.consume();
562
- return token.value;
563
- }
564
- throw chunkB4HBEFTB_cjs.ErrorFactory.parsing(
565
- "USER_FUNCTION_INVALID_PARAM_NAME",
566
- `Expected a parameter name but got "${token?.type ?? "end of input"}"${token ? ` ("${token.value}")` : ""}`,
567
- { actualType: token?.type }
568
- );
569
- }
570
- parseUserFunctionDefinition(nameToken, builder) {
571
- this.consume(chunkQFTDTX6K_cjs.TokenTypes.LPAREN);
572
- const params = [];
573
- if (this.peek()?.type !== chunkQFTDTX6K_cjs.TokenTypes.RPAREN) {
574
- params.push(this.consumeParamName());
575
- while (this.match(chunkQFTDTX6K_cjs.TokenTypes.COMMA)) {
576
- params.push(this.consumeParamName());
577
- }
578
- }
579
- this.consume(chunkQFTDTX6K_cjs.TokenTypes.RPAREN);
580
- this.consume(chunkQFTDTX6K_cjs.TokenTypes.EQUALS);
581
- if (params.length === 0) {
582
- throw chunkB4HBEFTB_cjs.ErrorFactory.parsing(
583
- "USER_FUNCTION_NO_PARAMS",
584
- `"${nameToken.value}()" has no parameters -- user-defined functions need at least one (a zero-argument definition is indistinguishable from a plain function CALL with no args, which this grammar doesn't otherwise support)`,
585
- { name: nameToken.value }
586
- );
587
- }
588
- const bodyBuilder = new chunkJ45BCEZ4_cjs.BytecodeBuilder();
589
- this.parseExpression(chunkJ45BCEZ4_cjs.BindingPower.Lowest, bodyBuilder);
590
- this.setBuilder(builder);
591
- const bodyProgram = bodyBuilder.build();
592
- if (bodyProgram.hasAsync) {
593
- throw chunkB4HBEFTB_cjs.ErrorFactory.parsing(
594
- "FUNCTION_BODY_MUST_BE_SYNCHRONOUS",
595
- `"${nameToken.value}(...)"'s body calls an async operation (weather, stocks, currency, ...) \u2014 user-defined function bodies must be synchronous`,
596
- { name: nameToken.value }
597
- );
598
- }
599
- const bodyIdx = builder.emitUserFunctionBody(nameToken.value, params, bodyProgram);
600
- builder.emitOpcode(150 /* DEFINE_USER_FUNCTION */);
601
- builder.emitIndex(bodyIdx);
602
- builder.emitOpcode(13 /* PUSH_STRING */);
603
- builder.emitString(`${nameToken.value}(${params.join(", ")}) defined`);
604
- }
605
- parseUserFunctionCall(nameToken, builder) {
606
- this.consume(chunkQFTDTX6K_cjs.TokenTypes.LPAREN);
607
- let argCount = 0;
608
- if (this.peek()?.type !== chunkQFTDTX6K_cjs.TokenTypes.RPAREN) {
609
- this.parseExpression(chunkJ45BCEZ4_cjs.BindingPower.Lowest, builder);
610
- argCount++;
611
- while (this.match(chunkQFTDTX6K_cjs.TokenTypes.COMMA)) {
612
- this.parseExpression(chunkJ45BCEZ4_cjs.BindingPower.Lowest, builder);
613
- argCount++;
614
- }
615
- }
616
- this.consume(chunkQFTDTX6K_cjs.TokenTypes.RPAREN);
617
- builder.emitOpcode(151 /* CALL_USER_FUNCTION */);
618
- builder.emitString(nameToken.value);
619
- builder.emitByte(argCount);
620
- }
621
- // ═══════════════════════════════════════════════════════════════════════════════
622
- // Token stream navigation (identical API to Parser)
623
- // ═══════════════════════════════════════════════════════════════════════════════
624
- consume(expectedType) {
625
- const token = this.tokens[this.current];
626
- if (!token) {
627
- throw chunkB4HBEFTB_cjs.ErrorFactory.parsing(
628
- "UNEXPECTED_END_OF_INPUT",
629
- "Unexpected end of input"
630
- );
631
- }
632
- if (expectedType !== void 0) {
633
- const expectedId = chunkQFTDTX6K_cjs.tokenTypeId(expectedType);
634
- if (token.typeId !== expectedId) {
635
- throw chunkB4HBEFTB_cjs.ErrorFactory.parsing(
636
- "UNEXPECTED_TOKEN_TYPE",
637
- `Expected token type "${expectedType}" but got "${token.type}" ("${token.value}")`,
638
- { expectedType, actualType: token.type, actualValue: token.value }
639
- );
640
- }
641
- }
642
- this.current++;
643
- return token;
644
- }
645
- match(expectedType) {
646
- const token = this.peek();
647
- if (token && token.typeId === chunkQFTDTX6K_cjs.tokenTypeId(expectedType)) {
648
- this.advance();
649
- return true;
650
- }
651
- return false;
652
- }
653
- peek() {
654
- return this.tokens[this.current];
655
- }
656
- /**
657
- * Read-only lookahead `offset` tokens past the current position, without
658
- * consuming anything, `peekAt(0)` is equivalent to {@link peek}.
659
- * `this.tokens` is a plain in-memory array (not a stream), so this is a
660
- * simple, safe index read; no rewind/checkpoint mechanism is needed since
661
- * nothing is consumed.
662
- */
663
- peekAt(offset) {
664
- return this.tokens[this.current + offset];
665
- }
666
- previous() {
667
- return this.current > 0 ? this.tokens[this.current - 1] : void 0;
668
- }
669
- advance() {
670
- this.current++;
671
- }
672
- // ═══════════════════════════════════════════════════════════════════════════════
673
- // Builder access, set before parse, read by inline prefix handlers
674
- // ═══════════════════════════════════════════════════════════════════════════════
675
- /** Set the builder to use for the current parse. Called by ExpressionEngine. */
676
- setBuilder(builder) {
677
- this.builder = builder;
678
- }
679
- // ═══════════════════════════════════════════════════════════════════════════════
680
- // Diagnostics
681
- // ═══════════════════════════════════════════════════════════════════════════════
682
- fireParseletMatched(parselet, token, isPrefix, bindingPower) {
683
- const pipeline = this.diagnosticPipeline;
684
- const event = {
685
- type: chunkXA4CKRML_cjs.DiagnosticEventType.ParseletMatched,
686
- elapsedNs: 0,
687
- expression: this.currentExpression,
688
- tokenType: token.type,
689
- tokenValue: token.value,
690
- parseletCategory: parselet.category,
691
- parseletType: parselet.constructor?.name ?? "unknown",
692
- isPrefix,
693
- bindingPower,
694
- tokenOffset: token.offset || 0
695
- };
696
- pipeline.fireParseletMatched(event);
697
- }
698
- };
699
- /**
700
- * Static binding power table, built once at module load, shared across all instances.
701
- * Index = tokenTypeId, value = binding power (0 = not a built-in infix).
702
- */
703
- _PrecedenceParser.BP_TABLE = chunkJ45BCEZ4_cjs.buildBindingPowerTable();
704
- // ── Pre-computed token type IDs for inline dispatch ────────────────────────
705
- // Prefix built-ins
706
- _PrecedenceParser.NUMBER_ID = chunkQFTDTX6K_cjs.tokenTypeId(chunkQFTDTX6K_cjs.TokenTypes.NUMBER);
707
- _PrecedenceParser.BIGINT_ID = chunkQFTDTX6K_cjs.tokenTypeId(chunkQFTDTX6K_cjs.TokenTypes.BIGINT);
708
- _PrecedenceParser.STRING_ID = chunkQFTDTX6K_cjs.tokenTypeId(chunkQFTDTX6K_cjs.TokenTypes.STRING);
709
- _PrecedenceParser.IDENT_ID = chunkQFTDTX6K_cjs.tokenTypeId(chunkQFTDTX6K_cjs.TokenTypes.IDENT);
710
- _PrecedenceParser.LPAREN_ID = chunkQFTDTX6K_cjs.tokenTypeId(chunkQFTDTX6K_cjs.TokenTypes.LPAREN);
711
- _PrecedenceParser.RPAREN_ID = chunkQFTDTX6K_cjs.tokenTypeId(chunkQFTDTX6K_cjs.TokenTypes.RPAREN);
712
- _PrecedenceParser.MINUS_ID = chunkQFTDTX6K_cjs.tokenTypeId(chunkQFTDTX6K_cjs.TokenTypes.MINUS);
713
- _PrecedenceParser.PLUS_ID = chunkQFTDTX6K_cjs.tokenTypeId(chunkQFTDTX6K_cjs.TokenTypes.PLUS);
714
- _PrecedenceParser.KEYWORD_ID = chunkQFTDTX6K_cjs.tokenTypeId(chunkQFTDTX6K_cjs.TokenTypes.KEYWORD);
715
- // Infix built-ins (Tier 1, full inline emission)
716
- _PrecedenceParser.STAR_ID = chunkQFTDTX6K_cjs.tokenTypeId(chunkQFTDTX6K_cjs.TokenTypes.STAR);
717
- _PrecedenceParser.SLASH_ID = chunkQFTDTX6K_cjs.tokenTypeId(chunkQFTDTX6K_cjs.TokenTypes.SLASH);
718
- _PrecedenceParser.MOD_ID = chunkQFTDTX6K_cjs.tokenTypeId(chunkQFTDTX6K_cjs.TokenTypes.MOD);
719
- _PrecedenceParser.CARET_ID = chunkQFTDTX6K_cjs.tokenTypeId(chunkQFTDTX6K_cjs.TokenTypes.CARET);
720
- _PrecedenceParser.LSHIFT_ID = chunkQFTDTX6K_cjs.tokenTypeId(chunkQFTDTX6K_cjs.TokenTypes.LSHIFT);
721
- _PrecedenceParser.RSHIFT_ID = chunkQFTDTX6K_cjs.tokenTypeId(chunkQFTDTX6K_cjs.TokenTypes.RSHIFT);
722
- _PrecedenceParser.URSHIFT_ID = chunkQFTDTX6K_cjs.tokenTypeId(chunkQFTDTX6K_cjs.TokenTypes.URSHIFT);
723
- _PrecedenceParser.BIT_AND_ID = chunkQFTDTX6K_cjs.tokenTypeId(chunkQFTDTX6K_cjs.TokenTypes.BIT_AND);
724
- _PrecedenceParser.BIT_OR_ID = chunkQFTDTX6K_cjs.tokenTypeId(chunkQFTDTX6K_cjs.TokenTypes.BIT_OR);
725
- _PrecedenceParser.BIT_XOR_ID = chunkQFTDTX6K_cjs.tokenTypeId(chunkQFTDTX6K_cjs.TokenTypes.BIT_XOR);
726
- _PrecedenceParser.PERCENT_ID = chunkQFTDTX6K_cjs.tokenTypeId(chunkQFTDTX6K_cjs.TokenTypes.PERCENT);
727
- _PrecedenceParser.OF_ID = chunkQFTDTX6K_cjs.tokenTypeId(chunkQFTDTX6K_cjs.TokenTypes.OF);
728
- /**
729
- * Inline opcode map for Tier 1 infix operators.
730
- * tokenTypeId → OpCode. PERCENT and CARET are handled specially (not in this map).
731
- */
732
- _PrecedenceParser.INFIX_OPCODE = {
733
- [chunkQFTDTX6K_cjs.tokenTypeId(chunkQFTDTX6K_cjs.TokenTypes.PLUS)]: 20 /* ADD */,
734
- [chunkQFTDTX6K_cjs.tokenTypeId(chunkQFTDTX6K_cjs.TokenTypes.MINUS)]: 21 /* SUB */,
735
- [chunkQFTDTX6K_cjs.tokenTypeId(chunkQFTDTX6K_cjs.TokenTypes.STAR)]: 22 /* MUL */,
736
- [chunkQFTDTX6K_cjs.tokenTypeId(chunkQFTDTX6K_cjs.TokenTypes.SLASH)]: 23 /* DIV */,
737
- [chunkQFTDTX6K_cjs.tokenTypeId(chunkQFTDTX6K_cjs.TokenTypes.MOD)]: 24 /* MOD */,
738
- [chunkQFTDTX6K_cjs.tokenTypeId(chunkQFTDTX6K_cjs.TokenTypes.CARET)]: 25 /* EXP */,
739
- [chunkQFTDTX6K_cjs.tokenTypeId(chunkQFTDTX6K_cjs.TokenTypes.LSHIFT)]: 30 /* LSHIFT */,
740
- [chunkQFTDTX6K_cjs.tokenTypeId(chunkQFTDTX6K_cjs.TokenTypes.RSHIFT)]: 31 /* RSHIFT */,
741
- [chunkQFTDTX6K_cjs.tokenTypeId(chunkQFTDTX6K_cjs.TokenTypes.URSHIFT)]: 32 /* URSHIFT */,
742
- [chunkQFTDTX6K_cjs.tokenTypeId(chunkQFTDTX6K_cjs.TokenTypes.BIT_AND)]: 33 /* BIT_AND */,
743
- [chunkQFTDTX6K_cjs.tokenTypeId(chunkQFTDTX6K_cjs.TokenTypes.BIT_OR)]: 34 /* BIT_OR */,
744
- [chunkQFTDTX6K_cjs.tokenTypeId(chunkQFTDTX6K_cjs.TokenTypes.BIT_XOR)]: 35 /* BIT_XOR */,
745
- [chunkQFTDTX6K_cjs.tokenTypeId(chunkQFTDTX6K_cjs.TokenTypes.OF)]: 22 /* MUL */
746
- };
747
- // ═══════════════════════════════════════════════════════════════════════════════
748
- // The "Tier-1 shape-exception" pattern
749
- // ═══════════════════════════════════════════════════════════════════════════════
750
- //
751
- // Tier 1 exists purely for performance, avoid a Map lookup + parselet call
752
- // on ~95% of tokens (see this file's own module doc comment above). A
753
- // recurring consequence: any grammar shape tied to a Tier-1 token type can
754
- // ONLY be implemented by hand-editing this switch, since a package-
755
- // registered ParseletRegistry parselet for that same token type would
756
- // simply never run in production (Tier 1 always wins over the registry
757
- // fallback). Five confirmed instances of this tension exist in this file
758
- // (plus one that had to move OUTSIDE it entirely):
759
- // 1. NUMBER_ID, the full locale-aware number-literal parsing (hex/
760
- // binary/octal, chained-dot thousands grouping, decimal-separator
761
- // normalization) is inlined in parsePrefix() above; NumberParselet.ts's
762
- // own copy is dead code for real evaluation, kept registered only for
763
- // the "matched parselets" diagnostic view.
764
- // 2. IDENT_ID, parseUserFunctionDefOrCall's lookahead (below) disambig-
765
- // uates a function DEFINITION from a CALL from a plain variable load.
766
- // 3. LPAREN_ID, the bare-tuple vector-literal sugar ("(x,y[,z[,w]])" ->
767
- // MAT_NEW) is inlined in parsePrefix() above; GroupParselet.ts mirrors
768
- // it for introspection only and must be kept in sync by hand.
769
- // 4. CARET_ID, the transpose/inverse suffix table just below.
770
- // 5. PLUS_ID, the locale word "and" lexes as PLUS (Tier-1, fixed Sum
771
- // binding power), so a registry parselet can never intercept it the
772
- // way LogicalParselet.ts intercepts "or"/&&/||; unlike the other four,
773
- // there's no SHAPE to special-case on here (the token itself IS the
774
- // operator), so the workaround lives entirely outside this file, as a
775
- // runtime Boolean/Boolean type-check inside vm/VM.ts's OpCode.ADD
776
- // handler instead.
777
- //
778
- // Deliberate non-goal: none of this is exposed as an IEnginePackage
779
- // extension point (unlike prefixParselets/infixParselets). Letting
780
- // third-party packages register their own Tier-1 shape-matchers would put
781
- // per-package matcher iteration on a genuinely hot path (every CARET/
782
- // NUMBER/IDENT/LPAREN/PLUS token, matched or not), a materially bigger
783
- // separate product decision than "make this one table more concise," and
784
- // not one this pattern write-up makes.
785
- /**
786
- * A single `^`-suffix shape: `matches` peeks ahead (consuming nothing) to
787
- * check whether this shape starts at the current position; `emit` is only
788
- * called immediately after `matches` returned true for that SAME position,
789
- * and is responsible for consuming that shape's own trailing tokens and
790
- * emitting its bytecode.
791
- */
792
- _PrecedenceParser.CARET_SUFFIX_RULES = [
793
- {
794
- name: "transpose (^T)",
795
- matches: (p) => {
796
- const next = p.peek();
797
- return next?.type === chunkQFTDTX6K_cjs.TokenTypes.IDENT && next.value === "T";
798
- },
799
- emit: (p, builder) => {
800
- p.advance();
801
- builder.emitOpcode(51 /* CALL_BUILTIN */);
802
- builder.emitIndex(63);
803
- builder.emitIndex(1);
804
- }
805
- },
806
- {
807
- name: "inverse (^-1)",
808
- matches: (p) => {
809
- const next = p.peek();
810
- if (next?.typeId !== _PrecedenceParser.MINUS_ID) return false;
811
- const afterMinus = p.peekAt(1);
812
- return afterMinus?.type === chunkQFTDTX6K_cjs.TokenTypes.NUMBER && afterMinus.value === "1";
813
- },
814
- emit: (p, builder) => {
815
- p.advance();
816
- p.advance();
817
- builder.emitOpcode(51 /* CALL_BUILTIN */);
818
- builder.emitIndex(65);
819
- builder.emitIndex(1);
820
- }
821
- }
822
- ];
823
- var PrecedenceParser = _PrecedenceParser;
824
-
825
- exports.ParseletRegistry = ParseletRegistry;
826
- exports.PrecedenceParser = PrecedenceParser;
827
- exports.sharedParseletRegistry = sharedParseletRegistry;
828
- //# sourceMappingURL=chunk-HVRVSI2Z.cjs.map
829
- //# sourceMappingURL=chunk-HVRVSI2Z.cjs.map