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 +1 @@
1
- {"version":3,"sources":["../src/language/LanguageService.ts","../src/language/tokenClassName.ts","../src/language/adapters/codemirror.ts"],"names":[],"mappings":";;;;;;;;AAkCA,IAAM,eAAA,GAAkB,EAAA;AAGxB,IAAM,aAAA,GAAwD;AAAA,EAC7D,QAAA,EAAU,CAAA;AAAA,EACV,QAAA,EAAU,CAAA;AAAA,EACV,OAAA,EAAS,CAAA;AAAA,EACT,QAAA,EAAU,CAAA;AAAA,EACV,UAAA,EAAY,CAAA;AAAA,EACZ,OAAA,EAAS,CAAA;AAAA,EACT,QAAA,EAAU,CAAA;AAAA,EACV,MAAA,EAAQ,CAAA;AAAA,EACR,IAAA,EAAM;AACP,CAAA;AAGA,IAAM,gBAAA,GAAmB,GAAA;AAwGlB,IAAM,kBAAN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AAG,MAAM,CAAA,EAAG,QAAQ,CAAA,CAAA;AAC5B;AAmBO,SAAS,qBAAqB,MAAA,EAAqD;AACzF,EAAA,OAAO,CAAC,QAAA,KAA4B,CAAA,EAAG,MAAM,GAAG,QAAQ,CAAA,CAAA;AACzD;;;ACpCA,IAAM,2BAAA,GAAsE;AAAA,EAC3E,OAAA,EAAS,SAAA;AAAA,EACT,QAAA,EAAU,SAAA;AAAA,EACV,UAAA,EAAY,SAAA;AAAA,EACZ,OAAA,EAAS,SAAA;AAAA,EACT,QAAA,EAAU,UAAA;AAAA,EACV,QAAA,EAAU,UAAA;AAAA,EACV,IAAA,EAAM,MAAA;AAAA,EACN,QAAA,EAAU,SAAA;AAAA,EACV,MAAA,EAAQ;AACT,CAAA;AAUO,SAAS,uBAAuB,IAAA,EAAwE;AAC9G,EAAA,OAAO,EAAE,KAAA,EAAO,IAAA,CAAK,KAAA,EAAO,IAAA,EAAM,2BAAA,CAA4B,IAAA,CAAK,QAAQ,CAAA,IAAK,MAAA,EAAQ,MAAA,EAAQ,IAAA,CAAK,MAAA,EAAO;AAC7G","file":"language.js","sourcesContent":["import type { ExpressionEngine } from \"@solve-js/engine/ExpressionEngine\";\nimport type { TokenCategory } from \"@solve-js/language/TokenCategory\";\nimport { getTokenCategory } from \"@solve-js/language/TokenCategoryMap\";\nimport type { Token } from \"@solve-js/lexer/Token\";\nimport { knownUnits } from \"@solve-js/lexer/units\";\nimport { getMeasure } from \"@solve-js/uom/UomConverter\";\n\n/** A single classified span within a line, the entire output contract of the language service. */\nexport interface SemanticToken {\n\tfrom: number;\n\tto: number;\n\tcategory: TokenCategory;\n}\n\n/** A single completion candidate, the entire output contract of `getCompletions()`. */\nexport interface CompletionItem {\n\tlabel: string;\n\t/** Reuses the highlighting taxonomy, one adapter can serve both features. */\n\tcategory: TokenCategory;\n\t/** e.g. a unit's measure (\"length\"), or the category name for keywords/functions. */\n\tdetail?: string;\n}\n\n/**\n * A completion candidate with its lowercased label precomputed.\n *\n * Internal to the prefix index; callers only ever see the {@link CompletionItem}.\n */\ninterface IndexedCompletionCandidate {\n\titem: CompletionItem;\n\tlowerLabel: string;\n}\n\n/** Completion results are capped, a document-wide candidate pool has no reason to return more than this. */\nconst MAX_COMPLETIONS = 50;\n\n/** Tier ordering for completion results: user-authored variables first, then grammar, then units. */\nconst CATEGORY_TIER: Partial<Record<TokenCategory, number>> = {\n\tvariable: 0,\n\tfunction: 1,\n\tkeyword: 1,\n\toperator: 1,\n\tcomparison: 1,\n\tbitwise: 1,\n\tdatetime: 1,\n\tvector: 1,\n\tunit: 2,\n};\n\n/** Bounded cache size. See the eviction-policy note on `LanguageService.cache`. */\nconst MAX_CACHED_LINES = 2000;\n\ninterface CacheEntry {\n\ttext: string;\n\ttokens: SemanticToken[];\n\t// When set, `tokens` is a single bare-identifier token whose validity\n\t// depends on document-wide DAG state (see the bare-word gate in\n\t// getSemanticTokens), not just this line's own text, so it can't be\n\t// cached as a plain pass/fail result the way every other line can. The\n\t// lex+parse work that produced `tokens` is still cached normally; only\n\t// the DAG membership check is re-run on every lookup (cache hit or\n\t// miss alike), since it's cheap (a Set lookup) and the alternative\n\t// caching the gated result, would go stale the moment some OTHER\n\t// line's edit changes what variables exist, with nothing to trigger a\n\t// re-check of this untouched line.\n\tbareWordCandidate?: string;\n}\n\n/** Options for the editor-facing language service: completions and highlighting. */\nexport interface LanguageServiceOptions {\n\t/**\n\t * Overrides how the service discovers \"variable names known in this\n\t * document\", used to legitimize a lone bare identifier line (see\n\t * `getSemanticTokens`'s single-token gate) and variable-name\n\t * completions (`getCompletions`). Defaults to reading\n\t * `engine.getDag().getSnapshot()`, which works for any consumer\n\t * sharing one `ExpressionEngine` between evaluation and the language\n\t * service (the real Obsidian editor).\n\t *\n\t * Required for consumers whose language service is backed by a\n\t * *different*, non-evaluating engine than the one that actually runs\n\t * the document (the playground's dedicated lexing-only engine, whose\n\t * own DAG is always empty), pass a function reading the real\n\t * evaluation engine's DAG snapshot instead.\n\t */\n\tvariableNameSource?: () => Iterable<string>;\n\n\t/**\n\t * Run the normalizer on the highlighting path, so phrase-fused tokens are\n\t * classified as the thing the parser will actually see.\n\t *\n\t * Off by default, and the default is a judgement rather than an oversight.\n\t * Highlighting runs per keystroke, normalization is real work, and a host\n\t * that is happy with lexer-level categories should not start paying for\n\t * fusion because a new version shipped. Turn it on and `12/09/2026` is one\n\t * `datetime` span instead of five number and operator spans; leave it off\n\t * and nothing about this class changes.\n\t *\n\t * See `benchmarks/languageServiceBenchmarks.spec.ts` for what it costs.\n\t */\n\tnormalizeForHighlighting?: boolean;\n}\n\n/**\n * Editor-agnostic \"language server\" for solve expressions: turns a line of\n * text into semantic token ranges, using the exact same lexer real\n * evaluation uses (so it only ever classifies what the engine's grammar\n * actually recognizes, never a separate/duplicated tokenizer). No\n * knowledge of CSS, CodeMirror, VS Code, or any other rendering concept\n * lives here. See `language/adapters/` for that.\n *\n * Classification happens at the LEXER stage, before the normalizer runs\n * (normalization, phrase fusion, implicit multiply, and package-specific\n * rules, happens later, only on the real evaluation path). A package's\n * lexer-level custom token types (e.g. a custom keyword) are recognized\n * here exactly as evaluation would see them. A package's *normalizer*-fused\n * synthetic tokens (e.g. OSRS's GAME_ITEM, built by fusing several\n * consecutive IDENT tokens against an item-name trie) are NOT. This\n * service still shows the pre-fusion IDENT tokens individually for those.\n * `IEnginePackage.tokenCategories` entries for normalizer-only token types\n * are still valid, correct registrations (queryable via getTokenCategory)\n *, they just won't currently be reachable through this lexer-only\n * classification path. Folding normalization in would require running it\n * per keystroke on the highlighting path too, which needs its own careful\n * design (span recomputation for fused multi-token ranges, in particular)\n * rather than a quick addition here.\n *\n * Lexing alone is NOT sufficient to decide \"recognized\", though: a run of\n * plain-English words (\"My name is ron\") lexes into a sequence of\n * individually-valid IDENT tokens with no grammar tying them together\n * every word \"recognized\" at the token level, but the line as a whole is\n * not something the engine would ever accept as an expression. Surfacing\n * per-token colors for that case looks like the editor mistook prose for\n * code. So a line's tokens are only surfaced once the line as a whole\n * parses successfully (via `ExpressionEngine.compileExpression`, the same\n * parse pipeline, and the same bytecode cache, real evaluation uses; no\n * separate/duplicated grammar check). A single bare word (\"hello\", a valid\n * variable reference) or a keyword-only line (\"pi\") still parses and still\n * highlights, only genuinely ungrammatical text is suppressed, unless it's\n * a known variable elsewhere in the document (see `variableNameSource`).\n *\n * `getCompletions()` is the other half of this \"language server\": unlike\n * `getSemanticTokens()`, it's explicitly for *incomplete*, mid-typing text\n *, it deliberately does NOT gate on parse validity (a half-typed\n * expression almost never parses), using simple prefix matching instead.\n *\n * Must be constructed with an already-configured `ExpressionEngine` (one\n * with all currently-relevant packages registered) rather than a bare\n * lexer, reusing an existing engine is both the fast path (no throwaway\n * lexer construction) and the *correct* one: a highlighting-only lexer\n * built independently of the evaluation engine would silently fail to\n * recognize plugin-contributed tokens (e.g. a package's custom keywords)\n * unless it happened to have the identical packages registered.\n */\nexport class LanguageService {\n\tprivate engine: ExpressionEngine | null;\n\tprivate variableNameSource: () => Iterable<string>;\n\tprivate readonly normalizeForHighlighting: boolean;\n\n\t// Bounded cache keyed by line number ALONE, not `${lineNumber}:${lineText}`\n\t// as an earlier version of this class did. A line's previous text state is\n\t// never useful once it changes, so keying on text too was pure waste:\n\t// every keystroke on a line minted a brand-new, never-reclaimed cache\n\t// entry (an effective per-keystroke memory leak over a long editing\n\t// session). Keying on line number alone makes \"same line, new text\" a\n\t// cheap overwrite instead.\n\t//\n\t// Eviction is oldest-inserted (Map iteration order) when at capacity\n\t// mirroring the same bounded-cache pattern ExpressionEngine's own\n\t// bytecodeCache already uses elsewhere in this codebase. Deliberately\n\t// NOT an LFU (least-frequently-used) policy: LFU would keep resisting\n\t// eviction of old, once-popular lines while punishing a line that just\n\t// scrolled into view (frequency 1), the opposite of what a \"currently\n\t// visible\" cache should prioritize.\n\tprivate cache = new Map<number, CacheEntry>();\n\n\t// Keyword/unit/package-contributed completion candidates don't depend\n\t// on any particular line, built lazily on first getCompletions() call\n\t// and reused after that, since a package registration is the only thing\n\t// that could ever change this list mid-session (see invalidateCache()).\n\t// Variable-name candidates are NOT part of this, they're read fresh on\n\t// every call from variableNameSource(), since those genuinely change on\n\t// every edit.\n\tprivate staticCompletionCandidates: CompletionItem[] | null = null;\n\n\t// The same candidates, bucketed by their lowercased first character with the\n\t// lowercased label precomputed. getCompletions() runs on every keystroke and\n\t// only ever wants candidates sharing the prefix's first character, so\n\t// scanning the whole list and lowercasing each label per call was doing two\n\t// avoidable things: touching entries that could not possibly match, and\n\t// allocating a string per candidate per keystroke. That was affordable when\n\t// the vocabulary was a few hundred entries. Deriving the unit list from the\n\t// conversion tables took it past a thousand, and the warm completion\n\t// benchmarks regressed roughly 2.9x until this was added.\n\tprivate staticCompletionIndex: Map<string, IndexedCompletionCandidate[]> | null = null;\n\n\tconstructor(engine?: ExpressionEngine | null, options?: LanguageServiceOptions) {\n\t\tthis.engine = engine ?? null;\n\t\tthis.variableNameSource = options?.variableNameSource ?? (() => this.defaultVariableNames());\n\t\tthis.normalizeForHighlighting = options?.normalizeForHighlighting ?? false;\n\t}\n\n\tprivate defaultVariableNames(): Iterable<string> {\n\t\tif (!this.engine) return [];\n\t\tconst snapshot = this.engine.getDag().getSnapshot();\n\t\tconst names = new Set<string>(Object.keys(snapshot.consumers));\n\t\tfor (const written of Object.values(snapshot.writes)) {\n\t\t\tfor (const name of written) names.add(name);\n\t\t}\n\t\treturn names;\n\t}\n\n\t/**\n\t * Lex a line, normalize it, and place every resulting token back in the\n\t * source text.\n\t *\n\t * ## Why placing them back is the hard part\n\t *\n\t * Normalization produces three kinds of token and only one of them can be\n\t * highlighted the obvious way.\n\t *\n\t * A token the normalizer left alone still describes its own text, so its\n\t * span is `offset` to `offset + text.length`, exactly as before.\n\t *\n\t * A FUSED token does not. `10 frames` becomes a FRAME_COUNT whose value is\n\t * `10`, and a timecode becomes a token whose value is a comma-separated\n\t * tuple appearing nowhere on the line. Those carry `sourceEnd`, set by\n\t * `createFusedToken`, which is the only place that knows where the fusion\n\t * ended.\n\t *\n\t * An INSERTED token has no text at all. Implicit multiplication puts a STAR\n\t * at the following token's offset, so `5(3)` gains a `*` sitting exactly\n\t * where the `(` is. Painting it would colour a character the reader never\n\t * typed as an operator, and would overlap the token that really is there.\n\t * These are dropped, detected by the one test that needs no cooperation\n\t * from any rule: a token with no recorded fusion span must match the text\n\t * at its own offset, and an inserted one does not.\n\t *\n\t * @param lineText - The raw line.\n\t * @returns Spans in the same shape `Lexer.getHighlightTokens` returns.\n\t */\n\tprivate classifyNormalized(\n\t\tlineText: string,\n\t): { type: string; value: string; offset: number; col: number; length: number; category: TokenCategory | undefined }[] {\n\t\tconst lexer = this.engine!.getLexer();\n\t\tconst raw = lexer.getHighlightTokenObjects(lineText);\n\t\tif (raw.length === 0) return [];\n\n\t\t// Offsets from a blockquote line are relative to the stripped text, so\n\t\t// the text this checks against has to be stripped the same way.\n\t\tconst source =\n\t\t\tlineText.startsWith(\"> \") && lexer.classifyLine(lineText).skip ? lineText.slice(2) : lineText;\n\n\t\tlet normalized: Token[];\n\t\ttry {\n\t\t\tnormalized = this.engine!.getNormalizer().normalize(raw);\n\t\t} catch {\n\t\t\t// Normalization is an enhancement here, not a requirement. A rule\n\t\t\t// that throws on a half-typed line should cost the reader phrase\n\t\t\t// colouring, not all colouring.\n\t\t\tnormalized = raw;\n\t\t}\n\n\t\tconst out: {\n\t\t\ttype: string;\n\t\t\tvalue: string;\n\t\t\toffset: number;\n\t\t\tcol: number;\n\t\t\tlength: number;\n\t\t\tcategory: TokenCategory | undefined;\n\t\t}[] = [];\n\n\t\tfor (const token of normalized) {\n\t\t\tlet end: number;\n\t\t\tif (token.sourceEnd !== undefined) {\n\t\t\t\tend = token.sourceEnd;\n\t\t\t} else if (source.startsWith(token.text, token.offset)) {\n\t\t\t\t// `text`, not `value`. They are the same string for almost every\n\t\t\t\t// token, and differ for a string literal, whose value is the\n\t\t\t\t// payload while its text is the quoted source slice. Matching on\n\t\t\t\t// value dropped every string literal from the painted line,\n\t\t\t\t// since `gbp` does not appear at the offset where `\"gbp\"` does.\n\t\t\t\tend = token.offset + token.text.length;\n\t\t\t} else {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tout.push({\n\t\t\t\ttype: token.type,\n\t\t\t\tvalue: token.value,\n\t\t\t\toffset: token.offset,\n\t\t\t\tcol: token.col,\n\t\t\t\tlength: end - token.offset,\n\t\t\t\tcategory: getTokenCategory(token.type),\n\t\t\t});\n\t\t}\n\n\t\treturn out;\n\t}\n\n\t/**\n\t * Classify every recognized token on one line.\n\t *\n\t * @param lineText - The raw line text (may be a markdown-structural line\n\t * the engine's classifier skips, that's handled by the underlying\n\t * lexer, which returns no tokens for those).\n\t * @param lineNumber - 1-based line number, used purely as a cache key.\n\t */\n\tgetSemanticTokens(lineText: string, lineNumber: number): SemanticToken[] {\n\t\tconst cached = this.cache.get(lineNumber);\n\t\tif (cached && cached.text === lineText) {\n\t\t\tif (cached.bareWordCandidate !== undefined) {\n\t\t\t\treturn this.isKnownVariable(cached.bareWordCandidate) ? cached.tokens : [];\n\t\t\t}\n\t\t\treturn cached.tokens;\n\t\t}\n\n\t\tif (!this.engine) {\n\t\t\t// No engine available (e.g. a consumer that hasn't wired one up yet)\n\t\t\t//, no highlighting, not an error.\n\t\t\treturn [];\n\t\t}\n\n\t\tconst lexer = this.engine.getLexer();\n\t\tconst lexed = this.normalizeForHighlighting\n\t\t\t? this.classifyNormalized(lineText)\n\t\t\t: lexer.getHighlightTokens(lineText);\n\t\tif (lexed.length === 0) {\n\t\t\tthis.putCache(lineNumber, lineText, []);\n\t\t\treturn [];\n\t\t}\n\n\t\tconst classification = lexer.classifyLine(lineText);\n\t\tconst tokens: SemanticToken[] = [];\n\n\t\tif (classification.hasInlineSolve) {\n\t\t\t// A line can mix markdown prose with one or more embedded\n\t\t\t// `s`...`` expressions. Only the text actually inside a\n\t\t\t// well-formed marker is a recognized expression, surrounding\n\t\t\t// prose lexes into individually-valid tokens too (see the class\n\t\t\t// doc comment) but is never something the engine would parse,\n\t\t\t// so it's excluded token-by-token via span membership rather\n\t\t\t// than gating the whole line pass/fail.\n\t\t\tconst validSpans = lexer\n\t\t\t\t.findInlineSolves(lineText)\n\t\t\t\t.filter(span => this.parsesAsExpression(span.expression))\n\t\t\t\t.map(span => ({ from: span.start, to: span.end }));\n\t\t\tfor (const token of lexed) {\n\t\t\t\tif (!token.category) continue;\n\t\t\t\tconst from = token.offset;\n\t\t\t\tconst to = token.offset + token.length;\n\t\t\t\tif (!validSpans.some(s => from >= s.from && to <= s.to)) continue;\n\t\t\t\ttokens.push({ from, to, category: token.category });\n\t\t\t}\n\t\t} else {\n\t\t\t// Blockquote content is stripped of its \"> \" prefix before being\n\t\t\t// tokenized (see Lexer.getHighlightTokens), token offsets are\n\t\t\t// already relative to the stripped text, so the parse check must\n\t\t\t// run against that same substring to match.\n\t\t\tconst text = lineText.startsWith(\"> \") && classification.skip\n\t\t\t\t? lineText.slice(2)\n\t\t\t\t: lineText;\n\t\t\tif (this.parsesAsExpression(text)) {\n\t\t\t\tfor (const token of lexed) {\n\t\t\t\t\tif (!token.category) continue;\n\t\t\t\t\ttokens.push({ from: token.offset, to: token.offset + token.length, category: token.category });\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// A lone bare word (\"hello\") is exactly as ambiguous as a run of\n\t\t// prose (\"My name is dave\"), it happens to parse as a\n\t\t// single-identifier variable-reference expression, but that's true\n\t\t// of literally any English word, so on its own it isn't \"recognized\"\n\t\t// in any meaningful sense. Sigil-marked variables (\":x\", \"$x\") are\n\t\t// unaffected, those lex to TWO tokens (sigil + ident), never\n\t\t// hitting this single-token check. Keywords (\"pi\") are unaffected\n\t\t// too, their category is \"keyword\", not \"variable\". Only surface\n\t\t// it once it's an actual known variable elsewhere in the document\n\t\t// checked live (see the `bareWordCandidate` cache field), not baked\n\t\t// into the cached result, since another line's edit can make this\n\t\t// check flip without this line's own text ever changing.\n\t\tif (tokens.length === 1 && tokens[0].category === \"variable\") {\n\t\t\tconst name = lineText.slice(tokens[0].from, tokens[0].to);\n\t\t\tthis.putCache(lineNumber, lineText, tokens, name);\n\t\t\treturn this.isKnownVariable(name) ? tokens : [];\n\t\t}\n\n\t\tthis.putCache(lineNumber, lineText, tokens);\n\t\treturn tokens;\n\t}\n\n\t/**\n\t * Completion candidates for the identifier prefix immediately before\n\t * `cursorOffset` on `lineText`. Deliberately simple prefix matching, not\n\t * parser-driven \"what's grammatically valid here\" prediction, a\n\t * half-typed expression almost never parses, so gating on parse\n\t * validity (the way `getSemanticTokens` does) would suppress\n\t * completions almost always. This is the safest, fastest option that\n\t * still delivers real value.\n\t *\n\t * Candidates come from three sources: keywords (which already include\n\t * function names. See `ExpressionLexer.getKeywords()`'s doc comment)\n\t * and units, both static per engine configuration and cached lazily;\n\t * package-contributed items (`IEnginePackage.completionItems`), same\n\t * cache; and variable names, read fresh from `variableNameSource()` on\n\t * every call since those change on every edit.\n\t */\n\tgetCompletions(lineText: string, cursorOffset: number): CompletionItem[] {\n\t\tconst prefixMatch = /[A-Za-z0-9_]+$/.exec(lineText.slice(0, cursorOffset));\n\t\tif (!prefixMatch) return [];\n\t\tconst prefix = prefixMatch[0].toLowerCase();\n\n\t\tif (!this.engine) return [];\n\n\t\tconst matches: CompletionItem[] = [];\n\n\t\t// Variables are read fresh every call and there are few of them, so they\n\t\t// stay a linear scan.\n\t\tfor (const name of this.variableNameSource()) {\n\t\t\tif (name.toLowerCase().startsWith(prefix)) {\n\t\t\t\tmatches.push({ label: name, category: \"variable\" });\n\t\t\t}\n\t\t}\n\n\t\t// Static candidates only ever match if they share the prefix's first\n\t\t// character, so consult that bucket alone.\n\t\tconst bucket = this.getStaticCompletionIndex().get(prefix[0]);\n\t\tif (bucket) {\n\t\t\tfor (const candidate of bucket) {\n\t\t\t\tif (candidate.lowerLabel.startsWith(prefix)) matches.push(candidate.item);\n\t\t\t}\n\t\t}\n\n\t\tmatches.sort((a, b) => {\n\t\t\tconst tierDiff = (CATEGORY_TIER[a.category] ?? 3) - (CATEGORY_TIER[b.category] ?? 3);\n\t\t\tif (tierDiff !== 0) return tierDiff;\n\t\t\treturn a.label.localeCompare(b.label);\n\t\t});\n\n\t\treturn matches.slice(0, MAX_COMPLETIONS);\n\t}\n\n\t/** Lazily builds and caches the keyword/unit/package-item candidate list. See `staticCompletionCandidates`. */\n\tprivate getStaticCompletionCandidates(): CompletionItem[] {\n\t\tif (this.staticCompletionCandidates) return this.staticCompletionCandidates;\n\n\t\tconst items: CompletionItem[] = [];\n\t\tfor (const [word, tokenType] of Object.entries(this.engine!.getLexer().getKeywords())) {\n\t\t\tconst category = getTokenCategory(tokenType);\n\t\t\tif (!category) continue;\n\t\t\titems.push({ label: word, category });\n\t\t}\n\t\tfor (const unit of knownUnits) {\n\t\t\titems.push({ label: unit, category: \"unit\", detail: getMeasure(unit) });\n\t\t}\n\t\titems.push(...this.engine!.getPackageCompletionItems());\n\n\t\tthis.staticCompletionCandidates = items;\n\t\treturn items;\n\t}\n\n\t/**\n\t * The static candidates bucketed by lowercased first character, built once\n\t * from {@link getStaticCompletionCandidates} and invalidated alongside it.\n\t */\n\tprivate getStaticCompletionIndex(): Map<string, IndexedCompletionCandidate[]> {\n\t\tif (this.staticCompletionIndex) return this.staticCompletionIndex;\n\n\t\tconst index = new Map<string, IndexedCompletionCandidate[]>();\n\t\tfor (const item of this.getStaticCompletionCandidates()) {\n\t\t\tconst lowerLabel = item.label.toLowerCase();\n\t\t\tconst firstCharacter = lowerLabel[0];\n\t\t\t// A label cannot match any prefix if it is empty, and the prefix\n\t\t\t// regex guarantees at least one character on the query side.\n\t\t\tif (firstCharacter === undefined) continue;\n\t\t\tlet bucket = index.get(firstCharacter);\n\t\t\tif (bucket === undefined) {\n\t\t\t\tbucket = [];\n\t\t\t\tindex.set(firstCharacter, bucket);\n\t\t\t}\n\t\t\tbucket.push({ item, lowerLabel });\n\t\t}\n\n\t\tthis.staticCompletionIndex = index;\n\t\treturn index;\n\t}\n\n\tprivate isKnownVariable(name: string): boolean {\n\t\tfor (const known of this.variableNameSource()) {\n\t\t\tif (known === name) return true;\n\t\t}\n\t\treturn false;\n\t}\n\n\t/**\n\t * Whether the engine's parser actually accepts a piece of text as a\n\t * well-formed expression, not merely whether it lexes into individually\n\t * recognized token types. See the class doc comment's prose example.\n\t * `tryCompileExpression` is compile-only (lex → normalize → parse →\n\t * cache bytecode, no VM execution, no network/async side effects) and\n\t * reuses the engine's existing bytecode cache, so text that's already\n\t * been evaluated (or previously highlight-checked) is a cache hit here\n\t * too.\n\t *\n\t * Deliberately calls the non-throwing `tryCompileExpression` rather than\n\t * try/catching `compileExpression`. This runs on every visible line on\n\t * every keystroke, and the common case for a real markdown document is\n\t * lines that DON'T parse (prose), not lines that do. Throwing there would\n\t * mean constructing a EngineError (with V8 stack-trace capture) for the\n\t * common case instead of the rare one.\n\t */\n\tprivate parsesAsExpression(text: string): boolean {\n\t\treturn this.engine!.tryCompileExpression(text);\n\t}\n\n\tprivate putCache(lineNumber: number, text: string, tokens: SemanticToken[], bareWordCandidate?: string): void {\n\t\tif (!this.cache.has(lineNumber) && this.cache.size >= MAX_CACHED_LINES) {\n\t\t\tconst oldestKey = this.cache.keys().next().value;\n\t\t\tif (oldestKey !== undefined) this.cache.delete(oldestKey);\n\t\t}\n\t\tthis.cache.set(lineNumber, { text, tokens, bareWordCandidate });\n\t}\n\n\t/**\n\t * Evict specific lines (e.g. the lines actually touched by a CodeMirror\n\t * change set) instead of the whole cache, the surgical counterpart to\n\t * {@link invalidateCache}, letting a single-line edit stay cheap even in\n\t * a large document: every other cached line is untouched and still hits\n\t * on the next call.\n\t */\n\tinvalidateLines(lineNumbers: Iterable<number>): void {\n\t\tfor (const lineNumber of lineNumbers) {\n\t\t\tthis.cache.delete(lineNumber);\n\t\t}\n\t}\n\n\t/**\n\t * Full cache clear. Reserved for cases with no meaningful \"which lines\n\t * changed\" (e.g. the document was swapped wholesale, or a package was\n\t * registered/unregistered mid-session, changing what categories exist).\n\t * Prefer {@link invalidateLines} for ordinary edits. Also rebuilds the\n\t * lazily-cached keyword/unit/package-item completion candidates on next\n\t * use, the only thing that can change that list mid-session.\n\t */\n\tinvalidateCache(): void {\n\t\tthis.cache.clear();\n\t\tthis.staticCompletionCandidates = null;\n\t\tthis.staticCompletionIndex = null;\n\t}\n}\n","import type { TokenCategory } from \"@solve-js/language/TokenCategory\";\n\n/**\n * Namespace applied to a semantic category when no other one is asked for.\n *\n * A prefix is needed because a bare category name like `number` or `error`\n * would collide with almost any host stylesheet. `solve-` is the narrowest\n * namespace that still says where the class came from, and it deliberately\n * names this library rather than any particular editor.\n */\nexport const DEFAULT_TOKEN_CLASS_PREFIX = \"solve-\";\n\n/**\n * Maps a semantic category to a predictable, stable CSS class name.\n *\n * Deliberately trivial: the category name IS the class-name key\n * (`\"number\"` → `solve-number`), so there is no separate table to keep in\n * sync as categories grow. A brand-new category, including one contributed\n * by a solve-js package at runtime, gets a matching class name with no\n * changes here.\n *\n * This is editor-agnostic on purpose. It produces a class-name string and\n * nothing else, so it works the same whether the host is CodeMirror\n * (`Decoration.mark({ class: tokenClassName(token.category) })`), Slate,\n * ProseMirror, Monaco or a plain `<span>`. Actual colors are pure CSS,\n * resolved from `--solve-hl-{category}` custom properties by each consumer.\n *\n * @param category - Semantic category from `getSemanticTokens()`.\n * @param prefix - Namespace to apply. Defaults to `solve-`.\n * @returns The class name for that category.\n */\nexport function tokenClassName(category: TokenCategory, prefix: string = DEFAULT_TOKEN_CLASS_PREFIX): string {\n\treturn `${prefix}${category}`;\n}\n\n/**\n * Builds a `tokenClassName` bound to a fixed prefix.\n *\n * The prefix is configurable because a host may already own a namespace it\n * wants these classes to sit inside: a CodeMirror theme that keys off `cm-`,\n * a design system that scopes everything under one token, or an app that\n * embeds two editors and wants to style them apart. Passing the prefix once\n * here is cheaper than threading it through every call site.\n *\n * ```ts\n * const className = createTokenClassName(\"cm-solve-\");\n * className(\"number\"); // \"cm-solve-number\"\n * ```\n *\n * @param prefix - Namespace to apply to every category.\n * @returns A function mapping a category to a prefixed class name.\n */\nexport function createTokenClassName(prefix: string): (category: TokenCategory) => string {\n\treturn (category: TokenCategory) => `${prefix}${category}`;\n}\n","import type { TokenCategory } from \"@solve-js/language/TokenCategory\";\nimport type { CompletionItem } from \"@solve-js/language/LanguageService\";\n\n/**\n * Maps a semantic category to one of `@codemirror/autocomplete`'s built-in\n * completion \"type\" strings (which drive its default gutter icon), the one\n * genuinely CodeMirror-specific thing this feature needs. Falls back to\n * \"text\" for anything unmapped, including plugin-contributed categories\n * (e.g. OSRS's \"osrs-item\"), a reasonable neutral default rather than a\n * hard failure for a category this adapter doesn't know about yet.\n *\n * No `@codemirror/autocomplete` import here, the returned object shape is\n * structurally compatible with CM6's `Completion` type by duck typing, so\n * `solve-js` gains no new dependency; the actual `CompletionSource`\n * function (reading `CompletionContext`, building a `CompletionResult`)\n * lives in each consumer (src/app, playground), same tier as\n * `buildDecorations()` already is for highlighting.\n */\nconst CATEGORY_TO_COMPLETION_TYPE: Partial<Record<TokenCategory, string>> = {\n\tkeyword: \"keyword\",\n\toperator: \"keyword\",\n\tcomparison: \"keyword\",\n\tbitwise: \"keyword\",\n\tfunction: \"function\",\n\tvariable: \"variable\",\n\tunit: \"type\",\n\tdatetime: \"keyword\",\n\tvector: \"type\",\n};\n\n/**\n * Convert a completion into CodeMirror's option shape.\n *\n * Kept in an adapter so the language service itself stays editor-agnostic.\n *\n * @param item - Completion produced by the language service.\n * @returns The equivalent CodeMirror option.\n */\nexport function completionItemToOption(item: CompletionItem): { label: string; type: string; detail?: string } {\n\treturn { label: item.label, type: CATEGORY_TO_COMPLETION_TYPE[item.category] ?? \"text\", detail: item.detail };\n}\n"]}
1
+ {"version":3,"sources":["../src/language/LanguageService.ts","../src/language/tokenClassName.ts","../src/language/adapters/codemirror.ts"],"names":["MAX_COMPLETIONS","CATEGORY_TIER","MAX_CACHED_LINES","LanguageService","engine","options","snapshot","names","written","name","lineText","lexer","raw","source","normalized","out","token","end","getTokenCategory","lineNumber","cached","lexed","classification","tokens","validSpans","span","from","to","s","text","cursorOffset","prefixMatch","prefix","matches","bucket","candidate","a","b","tierDiff","items","word","tokenType","category","unit","knownUnits","getMeasure","index","item","lowerLabel","firstCharacter","known","bareWordCandidate","oldestKey","lineNumbers","DEFAULT_TOKEN_CLASS_PREFIX","tokenClassName","createTokenClassName","CATEGORY_TO_COMPLETION_TYPE","completionItemToOption"],"mappings":"sRAkCA,IAAMA,CAAAA,CAAkB,GAGlBC,CAAAA,CAAwD,CAC7D,SAAU,CAAA,CACV,QAAA,CAAU,CAAA,CACV,OAAA,CAAS,CAAA,CACT,QAAA,CAAU,EACV,UAAA,CAAY,CAAA,CACZ,OAAA,CAAS,CAAA,CACT,QAAA,CAAU,CAAA,CACV,OAAQ,CAAA,CACR,IAAA,CAAM,CACP,CAAA,CAGMC,CAAAA,CAAmB,GAAA,CAwGZC,EAAN,KAAsB,CA0C5B,WAAA,CAAYC,CAAAA,CAAkCC,CAAAA,CAAkC,CAtBhF,KAAQ,KAAA,CAAQ,IAAI,GAAA,CASpB,IAAA,CAAQ,0BAAA,CAAsD,IAAA,CAW9D,KAAQ,qBAAA,CAA0E,IAAA,CAGjF,IAAA,CAAK,MAAA,CAASD,CAAAA,EAAU,IAAA,CACxB,KAAK,kBAAA,CAAqBC,CAAAA,EAAS,kBAAA,GAAuB,IAAM,IAAA,CAAK,oBAAA,IACrE,IAAA,CAAK,wBAAA,CAA2BA,GAAS,wBAAA,EAA4B,MACtE,CAEQ,oBAAA,EAAyC,CAChD,GAAI,CAAC,IAAA,CAAK,MAAA,CAAQ,OAAO,EAAC,CAC1B,IAAMC,CAAAA,CAAW,IAAA,CAAK,MAAA,CAAO,QAAO,CAAE,WAAA,EAAY,CAC5CC,CAAAA,CAAQ,IAAI,GAAA,CAAY,OAAO,IAAA,CAAKD,CAAAA,CAAS,SAAS,CAAC,CAAA,CAC7D,IAAA,IAAWE,KAAW,MAAA,CAAO,MAAA,CAAOF,CAAAA,CAAS,MAAM,CAA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b,CAAAA,CAAyBV,CAAAA,CAAiBsB,EAAoC,CAC5G,OAAO,CAAA,EAAGtB,CAAM,CAAA,EAAGU,CAAQ,EAC5B,CAmBO,SAASc,CAAAA,CAAqBxB,CAAAA,CAAqD,CACzF,OAAQU,GAA4B,CAAA,EAAGV,CAAM,CAAA,EAAGU,CAAQ,CAAA,CACzD,CCpCA,IAAMe,CAAAA,CAAsE,CAC3E,OAAA,CAAS,SAAA,CACT,QAAA,CAAU,SAAA,CACV,WAAY,SAAA,CACZ,OAAA,CAAS,SAAA,CACT,QAAA,CAAU,UAAA,CACV,QAAA,CAAU,WACV,IAAA,CAAM,MAAA,CACN,QAAA,CAAU,SAAA,CACV,MAAA,CAAQ,MACT,EAUO,SAASC,CAAAA,CAAuBX,CAAAA,CAAwE,CAC9G,OAAO,CAAE,MAAOA,CAAAA,CAAK,KAAA,CAAO,IAAA,CAAMU,CAAAA,CAA4BV,CAAAA,CAAK,QAAQ,GAAK,MAAA,CAAQ,MAAA,CAAQA,CAAAA,CAAK,MAAO,CAC7G","file":"language.js","sourcesContent":["import type { ExpressionEngine } from \"@solve-js/engine/ExpressionEngine\";\nimport type { TokenCategory } from \"@solve-js/language/TokenCategory\";\nimport { getTokenCategory } from \"@solve-js/language/TokenCategoryMap\";\nimport type { Token } from \"@solve-js/lexer/Token\";\nimport { knownUnits } from \"@solve-js/lexer/units\";\nimport { getMeasure } from \"@solve-js/uom/UomConverter\";\n\n/** A single classified span within a line, the entire output contract of the language service. */\nexport interface SemanticToken {\n\tfrom: number;\n\tto: number;\n\tcategory: TokenCategory;\n}\n\n/** A single completion candidate, the entire output contract of `getCompletions()`. */\nexport interface CompletionItem {\n\tlabel: string;\n\t/** Reuses the highlighting taxonomy, one adapter can serve both features. */\n\tcategory: TokenCategory;\n\t/** e.g. a unit's measure (\"length\"), or the category name for keywords/functions. */\n\tdetail?: string;\n}\n\n/**\n * A completion candidate with its lowercased label precomputed.\n *\n * Internal to the prefix index; callers only ever see the {@link CompletionItem}.\n */\ninterface IndexedCompletionCandidate {\n\titem: CompletionItem;\n\tlowerLabel: string;\n}\n\n/** Completion results are capped, a document-wide candidate pool has no reason to return more than this. */\nconst MAX_COMPLETIONS = 50;\n\n/** Tier ordering for completion results: user-authored variables first, then grammar, then units. */\nconst CATEGORY_TIER: Partial<Record<TokenCategory, number>> = {\n\tvariable: 0,\n\tfunction: 1,\n\tkeyword: 1,\n\toperator: 1,\n\tcomparison: 1,\n\tbitwise: 1,\n\tdatetime: 1,\n\tvector: 1,\n\tunit: 2,\n};\n\n/** Bounded cache size. See the eviction-policy note on `LanguageService.cache`. */\nconst MAX_CACHED_LINES = 2000;\n\ninterface CacheEntry {\n\ttext: string;\n\ttokens: SemanticToken[];\n\t// When set, `tokens` is a single bare-identifier token whose validity\n\t// depends on document-wide DAG state (see the bare-word gate in\n\t// getSemanticTokens), not just this line's own text, so it can't be\n\t// cached as a plain pass/fail result the way every other line can. The\n\t// lex+parse work that produced `tokens` is still cached normally; only\n\t// the DAG membership check is re-run on every lookup (cache hit or\n\t// miss alike), since it's cheap (a Set lookup) and the alternative\n\t// caching the gated result, would go stale the moment some OTHER\n\t// line's edit changes what variables exist, with nothing to trigger a\n\t// re-check of this untouched line.\n\tbareWordCandidate?: string;\n}\n\n/** Options for the editor-facing language service: completions and highlighting. */\nexport interface LanguageServiceOptions {\n\t/**\n\t * Overrides how the service discovers \"variable names known in this\n\t * document\", used to legitimize a lone bare identifier line (see\n\t * `getSemanticTokens`'s single-token gate) and variable-name\n\t * completions (`getCompletions`). Defaults to reading\n\t * `engine.getDag().getSnapshot()`, which works for any consumer\n\t * sharing one `ExpressionEngine` between evaluation and the language\n\t * service (the real Obsidian editor).\n\t *\n\t * Required for consumers whose language service is backed by a\n\t * *different*, non-evaluating engine than the one that actually runs\n\t * the document (the playground's dedicated lexing-only engine, whose\n\t * own DAG is always empty), pass a function reading the real\n\t * evaluation engine's DAG snapshot instead.\n\t */\n\tvariableNameSource?: () => Iterable<string>;\n\n\t/**\n\t * Run the normalizer on the highlighting path, so phrase-fused tokens are\n\t * classified as the thing the parser will actually see.\n\t *\n\t * Off by default, and the default is a judgement rather than an oversight.\n\t * Highlighting runs per keystroke, normalization is real work, and a host\n\t * that is happy with lexer-level categories should not start paying for\n\t * fusion because a new version shipped. Turn it on and `12/09/2026` is one\n\t * `datetime` span instead of five number and operator spans; leave it off\n\t * and nothing about this class changes.\n\t *\n\t * See `benchmarks/languageServiceBenchmarks.spec.ts` for what it costs.\n\t */\n\tnormalizeForHighlighting?: boolean;\n}\n\n/**\n * Editor-agnostic \"language server\" for solve expressions: turns a line of\n * text into semantic token ranges, using the exact same lexer real\n * evaluation uses (so it only ever classifies what the engine's grammar\n * actually recognizes, never a separate/duplicated tokenizer). No\n * knowledge of CSS, CodeMirror, VS Code, or any other rendering concept\n * lives here. See `language/adapters/` for that.\n *\n * Classification happens at the LEXER stage, before the normalizer runs\n * (normalization, phrase fusion, implicit multiply, and package-specific\n * rules, happens later, only on the real evaluation path). A package's\n * lexer-level custom token types (e.g. a custom keyword) are recognized\n * here exactly as evaluation would see them. A package's *normalizer*-fused\n * synthetic tokens (e.g. OSRS's GAME_ITEM, built by fusing several\n * consecutive IDENT tokens against an item-name trie) are NOT. This\n * service still shows the pre-fusion IDENT tokens individually for those.\n * `IEnginePackage.tokenCategories` entries for normalizer-only token types\n * are still valid, correct registrations (queryable via getTokenCategory)\n *, they just won't currently be reachable through this lexer-only\n * classification path. Folding normalization in would require running it\n * per keystroke on the highlighting path too, which needs its own careful\n * design (span recomputation for fused multi-token ranges, in particular)\n * rather than a quick addition here.\n *\n * Lexing alone is NOT sufficient to decide \"recognized\", though: a run of\n * plain-English words (\"My name is ron\") lexes into a sequence of\n * individually-valid IDENT tokens with no grammar tying them together\n * every word \"recognized\" at the token level, but the line as a whole is\n * not something the engine would ever accept as an expression. Surfacing\n * per-token colors for that case looks like the editor mistook prose for\n * code. So a line's tokens are only surfaced once the line as a whole\n * parses successfully (via `ExpressionEngine.compileExpression`, the same\n * parse pipeline, and the same bytecode cache, real evaluation uses; no\n * separate/duplicated grammar check). A single bare word (\"hello\", a valid\n * variable reference) or a keyword-only line (\"pi\") still parses and still\n * highlights, only genuinely ungrammatical text is suppressed, unless it's\n * a known variable elsewhere in the document (see `variableNameSource`).\n *\n * `getCompletions()` is the other half of this \"language server\": unlike\n * `getSemanticTokens()`, it's explicitly for *incomplete*, mid-typing text\n *, it deliberately does NOT gate on parse validity (a half-typed\n * expression almost never parses), using simple prefix matching instead.\n *\n * Must be constructed with an already-configured `ExpressionEngine` (one\n * with all currently-relevant packages registered) rather than a bare\n * lexer, reusing an existing engine is both the fast path (no throwaway\n * lexer construction) and the *correct* one: a highlighting-only lexer\n * built independently of the evaluation engine would silently fail to\n * recognize plugin-contributed tokens (e.g. a package's custom keywords)\n * unless it happened to have the identical packages registered.\n */\nexport class LanguageService {\n\tprivate engine: ExpressionEngine | null;\n\tprivate variableNameSource: () => Iterable<string>;\n\tprivate readonly normalizeForHighlighting: boolean;\n\n\t// Bounded cache keyed by line number ALONE, not `${lineNumber}:${lineText}`\n\t// as an earlier version of this class did. A line's previous text state is\n\t// never useful once it changes, so keying on text too was pure waste:\n\t// every keystroke on a line minted a brand-new, never-reclaimed cache\n\t// entry (an effective per-keystroke memory leak over a long editing\n\t// session). Keying on line number alone makes \"same line, new text\" a\n\t// cheap overwrite instead.\n\t//\n\t// Eviction is oldest-inserted (Map iteration order) when at capacity\n\t// mirroring the same bounded-cache pattern ExpressionEngine's own\n\t// bytecodeCache already uses elsewhere in this codebase. Deliberately\n\t// NOT an LFU (least-frequently-used) policy: LFU would keep resisting\n\t// eviction of old, once-popular lines while punishing a line that just\n\t// scrolled into view (frequency 1), the opposite of what a \"currently\n\t// visible\" cache should prioritize.\n\tprivate cache = new Map<number, CacheEntry>();\n\n\t// Keyword/unit/package-contributed completion candidates don't depend\n\t// on any particular line, built lazily on first getCompletions() call\n\t// and reused after that, since a package registration is the only thing\n\t// that could ever change this list mid-session (see invalidateCache()).\n\t// Variable-name candidates are NOT part of this, they're read fresh on\n\t// every call from variableNameSource(), since those genuinely change on\n\t// every edit.\n\tprivate staticCompletionCandidates: CompletionItem[] | null = null;\n\n\t// The same candidates, bucketed by their lowercased first character with the\n\t// lowercased label precomputed. getCompletions() runs on every keystroke and\n\t// only ever wants candidates sharing the prefix's first character, so\n\t// scanning the whole list and lowercasing each label per call was doing two\n\t// avoidable things: touching entries that could not possibly match, and\n\t// allocating a string per candidate per keystroke. That was affordable when\n\t// the vocabulary was a few hundred entries. Deriving the unit list from the\n\t// conversion tables took it past a thousand, and the warm completion\n\t// benchmarks regressed roughly 2.9x until this was added.\n\tprivate staticCompletionIndex: Map<string, IndexedCompletionCandidate[]> | null = null;\n\n\tconstructor(engine?: ExpressionEngine | null, options?: LanguageServiceOptions) {\n\t\tthis.engine = engine ?? null;\n\t\tthis.variableNameSource = options?.variableNameSource ?? (() => this.defaultVariableNames());\n\t\tthis.normalizeForHighlighting = options?.normalizeForHighlighting ?? false;\n\t}\n\n\tprivate defaultVariableNames(): Iterable<string> {\n\t\tif (!this.engine) return [];\n\t\tconst snapshot = this.engine.getDag().getSnapshot();\n\t\tconst names = new Set<string>(Object.keys(snapshot.consumers));\n\t\tfor (const written of Object.values(snapshot.writes)) {\n\t\t\tfor (const name of written) names.add(name);\n\t\t}\n\t\treturn names;\n\t}\n\n\t/**\n\t * Lex a line, normalize it, and place every resulting token back in the\n\t * source text.\n\t *\n\t * ## Why placing them back is the hard part\n\t *\n\t * Normalization produces three kinds of token and only one of them can be\n\t * highlighted the obvious way.\n\t *\n\t * A token the normalizer left alone still describes its own text, so its\n\t * span is `offset` to `offset + text.length`, exactly as before.\n\t *\n\t * A FUSED token does not. `10 frames` becomes a FRAME_COUNT whose value is\n\t * `10`, and a timecode becomes a token whose value is a comma-separated\n\t * tuple appearing nowhere on the line. Those carry `sourceEnd`, set by\n\t * `createFusedToken`, which is the only place that knows where the fusion\n\t * ended.\n\t *\n\t * An INSERTED token has no text at all. Implicit multiplication puts a STAR\n\t * at the following token's offset, so `5(3)` gains a `*` sitting exactly\n\t * where the `(` is. Painting it would colour a character the reader never\n\t * typed as an operator, and would overlap the token that really is there.\n\t * These are dropped, detected by the one test that needs no cooperation\n\t * from any rule: a token with no recorded fusion span must match the text\n\t * at its own offset, and an inserted one does not.\n\t *\n\t * @param lineText - The raw line.\n\t * @returns Spans in the same shape `Lexer.getHighlightTokens` returns.\n\t */\n\tprivate classifyNormalized(\n\t\tlineText: string,\n\t): { type: string; value: string; offset: number; col: number; length: number; category: TokenCategory | undefined }[] {\n\t\tconst lexer = this.engine!.getLexer();\n\t\tconst raw = lexer.getHighlightTokenObjects(lineText);\n\t\tif (raw.length === 0) return [];\n\n\t\t// Offsets from a blockquote line are relative to the stripped text, so\n\t\t// the text this checks against has to be stripped the same way.\n\t\tconst source =\n\t\t\tlineText.startsWith(\"> \") && lexer.classifyLine(lineText).skip ? lineText.slice(2) : lineText;\n\n\t\tlet normalized: Token[];\n\t\ttry {\n\t\t\tnormalized = this.engine!.getNormalizer().normalize(raw);\n\t\t} catch {\n\t\t\t// Normalization is an enhancement here, not a requirement. A rule\n\t\t\t// that throws on a half-typed line should cost the reader phrase\n\t\t\t// colouring, not all colouring.\n\t\t\tnormalized = raw;\n\t\t}\n\n\t\tconst out: {\n\t\t\ttype: string;\n\t\t\tvalue: string;\n\t\t\toffset: number;\n\t\t\tcol: number;\n\t\t\tlength: number;\n\t\t\tcategory: TokenCategory | undefined;\n\t\t}[] = [];\n\n\t\tfor (const token of normalized) {\n\t\t\tlet end: number;\n\t\t\tif (token.sourceEnd !== undefined) {\n\t\t\t\tend = token.sourceEnd;\n\t\t\t} else if (source.startsWith(token.text, token.offset)) {\n\t\t\t\t// `text`, not `value`. They are the same string for almost every\n\t\t\t\t// token, and differ for a string literal, whose value is the\n\t\t\t\t// payload while its text is the quoted source slice. Matching on\n\t\t\t\t// value dropped every string literal from the painted line,\n\t\t\t\t// since `gbp` does not appear at the offset where `\"gbp\"` does.\n\t\t\t\tend = token.offset + token.text.length;\n\t\t\t} else {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tout.push({\n\t\t\t\ttype: token.type,\n\t\t\t\tvalue: token.value,\n\t\t\t\toffset: token.offset,\n\t\t\t\tcol: token.col,\n\t\t\t\tlength: end - token.offset,\n\t\t\t\tcategory: getTokenCategory(token.type),\n\t\t\t});\n\t\t}\n\n\t\treturn out;\n\t}\n\n\t/**\n\t * Classify every recognized token on one line.\n\t *\n\t * @param lineText - The raw line text (may be a markdown-structural line\n\t * the engine's classifier skips, that's handled by the underlying\n\t * lexer, which returns no tokens for those).\n\t * @param lineNumber - 1-based line number, used purely as a cache key.\n\t */\n\tgetSemanticTokens(lineText: string, lineNumber: number): SemanticToken[] {\n\t\tconst cached = this.cache.get(lineNumber);\n\t\tif (cached && cached.text === lineText) {\n\t\t\tif (cached.bareWordCandidate !== undefined) {\n\t\t\t\treturn this.isKnownVariable(cached.bareWordCandidate) ? cached.tokens : [];\n\t\t\t}\n\t\t\treturn cached.tokens;\n\t\t}\n\n\t\tif (!this.engine) {\n\t\t\t// No engine available (e.g. a consumer that hasn't wired one up yet)\n\t\t\t//, no highlighting, not an error.\n\t\t\treturn [];\n\t\t}\n\n\t\tconst lexer = this.engine.getLexer();\n\t\tconst lexed = this.normalizeForHighlighting\n\t\t\t? this.classifyNormalized(lineText)\n\t\t\t: lexer.getHighlightTokens(lineText);\n\t\tif (lexed.length === 0) {\n\t\t\tthis.putCache(lineNumber, lineText, []);\n\t\t\treturn [];\n\t\t}\n\n\t\tconst classification = lexer.classifyLine(lineText);\n\t\tconst tokens: SemanticToken[] = [];\n\n\t\tif (classification.hasInlineSolve) {\n\t\t\t// A line can mix markdown prose with one or more embedded\n\t\t\t// `s`...`` expressions. Only the text actually inside a\n\t\t\t// well-formed marker is a recognized expression, surrounding\n\t\t\t// prose lexes into individually-valid tokens too (see the class\n\t\t\t// doc comment) but is never something the engine would parse,\n\t\t\t// so it's excluded token-by-token via span membership rather\n\t\t\t// than gating the whole line pass/fail.\n\t\t\tconst validSpans = lexer\n\t\t\t\t.findInlineSolves(lineText)\n\t\t\t\t.filter(span => this.parsesAsExpression(span.expression))\n\t\t\t\t.map(span => ({ from: span.start, to: span.end }));\n\t\t\tfor (const token of lexed) {\n\t\t\t\tif (!token.category) continue;\n\t\t\t\tconst from = token.offset;\n\t\t\t\tconst to = token.offset + token.length;\n\t\t\t\tif (!validSpans.some(s => from >= s.from && to <= s.to)) continue;\n\t\t\t\ttokens.push({ from, to, category: token.category });\n\t\t\t}\n\t\t} else {\n\t\t\t// Blockquote content is stripped of its \"> \" prefix before being\n\t\t\t// tokenized (see Lexer.getHighlightTokens), token offsets are\n\t\t\t// already relative to the stripped text, so the parse check must\n\t\t\t// run against that same substring to match.\n\t\t\tconst text = lineText.startsWith(\"> \") && classification.skip\n\t\t\t\t? lineText.slice(2)\n\t\t\t\t: lineText;\n\t\t\tif (this.parsesAsExpression(text)) {\n\t\t\t\tfor (const token of lexed) {\n\t\t\t\t\tif (!token.category) continue;\n\t\t\t\t\ttokens.push({ from: token.offset, to: token.offset + token.length, category: token.category });\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// A lone bare word (\"hello\") is exactly as ambiguous as a run of\n\t\t// prose (\"My name is dave\"), it happens to parse as a\n\t\t// single-identifier variable-reference expression, but that's true\n\t\t// of literally any English word, so on its own it isn't \"recognized\"\n\t\t// in any meaningful sense. Sigil-marked variables (\":x\", \"$x\") are\n\t\t// unaffected, those lex to TWO tokens (sigil + ident), never\n\t\t// hitting this single-token check. Keywords (\"pi\") are unaffected\n\t\t// too, their category is \"keyword\", not \"variable\". Only surface\n\t\t// it once it's an actual known variable elsewhere in the document\n\t\t// checked live (see the `bareWordCandidate` cache field), not baked\n\t\t// into the cached result, since another line's edit can make this\n\t\t// check flip without this line's own text ever changing.\n\t\tif (tokens.length === 1 && tokens[0].category === \"variable\") {\n\t\t\tconst name = lineText.slice(tokens[0].from, tokens[0].to);\n\t\t\tthis.putCache(lineNumber, lineText, tokens, name);\n\t\t\treturn this.isKnownVariable(name) ? tokens : [];\n\t\t}\n\n\t\tthis.putCache(lineNumber, lineText, tokens);\n\t\treturn tokens;\n\t}\n\n\t/**\n\t * Completion candidates for the identifier prefix immediately before\n\t * `cursorOffset` on `lineText`. Deliberately simple prefix matching, not\n\t * parser-driven \"what's grammatically valid here\" prediction, a\n\t * half-typed expression almost never parses, so gating on parse\n\t * validity (the way `getSemanticTokens` does) would suppress\n\t * completions almost always. This is the safest, fastest option that\n\t * still delivers real value.\n\t *\n\t * Candidates come from three sources: keywords (which already include\n\t * function names. See `ExpressionLexer.getKeywords()`'s doc comment)\n\t * and units, both static per engine configuration and cached lazily;\n\t * package-contributed items (`IEnginePackage.completionItems`), same\n\t * cache; and variable names, read fresh from `variableNameSource()` on\n\t * every call since those change on every edit.\n\t */\n\tgetCompletions(lineText: string, cursorOffset: number): CompletionItem[] {\n\t\tconst prefixMatch = /[A-Za-z0-9_]+$/.exec(lineText.slice(0, cursorOffset));\n\t\tif (!prefixMatch) return [];\n\t\tconst prefix = prefixMatch[0].toLowerCase();\n\n\t\tif (!this.engine) return [];\n\n\t\tconst matches: CompletionItem[] = [];\n\n\t\t// Variables are read fresh every call and there are few of them, so they\n\t\t// stay a linear scan.\n\t\tfor (const name of this.variableNameSource()) {\n\t\t\tif (name.toLowerCase().startsWith(prefix)) {\n\t\t\t\tmatches.push({ label: name, category: \"variable\" });\n\t\t\t}\n\t\t}\n\n\t\t// Static candidates only ever match if they share the prefix's first\n\t\t// character, so consult that bucket alone.\n\t\tconst bucket = this.getStaticCompletionIndex().get(prefix[0]);\n\t\tif (bucket) {\n\t\t\tfor (const candidate of bucket) {\n\t\t\t\tif (candidate.lowerLabel.startsWith(prefix)) matches.push(candidate.item);\n\t\t\t}\n\t\t}\n\n\t\tmatches.sort((a, b) => {\n\t\t\tconst tierDiff = (CATEGORY_TIER[a.category] ?? 3) - (CATEGORY_TIER[b.category] ?? 3);\n\t\t\tif (tierDiff !== 0) return tierDiff;\n\t\t\treturn a.label.localeCompare(b.label);\n\t\t});\n\n\t\treturn matches.slice(0, MAX_COMPLETIONS);\n\t}\n\n\t/** Lazily builds and caches the keyword/unit/package-item candidate list. See `staticCompletionCandidates`. */\n\tprivate getStaticCompletionCandidates(): CompletionItem[] {\n\t\tif (this.staticCompletionCandidates) return this.staticCompletionCandidates;\n\n\t\tconst items: CompletionItem[] = [];\n\t\tfor (const [word, tokenType] of Object.entries(this.engine!.getLexer().getKeywords())) {\n\t\t\tconst category = getTokenCategory(tokenType);\n\t\t\tif (!category) continue;\n\t\t\titems.push({ label: word, category });\n\t\t}\n\t\tfor (const unit of knownUnits) {\n\t\t\titems.push({ label: unit, category: \"unit\", detail: getMeasure(unit) });\n\t\t}\n\t\titems.push(...this.engine!.getPackageCompletionItems());\n\n\t\tthis.staticCompletionCandidates = items;\n\t\treturn items;\n\t}\n\n\t/**\n\t * The static candidates bucketed by lowercased first character, built once\n\t * from {@link getStaticCompletionCandidates} and invalidated alongside it.\n\t */\n\tprivate getStaticCompletionIndex(): Map<string, IndexedCompletionCandidate[]> {\n\t\tif (this.staticCompletionIndex) return this.staticCompletionIndex;\n\n\t\tconst index = new Map<string, IndexedCompletionCandidate[]>();\n\t\tfor (const item of this.getStaticCompletionCandidates()) {\n\t\t\tconst lowerLabel = item.label.toLowerCase();\n\t\t\tconst firstCharacter = lowerLabel[0];\n\t\t\t// A label cannot match any prefix if it is empty, and the prefix\n\t\t\t// regex guarantees at least one character on the query side.\n\t\t\tif (firstCharacter === undefined) continue;\n\t\t\tlet bucket = index.get(firstCharacter);\n\t\t\tif (bucket === undefined) {\n\t\t\t\tbucket = [];\n\t\t\t\tindex.set(firstCharacter, bucket);\n\t\t\t}\n\t\t\tbucket.push({ item, lowerLabel });\n\t\t}\n\n\t\tthis.staticCompletionIndex = index;\n\t\treturn index;\n\t}\n\n\tprivate isKnownVariable(name: string): boolean {\n\t\tfor (const known of this.variableNameSource()) {\n\t\t\tif (known === name) return true;\n\t\t}\n\t\treturn false;\n\t}\n\n\t/**\n\t * Whether the engine's parser actually accepts a piece of text as a\n\t * well-formed expression, not merely whether it lexes into individually\n\t * recognized token types. See the class doc comment's prose example.\n\t * `tryCompileExpression` is compile-only (lex → normalize → parse →\n\t * cache bytecode, no VM execution, no network/async side effects) and\n\t * reuses the engine's existing bytecode cache, so text that's already\n\t * been evaluated (or previously highlight-checked) is a cache hit here\n\t * too.\n\t *\n\t * Deliberately calls the non-throwing `tryCompileExpression` rather than\n\t * try/catching `compileExpression`. This runs on every visible line on\n\t * every keystroke, and the common case for a real markdown document is\n\t * lines that DON'T parse (prose), not lines that do. Throwing there would\n\t * mean constructing a EngineError (with V8 stack-trace capture) for the\n\t * common case instead of the rare one.\n\t */\n\tprivate parsesAsExpression(text: string): boolean {\n\t\treturn this.engine!.tryCompileExpression(text);\n\t}\n\n\tprivate putCache(lineNumber: number, text: string, tokens: SemanticToken[], bareWordCandidate?: string): void {\n\t\tif (!this.cache.has(lineNumber) && this.cache.size >= MAX_CACHED_LINES) {\n\t\t\tconst oldestKey = this.cache.keys().next().value;\n\t\t\tif (oldestKey !== undefined) this.cache.delete(oldestKey);\n\t\t}\n\t\tthis.cache.set(lineNumber, { text, tokens, bareWordCandidate });\n\t}\n\n\t/**\n\t * Evict specific lines (e.g. the lines actually touched by a CodeMirror\n\t * change set) instead of the whole cache, the surgical counterpart to\n\t * {@link invalidateCache}, letting a single-line edit stay cheap even in\n\t * a large document: every other cached line is untouched and still hits\n\t * on the next call.\n\t */\n\tinvalidateLines(lineNumbers: Iterable<number>): void {\n\t\tfor (const lineNumber of lineNumbers) {\n\t\t\tthis.cache.delete(lineNumber);\n\t\t}\n\t}\n\n\t/**\n\t * Full cache clear. Reserved for cases with no meaningful \"which lines\n\t * changed\" (e.g. the document was swapped wholesale, or a package was\n\t * registered/unregistered mid-session, changing what categories exist).\n\t * Prefer {@link invalidateLines} for ordinary edits. Also rebuilds the\n\t * lazily-cached keyword/unit/package-item completion candidates on next\n\t * use, the only thing that can change that list mid-session.\n\t */\n\tinvalidateCache(): void {\n\t\tthis.cache.clear();\n\t\tthis.staticCompletionCandidates = null;\n\t\tthis.staticCompletionIndex = null;\n\t}\n}\n","import type { TokenCategory } from \"@solve-js/language/TokenCategory\";\n\n/**\n * Namespace applied to a semantic category when no other one is asked for.\n *\n * A prefix is needed because a bare category name like `number` or `error`\n * would collide with almost any host stylesheet. `solve-` is the narrowest\n * namespace that still says where the class came from, and it deliberately\n * names this library rather than any particular editor.\n */\nexport const DEFAULT_TOKEN_CLASS_PREFIX = \"solve-\";\n\n/**\n * Maps a semantic category to a predictable, stable CSS class name.\n *\n * Deliberately trivial: the category name IS the class-name key\n * (`\"number\"` → `solve-number`), so there is no separate table to keep in\n * sync as categories grow. A brand-new category, including one contributed\n * by a solve-js package at runtime, gets a matching class name with no\n * changes here.\n *\n * This is editor-agnostic on purpose. It produces a class-name string and\n * nothing else, so it works the same whether the host is CodeMirror\n * (`Decoration.mark({ class: tokenClassName(token.category) })`), Slate,\n * ProseMirror, Monaco or a plain `<span>`. Actual colors are pure CSS,\n * resolved from `--solve-hl-{category}` custom properties by each consumer.\n *\n * @param category - Semantic category from `getSemanticTokens()`.\n * @param prefix - Namespace to apply. Defaults to `solve-`.\n * @returns The class name for that category.\n */\nexport function tokenClassName(category: TokenCategory, prefix: string = DEFAULT_TOKEN_CLASS_PREFIX): string {\n\treturn `${prefix}${category}`;\n}\n\n/**\n * Builds a `tokenClassName` bound to a fixed prefix.\n *\n * The prefix is configurable because a host may already own a namespace it\n * wants these classes to sit inside: a CodeMirror theme that keys off `cm-`,\n * a design system that scopes everything under one token, or an app that\n * embeds two editors and wants to style them apart. Passing the prefix once\n * here is cheaper than threading it through every call site.\n *\n * ```ts\n * const className = createTokenClassName(\"cm-solve-\");\n * className(\"number\"); // \"cm-solve-number\"\n * ```\n *\n * @param prefix - Namespace to apply to every category.\n * @returns A function mapping a category to a prefixed class name.\n */\nexport function createTokenClassName(prefix: string): (category: TokenCategory) => string {\n\treturn (category: TokenCategory) => `${prefix}${category}`;\n}\n","import type { TokenCategory } from \"@solve-js/language/TokenCategory\";\nimport type { CompletionItem } from \"@solve-js/language/LanguageService\";\n\n/**\n * Maps a semantic category to one of `@codemirror/autocomplete`'s built-in\n * completion \"type\" strings (which drive its default gutter icon), the one\n * genuinely CodeMirror-specific thing this feature needs. Falls back to\n * \"text\" for anything unmapped, including plugin-contributed categories\n * (e.g. OSRS's \"osrs-item\"), a reasonable neutral default rather than a\n * hard failure for a category this adapter doesn't know about yet.\n *\n * No `@codemirror/autocomplete` import here, the returned object shape is\n * structurally compatible with CM6's `Completion` type by duck typing, so\n * `solve-js` gains no new dependency; the actual `CompletionSource`\n * function (reading `CompletionContext`, building a `CompletionResult`)\n * lives in each consumer (src/app, playground), same tier as\n * `buildDecorations()` already is for highlighting.\n */\nconst CATEGORY_TO_COMPLETION_TYPE: Partial<Record<TokenCategory, string>> = {\n\tkeyword: \"keyword\",\n\toperator: \"keyword\",\n\tcomparison: \"keyword\",\n\tbitwise: \"keyword\",\n\tfunction: \"function\",\n\tvariable: \"variable\",\n\tunit: \"type\",\n\tdatetime: \"keyword\",\n\tvector: \"type\",\n};\n\n/**\n * Convert a completion into CodeMirror's option shape.\n *\n * Kept in an adapter so the language service itself stays editor-agnostic.\n *\n * @param item - Completion produced by the language service.\n * @returns The equivalent CodeMirror option.\n */\nexport function completionItemToOption(item: CompletionItem): { label: string; type: string; detail?: string } {\n\treturn { label: item.label, type: CATEGORY_TO_COMPLETION_TYPE[item.category] ?? \"text\", detail: item.detail };\n}\n"]}
package/dist/lexer.cjs CHANGED
@@ -1,64 +1,2 @@
1
- 'use strict';
2
-
3
- var chunkN5NNW4VG_cjs = require('./chunk-N5NNW4VG.cjs');
4
- require('./chunk-536WPM2V.cjs');
5
- var chunkZMW6NU2K_cjs = require('./chunk-ZMW6NU2K.cjs');
6
- var chunkQFTDTX6K_cjs = require('./chunk-QFTDTX6K.cjs');
7
- require('./chunk-OUHT5Z36.cjs');
8
- var chunkAQNHHJMJ_cjs = require('./chunk-AQNHHJMJ.cjs');
9
- require('./chunk-AMOJYLG2.cjs');
10
- require('./chunk-B4HBEFTB.cjs');
11
- require('./chunk-B7LXJ6LC.cjs');
12
-
13
-
14
-
15
- Object.defineProperty(exports, "Lexer", {
16
- enumerable: true,
17
- get: function () { return chunkN5NNW4VG_cjs.Lexer; }
18
- });
19
- Object.defineProperty(exports, "LexerState", {
20
- enumerable: true,
21
- get: function () { return chunkN5NNW4VG_cjs.LexerState; }
22
- });
23
- Object.defineProperty(exports, "buildTokenLookup", {
24
- enumerable: true,
25
- get: function () { return chunkN5NNW4VG_cjs.buildTokenLookup; }
26
- });
27
- Object.defineProperty(exports, "sharedLexer", {
28
- enumerable: true,
29
- get: function () { return chunkN5NNW4VG_cjs.sharedLexer; }
30
- });
31
- Object.defineProperty(exports, "ExpressionLexer", {
32
- enumerable: true,
33
- get: function () { return chunkZMW6NU2K_cjs.ExpressionLexer; }
34
- });
35
- Object.defineProperty(exports, "LexerToken", {
36
- enumerable: true,
37
- get: function () { return chunkZMW6NU2K_cjs.LexerToken; }
38
- });
39
- Object.defineProperty(exports, "TokenTypes", {
40
- enumerable: true,
41
- get: function () { return chunkQFTDTX6K_cjs.TokenTypes; }
42
- });
43
- Object.defineProperty(exports, "registerAllTokenTypes", {
44
- enumerable: true,
45
- get: function () { return chunkQFTDTX6K_cjs.registerAllTokenTypes; }
46
- });
47
- Object.defineProperty(exports, "registerTokenType", {
48
- enumerable: true,
49
- get: function () { return chunkQFTDTX6K_cjs.registerTokenType; }
50
- });
51
- Object.defineProperty(exports, "tokenTypeId", {
52
- enumerable: true,
53
- get: function () { return chunkQFTDTX6K_cjs.tokenTypeId; }
54
- });
55
- Object.defineProperty(exports, "tokenTypeName", {
56
- enumerable: true,
57
- get: function () { return chunkQFTDTX6K_cjs.tokenTypeName; }
58
- });
59
- Object.defineProperty(exports, "knownUnits", {
60
- enumerable: true,
61
- get: function () { return chunkAQNHHJMJ_cjs.knownUnits; }
62
- });
63
- //# sourceMappingURL=lexer.cjs.map
1
+ 'use strict';var chunkLR4E4A4W_cjs=require('./chunk-LR4E4A4W.cjs');require('./chunk-Y7O4D3BJ.cjs');var chunk6KFVG6UY_cjs=require('./chunk-6KFVG6UY.cjs'),chunk5IJD5L3O_cjs=require('./chunk-5IJD5L3O.cjs');require('./chunk-MSYX32PF.cjs');var chunkFWW3M36J_cjs=require('./chunk-FWW3M36J.cjs');require('./chunk-CIQOK7Q4.cjs'),require('./chunk-SOMGSIO4.cjs');Object.defineProperty(exports,"Lexer",{enumerable:true,get:function(){return chunkLR4E4A4W_cjs.b}});Object.defineProperty(exports,"LexerState",{enumerable:true,get:function(){return chunkLR4E4A4W_cjs.a}});Object.defineProperty(exports,"buildTokenLookup",{enumerable:true,get:function(){return chunkLR4E4A4W_cjs.d}});Object.defineProperty(exports,"sharedLexer",{enumerable:true,get:function(){return chunkLR4E4A4W_cjs.c}});Object.defineProperty(exports,"ExpressionLexer",{enumerable:true,get:function(){return chunk6KFVG6UY_cjs.b}});Object.defineProperty(exports,"LexerToken",{enumerable:true,get:function(){return chunk6KFVG6UY_cjs.a}});Object.defineProperty(exports,"TokenTypes",{enumerable:true,get:function(){return chunk5IJD5L3O_cjs.a}});Object.defineProperty(exports,"registerAllTokenTypes",{enumerable:true,get:function(){return chunk5IJD5L3O_cjs.e}});Object.defineProperty(exports,"registerTokenType",{enumerable:true,get:function(){return chunk5IJD5L3O_cjs.b}});Object.defineProperty(exports,"tokenTypeId",{enumerable:true,get:function(){return chunk5IJD5L3O_cjs.c}});Object.defineProperty(exports,"tokenTypeName",{enumerable:true,get:function(){return chunk5IJD5L3O_cjs.d}});Object.defineProperty(exports,"knownUnits",{enumerable:true,get:function(){return chunkFWW3M36J_cjs.a}});//# sourceMappingURL=lexer.cjs.map
64
2
  //# sourceMappingURL=lexer.cjs.map
package/dist/lexer.d.cts CHANGED
@@ -1,6 +1,6 @@
1
- import { T as TokenLookup } from './Lexer-BOs7euZe.cjs';
2
- export { E as ExpressionLexer, I as InlineSolveSpan, L as Lexer, a as LexerState, b as LexerToken, c as LexerVocabulary, d as LineClassification, M as MarkdownLineType, S as ScanLineResult, s as sharedLexer } from './Lexer-BOs7euZe.cjs';
3
- export { T as Token, a as TokenType, b as TokenTypes, r as registerAllTokenTypes, c as registerTokenType, t as tokenTypeId, d as tokenTypeName } from './Token-B1hdkedD.cjs';
1
+ import { T as TokenLookup } from './Lexer-B4C1qHXu.cjs';
2
+ export { E as ExpressionLexer, I as InlineSolveSpan, L as Lexer, a as LexerState, b as LexerToken, c as LexerVocabulary, d as LineClassification, M as MarkdownLineType, S as ScanLineResult, s as sharedLexer } from './Lexer-B4C1qHXu.cjs';
3
+ export { T as Token, a as TokenType, b as TokenTypes, r as registerAllTokenTypes, c as registerTokenType, t as tokenTypeId, d as tokenTypeName } from './Token-CbP_OutD.cjs';
4
4
 
5
5
  /**
6
6
  * The set of unit identifiers the lexer will turn into a UNIT token.
package/dist/lexer.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { T as TokenLookup } from './Lexer-CSI_lwbW.js';
2
- export { E as ExpressionLexer, I as InlineSolveSpan, L as Lexer, a as LexerState, b as LexerToken, c as LexerVocabulary, d as LineClassification, M as MarkdownLineType, S as ScanLineResult, s as sharedLexer } from './Lexer-CSI_lwbW.js';
3
- export { T as Token, a as TokenType, b as TokenTypes, r as registerAllTokenTypes, c as registerTokenType, t as tokenTypeId, d as tokenTypeName } from './Token-B1hdkedD.js';
1
+ import { T as TokenLookup } from './Lexer-DKMlj7Sy.js';
2
+ export { E as ExpressionLexer, I as InlineSolveSpan, L as Lexer, a as LexerState, b as LexerToken, c as LexerVocabulary, d as LineClassification, M as MarkdownLineType, S as ScanLineResult, s as sharedLexer } from './Lexer-DKMlj7Sy.js';
3
+ export { T as Token, a as TokenType, b as TokenTypes, r as registerAllTokenTypes, c as registerTokenType, t as tokenTypeId, d as tokenTypeName } from './Token-CbP_OutD.js';
4
4
 
5
5
  /**
6
6
  * The set of unit identifiers the lexer will turn into a UNIT token.
package/dist/lexer.js CHANGED
@@ -1,11 +1,2 @@
1
- export { Lexer, LexerState, buildTokenLookup, sharedLexer } from './chunk-DLEBSLF4.js';
2
- import './chunk-UO6BUV6K.js';
3
- export { ExpressionLexer, LexerToken } from './chunk-JG6ZJ2WU.js';
4
- export { TokenTypes, registerAllTokenTypes, registerTokenType, tokenTypeId, tokenTypeName } from './chunk-4D6NIHE2.js';
5
- import './chunk-XBTEO4OB.js';
6
- export { knownUnits } from './chunk-SBUFNJVE.js';
7
- import './chunk-V4XG5QF6.js';
8
- import './chunk-ERCOHGXD.js';
9
- import './chunk-YLJ4XMA6.js';
10
- //# sourceMappingURL=lexer.js.map
1
+ export{b as Lexer,a as LexerState,d as buildTokenLookup,c as sharedLexer}from'./chunk-GOIQYUWV.js';import'./chunk-JPFCXLJV.js';export{b as ExpressionLexer,a as LexerToken}from'./chunk-UI6IFGBT.js';export{a as TokenTypes,e as registerAllTokenTypes,b as registerTokenType,c as tokenTypeId,d as tokenTypeName}from'./chunk-IJMNVBIS.js';import'./chunk-62LMTO4F.js';export{a as knownUnits}from'./chunk-TRBXW6HW.js';import'./chunk-2JMFUQZH.js';import'./chunk-MPB7KUN5.js';//# sourceMappingURL=lexer.js.map
11
2
  //# sourceMappingURL=lexer.js.map
@@ -1,40 +1,2 @@
1
- 'use strict';
2
-
3
- require('./chunk-NGBBNL4K.cjs');
4
- var chunkCUR2WLI4_cjs = require('./chunk-CUR2WLI4.cjs');
5
- require('./chunk-ZMW6NU2K.cjs');
6
- require('./chunk-QFTDTX6K.cjs');
7
- require('./chunk-OUHT5Z36.cjs');
8
- require('./chunk-AQNHHJMJ.cjs');
9
- require('./chunk-AMOJYLG2.cjs');
10
- require('./chunk-B4HBEFTB.cjs');
11
- require('./chunk-B7LXJ6LC.cjs');
12
-
13
-
14
-
15
- Object.defineProperty(exports, "BUILTIN_PHRASES", {
16
- enumerable: true,
17
- get: function () { return chunkCUR2WLI4_cjs.BUILTIN_PHRASES; }
18
- });
19
- Object.defineProperty(exports, "PhraseTrie", {
20
- enumerable: true,
21
- get: function () { return chunkCUR2WLI4_cjs.PhraseTrie; }
22
- });
23
- Object.defineProperty(exports, "TokenNormalizer", {
24
- enumerable: true,
25
- get: function () { return chunkCUR2WLI4_cjs.TokenNormalizer; }
26
- });
27
- Object.defineProperty(exports, "createBuiltinNormalizerRules", {
28
- enumerable: true,
29
- get: function () { return chunkCUR2WLI4_cjs.createBuiltinNormalizerRules; }
30
- });
31
- Object.defineProperty(exports, "createFusedToken", {
32
- enumerable: true,
33
- get: function () { return chunkCUR2WLI4_cjs.createFusedToken; }
34
- });
35
- Object.defineProperty(exports, "implicitMultiplyRule", {
36
- enumerable: true,
37
- get: function () { return chunkCUR2WLI4_cjs.implicitMultiplyRule; }
38
- });
39
- //# sourceMappingURL=normalizer.cjs.map
1
+ 'use strict';require('./chunk-NGBBNL4K.cjs');var chunkAPN442VD_cjs=require('./chunk-APN442VD.cjs');require('./chunk-6KFVG6UY.cjs'),require('./chunk-5IJD5L3O.cjs'),require('./chunk-MSYX32PF.cjs'),require('./chunk-FWW3M36J.cjs'),require('./chunk-CIQOK7Q4.cjs'),require('./chunk-SOMGSIO4.cjs');Object.defineProperty(exports,"BUILTIN_PHRASES",{enumerable:true,get:function(){return chunkAPN442VD_cjs.g}});Object.defineProperty(exports,"PhraseTrie",{enumerable:true,get:function(){return chunkAPN442VD_cjs.a}});Object.defineProperty(exports,"TokenNormalizer",{enumerable:true,get:function(){return chunkAPN442VD_cjs.c}});Object.defineProperty(exports,"createBuiltinNormalizerRules",{enumerable:true,get:function(){return chunkAPN442VD_cjs.f}});Object.defineProperty(exports,"createFusedToken",{enumerable:true,get:function(){return chunkAPN442VD_cjs.b}});Object.defineProperty(exports,"implicitMultiplyRule",{enumerable:true,get:function(){return chunkAPN442VD_cjs.d}});//# sourceMappingURL=normalizer.cjs.map
40
2
  //# sourceMappingURL=normalizer.cjs.map
@@ -1,6 +1,6 @@
1
- import { N as NormalizerMatch, a as NormalizerRule } from './TokenNormalizer-DRc1Js1V.cjs';
2
- export { b as NormalizerOptions, T as TokenFusion, c as TokenNormalizer, d as createFusedToken } from './TokenNormalizer-DRc1Js1V.cjs';
3
- import { T as Token } from './Token-B1hdkedD.cjs';
1
+ import { N as NormalizerMatch, a as NormalizerRule } from './TokenNormalizer-DnlL7_8c.cjs';
2
+ export { b as NormalizerOptions, T as TokenFusion, c as TokenNormalizer, d as createFusedToken } from './TokenNormalizer-DnlL7_8c.cjs';
3
+ import { T as Token } from './Token-CbP_OutD.cjs';
4
4
 
5
5
  /**
6
6
  * PhraseTrie, optimized word-level trie for multi-word phrase fusion.
@@ -1,6 +1,6 @@
1
- import { N as NormalizerMatch, a as NormalizerRule } from './TokenNormalizer-C6VzZgHa.js';
2
- export { b as NormalizerOptions, T as TokenFusion, c as TokenNormalizer, d as createFusedToken } from './TokenNormalizer-C6VzZgHa.js';
3
- import { T as Token } from './Token-B1hdkedD.js';
1
+ import { N as NormalizerMatch, a as NormalizerRule } from './TokenNormalizer-DCWdZjGz.js';
2
+ export { b as NormalizerOptions, T as TokenFusion, c as TokenNormalizer, d as createFusedToken } from './TokenNormalizer-DCWdZjGz.js';
3
+ import { T as Token } from './Token-CbP_OutD.js';
4
4
 
5
5
  /**
6
6
  * PhraseTrie, optimized word-level trie for multi-word phrase fusion.
@@ -1,11 +1,2 @@
1
- import './chunk-2RWAXT6O.js';
2
- export { BUILTIN_PHRASES, PhraseTrie, TokenNormalizer, createBuiltinNormalizerRules, createFusedToken, implicitMultiplyRule } from './chunk-BYJBUL7U.js';
3
- import './chunk-JG6ZJ2WU.js';
4
- import './chunk-4D6NIHE2.js';
5
- import './chunk-XBTEO4OB.js';
6
- import './chunk-SBUFNJVE.js';
7
- import './chunk-V4XG5QF6.js';
8
- import './chunk-ERCOHGXD.js';
9
- import './chunk-YLJ4XMA6.js';
10
- //# sourceMappingURL=normalizer.js.map
1
+ import'./chunk-2RWAXT6O.js';export{g as BUILTIN_PHRASES,a as PhraseTrie,c as TokenNormalizer,f as createBuiltinNormalizerRules,b as createFusedToken,d as implicitMultiplyRule}from'./chunk-QXQE7X4S.js';import'./chunk-UI6IFGBT.js';import'./chunk-IJMNVBIS.js';import'./chunk-62LMTO4F.js';import'./chunk-TRBXW6HW.js';import'./chunk-2JMFUQZH.js';import'./chunk-MPB7KUN5.js';//# sourceMappingURL=normalizer.js.map
11
2
  //# sourceMappingURL=normalizer.js.map
package/dist/packages.cjs CHANGED
@@ -1,129 +1,2 @@
1
- 'use strict';
2
-
3
- var chunkMN3LHRGV_cjs = require('./chunk-MN3LHRGV.cjs');
4
- require('./chunk-J45BCEZ4.cjs');
5
- require('./chunk-CUR2WLI4.cjs');
6
- require('./chunk-ADBA3XBE.cjs');
7
- require('./chunk-SSV46KFA.cjs');
8
- require('./chunk-Z2XP767T.cjs');
9
- require('./chunk-7ZX6B7SY.cjs');
10
- require('./chunk-FEAIOR7N.cjs');
11
- require('./chunk-ZVTWQLK4.cjs');
12
- require('./chunk-XIYYHA65.cjs');
13
- require('./chunk-VEKIWQ3F.cjs');
14
- require('./chunk-ALYRJ72W.cjs');
15
- require('./chunk-HIQ5HSZL.cjs');
16
- require('./chunk-2TZKENDH.cjs');
17
- require('./chunk-EJ3ILXX6.cjs');
18
- require('./chunk-ZMW6NU2K.cjs');
19
- require('./chunk-QFTDTX6K.cjs');
20
- require('./chunk-OUHT5Z36.cjs');
21
- require('./chunk-AQNHHJMJ.cjs');
22
- require('./chunk-AMOJYLG2.cjs');
23
- require('./chunk-B4HBEFTB.cjs');
24
- require('./chunk-B7LXJ6LC.cjs');
25
-
26
-
27
-
28
- Object.defineProperty(exports, "ARITHMETIC_PACKAGE", {
29
- enumerable: true,
30
- get: function () { return chunkMN3LHRGV_cjs.ARITHMETIC_PACKAGE; }
31
- });
32
- Object.defineProperty(exports, "BIGINT_PACKAGE", {
33
- enumerable: true,
34
- get: function () { return chunkMN3LHRGV_cjs.BIGINT_PACKAGE; }
35
- });
36
- Object.defineProperty(exports, "BUILTIN_PACKAGES", {
37
- enumerable: true,
38
- get: function () { return chunkMN3LHRGV_cjs.BUILTIN_PACKAGES; }
39
- });
40
- Object.defineProperty(exports, "CONDITIONALS_PACKAGE", {
41
- enumerable: true,
42
- get: function () { return chunkMN3LHRGV_cjs.CONDITIONALS_PACKAGE; }
43
- });
44
- Object.defineProperty(exports, "CONVERTERS_PACKAGE", {
45
- enumerable: true,
46
- get: function () { return chunkMN3LHRGV_cjs.CONVERTERS_PACKAGE; }
47
- });
48
- Object.defineProperty(exports, "CURRENCY_PACKAGE", {
49
- enumerable: true,
50
- get: function () { return chunkMN3LHRGV_cjs.CURRENCY_PACKAGE; }
51
- });
52
- Object.defineProperty(exports, "DATETIME_PACKAGE", {
53
- enumerable: true,
54
- get: function () { return chunkMN3LHRGV_cjs.DATETIME_PACKAGE; }
55
- });
56
- Object.defineProperty(exports, "DICE_PACKAGE", {
57
- enumerable: true,
58
- get: function () { return chunkMN3LHRGV_cjs.DICE_PACKAGE; }
59
- });
60
- Object.defineProperty(exports, "FINANCE_PACKAGE", {
61
- enumerable: true,
62
- get: function () { return chunkMN3LHRGV_cjs.FINANCE_PACKAGE; }
63
- });
64
- Object.defineProperty(exports, "FUNCTION_PACKAGE", {
65
- enumerable: true,
66
- get: function () { return chunkMN3LHRGV_cjs.FUNCTION_PACKAGE; }
67
- });
68
- Object.defineProperty(exports, "LINES_PACKAGE", {
69
- enumerable: true,
70
- get: function () { return chunkMN3LHRGV_cjs.LINES_PACKAGE; }
71
- });
72
- Object.defineProperty(exports, "MAPREDUCE_PACKAGE", {
73
- enumerable: true,
74
- get: function () { return chunkMN3LHRGV_cjs.MAPREDUCE_PACKAGE; }
75
- });
76
- Object.defineProperty(exports, "MATHPHRASES_PACKAGE", {
77
- enumerable: true,
78
- get: function () { return chunkMN3LHRGV_cjs.MATHPHRASES_PACKAGE; }
79
- });
80
- Object.defineProperty(exports, "MATRIX_PACKAGE", {
81
- enumerable: true,
82
- get: function () { return chunkMN3LHRGV_cjs.MATRIX_PACKAGE; }
83
- });
84
- Object.defineProperty(exports, "PERCENTAGE_PACKAGE", {
85
- enumerable: true,
86
- get: function () { return chunkMN3LHRGV_cjs.PERCENTAGE_PACKAGE; }
87
- });
88
- Object.defineProperty(exports, "SYMBOLIC_PACKAGE", {
89
- enumerable: true,
90
- get: function () { return chunkMN3LHRGV_cjs.SYMBOLIC_PACKAGE; }
91
- });
92
- Object.defineProperty(exports, "TABLES_PACKAGE", {
93
- enumerable: true,
94
- get: function () { return chunkMN3LHRGV_cjs.TABLES_PACKAGE; }
95
- });
96
- Object.defineProperty(exports, "TIME_PACKAGE", {
97
- enumerable: true,
98
- get: function () { return chunkMN3LHRGV_cjs.TIME_PACKAGE; }
99
- });
100
- Object.defineProperty(exports, "UOM_PACKAGE", {
101
- enumerable: true,
102
- get: function () { return chunkMN3LHRGV_cjs.UOM_PACKAGE; }
103
- });
104
- Object.defineProperty(exports, "VARIABLES_PACKAGE", {
105
- enumerable: true,
106
- get: function () { return chunkMN3LHRGV_cjs.VARIABLES_PACKAGE; }
107
- });
108
- Object.defineProperty(exports, "VECTOR_PACKAGE", {
109
- enumerable: true,
110
- get: function () { return chunkMN3LHRGV_cjs.VECTOR_PACKAGE; }
111
- });
112
- Object.defineProperty(exports, "WEATHER_PACKAGE", {
113
- enumerable: true,
114
- get: function () { return chunkMN3LHRGV_cjs.WEATHER_PACKAGE; }
115
- });
116
- Object.defineProperty(exports, "createCurrencyPackage", {
117
- enumerable: true,
118
- get: function () { return chunkMN3LHRGV_cjs.createCurrencyPackage; }
119
- });
120
- Object.defineProperty(exports, "createKnowledgePackage", {
121
- enumerable: true,
122
- get: function () { return chunkMN3LHRGV_cjs.createKnowledgePackage; }
123
- });
124
- Object.defineProperty(exports, "createStocksPackage", {
125
- enumerable: true,
126
- get: function () { return chunkMN3LHRGV_cjs.createStocksPackage; }
127
- });
128
- //# sourceMappingURL=packages.cjs.map
1
+ 'use strict';var chunkSUXRZWH2_cjs=require('./chunk-SUXRZWH2.cjs');require('./chunk-6INX773F.cjs');var chunkSZGK6RIP_cjs=require('./chunk-SZGK6RIP.cjs');require('./chunk-4QVBSG6B.cjs'),require('./chunk-APN442VD.cjs'),require('./chunk-UURM7P3P.cjs'),require('./chunk-ZLRJ7TDP.cjs'),require('./chunk-JAK3RAFA.cjs'),require('./chunk-4BZIYU7S.cjs'),require('./chunk-JFAJN3C2.cjs'),require('./chunk-TLG7VZRX.cjs'),require('./chunk-ESUN2THE.cjs'),require('./chunk-N7N7MPMK.cjs'),require('./chunk-PS272DZJ.cjs'),require('./chunk-IANAMBJQ.cjs'),require('./chunk-6KFVG6UY.cjs'),require('./chunk-5IJD5L3O.cjs'),require('./chunk-MSYX32PF.cjs'),require('./chunk-FWW3M36J.cjs'),require('./chunk-CIQOK7Q4.cjs'),require('./chunk-SOMGSIO4.cjs');Object.defineProperty(exports,"ARITHMETIC_PACKAGE",{enumerable:true,get:function(){return chunkSUXRZWH2_cjs.a}});Object.defineProperty(exports,"BIGINT_PACKAGE",{enumerable:true,get:function(){return chunkSUXRZWH2_cjs.n}});Object.defineProperty(exports,"BUILTIN_PACKAGES",{enumerable:true,get:function(){return chunkSUXRZWH2_cjs.y}});Object.defineProperty(exports,"CONDITIONALS_PACKAGE",{enumerable:true,get:function(){return chunkSUXRZWH2_cjs.o}});Object.defineProperty(exports,"CONVERTERS_PACKAGE",{enumerable:true,get:function(){return chunkSUXRZWH2_cjs.p}});Object.defineProperty(exports,"CURRENCY_PACKAGE",{enumerable:true,get:function(){return chunkSUXRZWH2_cjs.j}});Object.defineProperty(exports,"DATETIME_PACKAGE",{enumerable:true,get:function(){return chunkSUXRZWH2_cjs.d}});Object.defineProperty(exports,"DICE_PACKAGE",{enumerable:true,get:function(){return chunkSUXRZWH2_cjs.f}});Object.defineProperty(exports,"FINANCE_PACKAGE",{enumerable:true,get:function(){return chunkSUXRZWH2_cjs.r}});Object.defineProperty(exports,"FUNCTION_PACKAGE",{enumerable:true,get:function(){return chunkSUXRZWH2_cjs.c}});Object.defineProperty(exports,"LINES_PACKAGE",{enumerable:true,get:function(){return chunkSUXRZWH2_cjs.v}});Object.defineProperty(exports,"MAPREDUCE_PACKAGE",{enumerable:true,get:function(){return chunkSUXRZWH2_cjs.m}});Object.defineProperty(exports,"MATHPHRASES_PACKAGE",{enumerable:true,get:function(){return chunkSUXRZWH2_cjs.q}});Object.defineProperty(exports,"MATRIX_PACKAGE",{enumerable:true,get:function(){return chunkSUXRZWH2_cjs.l}});Object.defineProperty(exports,"PERCENTAGE_PACKAGE",{enumerable:true,get:function(){return chunkSUXRZWH2_cjs.b}});Object.defineProperty(exports,"TABLES_PACKAGE",{enumerable:true,get:function(){return chunkSUXRZWH2_cjs.w}});Object.defineProperty(exports,"TAGS_PACKAGE",{enumerable:true,get:function(){return chunkSUXRZWH2_cjs.x}});Object.defineProperty(exports,"TIME_PACKAGE",{enumerable:true,get:function(){return chunkSUXRZWH2_cjs.e}});Object.defineProperty(exports,"UOM_PACKAGE",{enumerable:true,get:function(){return chunkSUXRZWH2_cjs.h}});Object.defineProperty(exports,"VARIABLES_PACKAGE",{enumerable:true,get:function(){return chunkSUXRZWH2_cjs.g}});Object.defineProperty(exports,"VECTOR_PACKAGE",{enumerable:true,get:function(){return chunkSUXRZWH2_cjs.k}});Object.defineProperty(exports,"WEATHER_PACKAGE",{enumerable:true,get:function(){return chunkSUXRZWH2_cjs.s}});Object.defineProperty(exports,"createCurrencyPackage",{enumerable:true,get:function(){return chunkSUXRZWH2_cjs.i}});Object.defineProperty(exports,"createKnowledgePackage",{enumerable:true,get:function(){return chunkSUXRZWH2_cjs.u}});Object.defineProperty(exports,"createStocksPackage",{enumerable:true,get:function(){return chunkSUXRZWH2_cjs.t}});Object.defineProperty(exports,"SYMBOLIC_PACKAGE",{enumerable:true,get:function(){return chunkSZGK6RIP_cjs.a}});//# sourceMappingURL=packages.cjs.map
129
2
  //# sourceMappingURL=packages.cjs.map
@@ -1,17 +1,16 @@
1
- import { I as IEnginePackage } from './PackageRegistry-BHWJP83F.cjs';
2
- import './Parselet-BHcgK9S7.cjs';
3
- import './BytecodeBuilder-Bp9xeTmX.cjs';
4
- import './Token-B1hdkedD.cjs';
5
- import './pipeline-CtfJtPQc.cjs';
6
- import './Value-BUi1RA3S.cjs';
7
- import './variables.cjs';
8
- import './Lexer-BOs7euZe.cjs';
1
+ import { I as IEnginePackage } from './PackageRegistry-dpdurBVO.cjs';
2
+ import './Parselet-C4Wu055_.cjs';
3
+ import './BytecodeBuilder-DGGeByAP.cjs';
4
+ import './Token-CbP_OutD.cjs';
5
+ import './pipeline-DCQicwWX.cjs';
6
+ import './Value-CCi_Eecs.cjs';
7
+ import './Lexer-B4C1qHXu.cjs';
9
8
  import './resolvers.cjs';
10
9
  import '@tanstack/query-core';
11
- import './TokenNormalizer-DRc1Js1V.cjs';
12
- import './ScopeManager-8vf02dwj.cjs';
13
- import './EngineError-B61GS1jp.cjs';
14
- import './Configuration-C9W8tJv_.cjs';
10
+ import './TokenNormalizer-DnlL7_8c.cjs';
11
+ import './ScopeManager-D7uMXbhS.cjs';
12
+ import './EngineError-Ce1lPkjZ.cjs';
13
+ import './Configuration-B6W0-T67.cjs';
15
14
 
16
15
  /** Core arithmetic: numbers, `()` grouping, `pi`/`e` constants, `+ - * / % ^`, bitwise `<< >> & | ^`, and their `*_by` word forms. */
17
16
  declare const ARITHMETIC_PACKAGE: IEnginePackage;
@@ -428,6 +427,16 @@ declare const MATHPHRASES_PACKAGE: IEnginePackage;
428
427
  * existing bare "between"/"from"/"next"/"last"/"best" keywords (see
429
428
  * Token.ts's OVER/RATE_AT doc comment).
430
429
  *
430
+ * "split", "ways" and "people" (the bill-split grammar) are likewise ordinary
431
+ * words and never bare keywords: BillSplitNormalizerRule claims them
432
+ * contextually, retyping to SPLIT/WAYS/PEOPLE only inside the full split shape,
433
+ * so `:split`, a variable named `split`, and prose are untouched. "between"
434
+ * reuses the pre-existing bare BETWEEN token (the accepted-risk category above).
435
+ *
436
+ * "how", "much", "save" and "reach" (the savings-goal phrases) are fused whole,
437
+ * "how long to save" and "how much per month to save"/"to reach", so none of
438
+ * those words becomes a bare keyword and `:save`/`:reach`/`:how` stay usable.
439
+ *
431
440
  * Inflation-adjusted value (extends this package, see
432
441
  * `parselets/InflationQueryParselet.ts`/`InflationFutureValueParselet.ts`/
433
442
  * `InYearDollarsParselet.ts` and `data/CpiTable.ts` for the bundled,
@@ -744,6 +753,22 @@ declare const LINES_PACKAGE: IEnginePackage;
744
753
  */
745
754
  declare const TABLES_PACKAGE: IEnginePackage;
746
755
 
756
+ /**
757
+ * Category tag sums: a mid-line `#tag` annotates a data line, and `total of
758
+ * #tag` / `sum of #tag` / `average of #tag` / `count of #tag` collect every line
759
+ * in the document carrying that tag, across the non-adjacent lines that
760
+ * `total above` and the table-column aggregates cannot reach.
761
+ *
762
+ * Collision-safety (this codebase's phrase-fusion-not-bare-keyword policy): the
763
+ * `#tag` token is claimed in the lexer only for a `#` directly followed by a
764
+ * letter mid-line, so `# ` (space) and `//` stay free-text comments and a
765
+ * line-start `#` stays a heading. The aggregate triggers reuse the math-phrase
766
+ * fusions (`total of`, `count of`, `average of`) and the raw `sum of`, so bare
767
+ * `total`/`sum`/`count`/`average` never become keywords and `:total = 5` is
768
+ * untouched.
769
+ */
770
+ declare const TAGS_PACKAGE: IEnginePackage;
771
+
747
772
  /**
748
773
  * Built-in packages.
749
774
  *
@@ -762,7 +787,7 @@ declare const TABLES_PACKAGE: IEnginePackage;
762
787
  /**
763
788
  * The packages an engine registers when the caller names none.
764
789
  *
765
- * Twenty-four of the twenty-six. Stocks and knowledge are excluded because
790
+ * Twenty-five of the twenty-seven. Stocks and knowledge are excluded because
766
791
  * both need a host-supplied data source and do nothing useful without one, so
767
792
  * registering them by default would only produce NOT_CONFIGURED results.
768
793
  *
@@ -792,4 +817,4 @@ interface IVector4 {
792
817
  w: number;
793
818
  }
794
819
 
795
- export { ARITHMETIC_PACKAGE, BIGINT_PACKAGE, BUILTIN_PACKAGES, CONDITIONALS_PACKAGE, CONVERTERS_PACKAGE, CURRENCY_PACKAGE, type CityWeather, type CurrencyPackageConfig, DATETIME_PACKAGE, DICE_PACKAGE, FINANCE_PACKAGE, FUNCTION_PACKAGE, type HistoricalRateProvider, type IVector2, type IVector3, type IVector4, type KnowledgePackageConfig, LINES_PACKAGE, MAPREDUCE_PACKAGE, MATHPHRASES_PACKAGE, MATRIX_PACKAGE, PERCENTAGE_PACKAGE, SYMBOLIC_PACKAGE, type StockHistoricalQuote, type StockQuote, type StocksPackageConfig, TABLES_PACKAGE, TIME_PACKAGE, UOM_PACKAGE, VARIABLES_PACKAGE, VECTOR_PACKAGE, WEATHER_PACKAGE, type WeatherQueryKind, createCurrencyPackage, createKnowledgePackage, createStocksPackage };
820
+ export { ARITHMETIC_PACKAGE, BIGINT_PACKAGE, BUILTIN_PACKAGES, CONDITIONALS_PACKAGE, CONVERTERS_PACKAGE, CURRENCY_PACKAGE, type CityWeather, type CurrencyPackageConfig, DATETIME_PACKAGE, DICE_PACKAGE, FINANCE_PACKAGE, FUNCTION_PACKAGE, type HistoricalRateProvider, type IVector2, type IVector3, type IVector4, type KnowledgePackageConfig, LINES_PACKAGE, MAPREDUCE_PACKAGE, MATHPHRASES_PACKAGE, MATRIX_PACKAGE, PERCENTAGE_PACKAGE, SYMBOLIC_PACKAGE, type StockHistoricalQuote, type StockQuote, type StocksPackageConfig, TABLES_PACKAGE, TAGS_PACKAGE, TIME_PACKAGE, UOM_PACKAGE, VARIABLES_PACKAGE, VECTOR_PACKAGE, WEATHER_PACKAGE, type WeatherQueryKind, createCurrencyPackage, createKnowledgePackage, createStocksPackage };