solve-engine 2.32.0 → 2.34.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 (226) hide show
  1. package/dist/{EngineError-CqGtaT_v.d.cts → EngineError-Bm4OYmw8.d.cts} +6 -0
  2. package/dist/{EngineError-CqGtaT_v.d.ts → EngineError-Bm4OYmw8.d.ts} +6 -0
  3. package/dist/{Lexer-CqFjYoRA.d.ts → Lexer-DPn5dfCH.d.ts} +1 -13
  4. package/dist/{Lexer-sCI05tqO.d.cts → Lexer-DaWkCu84.d.cts} +1 -13
  5. package/dist/{PackageCompatibility-phvSFP4f.d.ts → PackageCompatibility-CkzZfoJ3.d.ts} +1 -1
  6. package/dist/{PackageCompatibility-Bn-T_xKW.d.cts → PackageCompatibility-E_5GtcQW.d.cts} +1 -1
  7. package/dist/{PackageRegistry-C78jVkI9.d.ts → PackageRegistry-DSqic8kz.d.ts} +132 -23
  8. package/dist/{PackageRegistry-B-C1duZw.d.cts → PackageRegistry-js47hr28.d.cts} +132 -23
  9. package/dist/{Parselet-Dgymjxzd.d.ts → Parselet-CQjcHOKw.d.ts} +13 -6
  10. package/dist/{Parselet-DF3864la.d.cts → Parselet-s1sRRn8H.d.cts} +13 -6
  11. package/dist/{TokenNormalizer-Pe3_390t.d.cts → TokenNormalizer-D382VSYh.d.cts} +4 -1
  12. package/dist/{TokenNormalizer-IF7nPRMp.d.ts → TokenNormalizer-DAzPp-j1.d.ts} +4 -1
  13. package/dist/{VMBuiltins-BkKzhj6C.d.cts → VMBuiltins-JCavlQUj.d.cts} +53 -18
  14. package/dist/{VMBuiltins-Du9y8sEo.d.ts → VMBuiltins-qgzA6qGi.d.ts} +53 -18
  15. package/dist/{VMCheckpoints-WdUQrdc9.d.cts → VMCheckpoints-BxPzmdu0.d.cts} +2 -2
  16. package/dist/{VMCheckpoints-gvy_yxYh.d.ts → VMCheckpoints-DjjE92mf.d.ts} +2 -2
  17. package/dist/{Value-BYHw-x7q.d.cts → Value-2TIKi-YL.d.cts} +19 -0
  18. package/dist/{Value-BYHw-x7q.d.ts → Value-2TIKi-YL.d.ts} +19 -0
  19. package/dist/{WorkerError-DTrl3Jag.d.ts → WorkerError-BaN8_eok.d.ts} +1 -1
  20. package/dist/{WorkerError-CRoM8Ju1.d.cts → WorkerError-CexHHmbb.d.cts} +1 -1
  21. package/dist/{chunk-IJE4AEDX.js → chunk-24OW3AAU.js} +3 -3
  22. package/dist/{chunk-IJE4AEDX.js.map → chunk-24OW3AAU.js.map} +1 -1
  23. package/dist/{chunk-CAJTDZ5B.cjs → chunk-2XOLAHW6.cjs} +2 -2
  24. package/dist/{chunk-CAJTDZ5B.cjs.map → chunk-2XOLAHW6.cjs.map} +1 -1
  25. package/dist/{chunk-AGCNMEP2.cjs → chunk-3MG7VIPL.cjs} +2 -2
  26. package/dist/{chunk-AGCNMEP2.cjs.map → chunk-3MG7VIPL.cjs.map} +1 -1
  27. package/dist/chunk-4ASM522I.js +2 -0
  28. package/dist/chunk-4ASM522I.js.map +1 -0
  29. package/dist/{chunk-KH4QXKLT.js → chunk-4MD5L23F.js} +2 -2
  30. package/dist/{chunk-KH4QXKLT.js.map → chunk-4MD5L23F.js.map} +1 -1
  31. package/dist/{chunk-IQVSCL2R.js → chunk-4XWZXP6I.js} +3 -3
  32. package/dist/{chunk-IQVSCL2R.js.map → chunk-4XWZXP6I.js.map} +1 -1
  33. package/dist/{chunk-RELMEWY6.js → chunk-6G2NES2I.js} +2 -2
  34. package/dist/chunk-6G2NES2I.js.map +1 -0
  35. package/dist/{chunk-CDE2ZUGG.js → chunk-6NL7RBAG.js} +2 -2
  36. package/dist/{chunk-CDE2ZUGG.js.map → chunk-6NL7RBAG.js.map} +1 -1
  37. package/dist/{chunk-SUAGBRQ7.cjs → chunk-6SYU4MH7.cjs} +2 -2
  38. package/dist/chunk-6SYU4MH7.cjs.map +1 -0
  39. package/dist/chunk-72J5V7SN.cjs +2 -0
  40. package/dist/chunk-72J5V7SN.cjs.map +1 -0
  41. package/dist/{chunk-TSJ4RQLZ.js → chunk-AENL3Z66.js} +2 -2
  42. package/dist/{chunk-TSJ4RQLZ.js.map → chunk-AENL3Z66.js.map} +1 -1
  43. package/dist/chunk-APYRNAU2.js +2 -0
  44. package/dist/chunk-APYRNAU2.js.map +1 -0
  45. package/dist/{chunk-AXTYQFIV.cjs → chunk-D7URPV5Z.cjs} +3 -3
  46. package/dist/{chunk-AXTYQFIV.cjs.map → chunk-D7URPV5Z.cjs.map} +1 -1
  47. package/dist/chunk-DB5ISONG.js +2 -0
  48. package/dist/chunk-DB5ISONG.js.map +1 -0
  49. package/dist/chunk-DGDVY6XI.js +3 -0
  50. package/dist/chunk-DGDVY6XI.js.map +1 -0
  51. package/dist/chunk-EOKHRS2T.js +2 -0
  52. package/dist/chunk-EOKHRS2T.js.map +1 -0
  53. package/dist/{chunk-NQFCXLEF.js → chunk-EOO6M65F.js} +2 -2
  54. package/dist/{chunk-NQFCXLEF.js.map → chunk-EOO6M65F.js.map} +1 -1
  55. package/dist/{chunk-A764BY7L.cjs → chunk-EQNKDTMX.cjs} +2 -2
  56. package/dist/{chunk-A764BY7L.cjs.map → chunk-EQNKDTMX.cjs.map} +1 -1
  57. package/dist/chunk-FESR6PZI.cjs +2 -0
  58. package/dist/chunk-FESR6PZI.cjs.map +1 -0
  59. package/dist/chunk-G2LCDR52.cjs +3 -0
  60. package/dist/chunk-G2LCDR52.cjs.map +1 -0
  61. package/dist/chunk-G5TZ6TDA.js +2 -0
  62. package/dist/chunk-G5TZ6TDA.js.map +1 -0
  63. package/dist/chunk-GDLYXRMA.cjs +2 -0
  64. package/dist/chunk-GDLYXRMA.cjs.map +1 -0
  65. package/dist/{chunk-7DJYS5PO.cjs → chunk-HSTGWWU2.cjs} +2 -2
  66. package/dist/{chunk-7DJYS5PO.cjs.map → chunk-HSTGWWU2.cjs.map} +1 -1
  67. package/dist/{chunk-OE2DBN4K.js → chunk-INMJ7ZXL.js} +2 -2
  68. package/dist/chunk-INMJ7ZXL.js.map +1 -0
  69. package/dist/chunk-ITH2RLRG.js +5 -0
  70. package/dist/chunk-ITH2RLRG.js.map +1 -0
  71. package/dist/{chunk-5AKT36UK.cjs → chunk-K3PZ66XR.cjs} +2 -2
  72. package/dist/{chunk-5AKT36UK.cjs.map → chunk-K3PZ66XR.cjs.map} +1 -1
  73. package/dist/chunk-LI6LYJDA.cjs +2 -0
  74. package/dist/chunk-LI6LYJDA.cjs.map +1 -0
  75. package/dist/{chunk-WQGHJAW2.cjs → chunk-M4UC2PB6.cjs} +2 -2
  76. package/dist/{chunk-WQGHJAW2.cjs.map → chunk-M4UC2PB6.cjs.map} +1 -1
  77. package/dist/chunk-O7HF345B.js +2 -0
  78. package/dist/chunk-O7HF345B.js.map +1 -0
  79. package/dist/{chunk-CM2WM5CM.cjs → chunk-OBZJKZ2F.cjs} +2 -2
  80. package/dist/{chunk-CM2WM5CM.cjs.map → chunk-OBZJKZ2F.cjs.map} +1 -1
  81. package/dist/{chunk-Q7TBBV62.cjs → chunk-P5YWBIIU.cjs} +2 -2
  82. package/dist/chunk-P5YWBIIU.cjs.map +1 -0
  83. package/dist/chunk-PICFFFJV.js +3 -0
  84. package/dist/chunk-PICFFFJV.js.map +1 -0
  85. package/dist/{chunk-P43SV4NJ.cjs → chunk-QOOTRUY7.cjs} +3 -3
  86. package/dist/{chunk-P43SV4NJ.cjs.map → chunk-QOOTRUY7.cjs.map} +1 -1
  87. package/dist/chunk-R3W53ZMP.cjs +2 -0
  88. package/dist/chunk-R3W53ZMP.cjs.map +1 -0
  89. package/dist/chunk-RMDCGYZM.js +2 -0
  90. package/dist/chunk-RMDCGYZM.js.map +1 -0
  91. package/dist/{chunk-CB3EXUM2.js → chunk-RU3KGJRA.js} +2 -2
  92. package/dist/chunk-RU3KGJRA.js.map +1 -0
  93. package/dist/chunk-S3SPDK6N.cjs +2 -0
  94. package/dist/chunk-S3SPDK6N.cjs.map +1 -0
  95. package/dist/chunk-SF5QVUEI.cjs +3 -0
  96. package/dist/chunk-SF5QVUEI.cjs.map +1 -0
  97. package/dist/{chunk-FXB5GCBT.js → chunk-TJKN466F.js} +2 -2
  98. package/dist/{chunk-FXB5GCBT.js.map → chunk-TJKN466F.js.map} +1 -1
  99. package/dist/{chunk-VLX7ZVK4.js → chunk-U5MESNRT.js} +2 -2
  100. package/dist/{chunk-VLX7ZVK4.js.map → chunk-U5MESNRT.js.map} +1 -1
  101. package/dist/chunk-WCVPXBCW.cjs +5 -0
  102. package/dist/chunk-WCVPXBCW.cjs.map +1 -0
  103. package/dist/{chunk-YWF6C2IO.cjs → chunk-WFT3XUSH.cjs} +2 -2
  104. package/dist/{chunk-YWF6C2IO.cjs.map → chunk-WFT3XUSH.cjs.map} +1 -1
  105. package/dist/{chunk-3ZGFAE3Q.js → chunk-X2GQAKL2.js} +2 -2
  106. package/dist/{chunk-3ZGFAE3Q.js.map → chunk-X2GQAKL2.js.map} +1 -1
  107. package/dist/{chunk-G3POUURF.js → chunk-YID47OPR.js} +2 -2
  108. package/dist/{chunk-G3POUURF.js.map → chunk-YID47OPR.js.map} +1 -1
  109. package/dist/chunk-YV4GDW5A.cjs +2 -0
  110. package/dist/chunk-YV4GDW5A.cjs.map +1 -0
  111. package/dist/chunk-ZSXQP7PD.cjs +2 -0
  112. package/dist/chunk-ZSXQP7PD.cjs.map +1 -0
  113. package/dist/constants.cjs +1 -1
  114. package/dist/constants.js +1 -1
  115. package/dist/engine.cjs +1 -1
  116. package/dist/engine.d.cts +10 -10
  117. package/dist/engine.d.ts +10 -10
  118. package/dist/engine.js +1 -1
  119. package/dist/engine.worker.cjs +1 -1
  120. package/dist/engine.worker.cjs.map +1 -1
  121. package/dist/engine.worker.js +1 -1
  122. package/dist/engine.worker.js.map +1 -1
  123. package/dist/errors.cjs +1 -1
  124. package/dist/errors.d.cts +3 -3
  125. package/dist/errors.d.ts +3 -3
  126. package/dist/errors.js +1 -1
  127. package/dist/format.cjs +1 -1
  128. package/dist/format.d.cts +1 -1
  129. package/dist/format.d.ts +1 -1
  130. package/dist/format.js +1 -1
  131. package/dist/index.cjs +1 -1
  132. package/dist/index.cjs.map +1 -1
  133. package/dist/index.d.cts +10 -10
  134. package/dist/index.d.ts +10 -10
  135. package/dist/index.js +1 -1
  136. package/dist/index.js.map +1 -1
  137. package/dist/language.d.cts +9 -9
  138. package/dist/language.d.ts +9 -9
  139. package/dist/lexer.cjs +1 -1
  140. package/dist/lexer.d.cts +3 -3
  141. package/dist/lexer.d.ts +3 -3
  142. package/dist/lexer.js +1 -1
  143. package/dist/normalizer.cjs +1 -1
  144. package/dist/normalizer.d.cts +2 -2
  145. package/dist/normalizer.d.ts +2 -2
  146. package/dist/normalizer.js +1 -1
  147. package/dist/packages.cjs +1 -1
  148. package/dist/packages.d.cts +8 -8
  149. package/dist/packages.d.ts +8 -8
  150. package/dist/packages.js +1 -1
  151. package/dist/parser.cjs +1 -1
  152. package/dist/parser.d.cts +3 -3
  153. package/dist/parser.d.ts +3 -3
  154. package/dist/parser.js +1 -1
  155. package/dist/{pipeline-BYkKNpql.d.cts → pipeline-Bum6y1B9.d.cts} +1 -1
  156. package/dist/{pipeline-Cl7KW8CB.d.ts → pipeline-DOo3KHaq.d.ts} +1 -1
  157. package/dist/resolvers.cjs +1 -1
  158. package/dist/resolvers.d.cts +69 -3
  159. package/dist/resolvers.d.ts +69 -3
  160. package/dist/resolvers.js +1 -1
  161. package/dist/temporal.cjs +1 -1
  162. package/dist/temporal.js +1 -1
  163. package/dist/testing.cjs +2 -2
  164. package/dist/testing.cjs.map +1 -1
  165. package/dist/testing.d.cts +9 -9
  166. package/dist/testing.d.ts +9 -9
  167. package/dist/testing.js +1 -1
  168. package/dist/testing.js.map +1 -1
  169. package/dist/uom.cjs +1 -1
  170. package/dist/uom.d.cts +35 -2
  171. package/dist/uom.d.ts +35 -2
  172. package/dist/uom.js +1 -1
  173. package/dist/vm.cjs +1 -1
  174. package/dist/vm.d.cts +6 -6
  175. package/dist/vm.d.ts +6 -6
  176. package/dist/vm.js +1 -1
  177. package/dist/worker.cjs +2 -2
  178. package/dist/worker.cjs.map +1 -1
  179. package/dist/worker.d.cts +9 -9
  180. package/dist/worker.d.ts +9 -9
  181. package/dist/worker.js +1 -1
  182. package/dist/worker.js.map +1 -1
  183. package/package.json +1 -1
  184. package/dist/chunk-4DR5RBHQ.cjs +0 -2
  185. package/dist/chunk-4DR5RBHQ.cjs.map +0 -1
  186. package/dist/chunk-4IC5OARK.js +0 -3
  187. package/dist/chunk-4IC5OARK.js.map +0 -1
  188. package/dist/chunk-7ODHPWQC.js +0 -5
  189. package/dist/chunk-7ODHPWQC.js.map +0 -1
  190. package/dist/chunk-A755LVPT.cjs +0 -2
  191. package/dist/chunk-A755LVPT.cjs.map +0 -1
  192. package/dist/chunk-AF6NDOIE.js +0 -2
  193. package/dist/chunk-AF6NDOIE.js.map +0 -1
  194. package/dist/chunk-B2NL65FI.js +0 -2
  195. package/dist/chunk-B2NL65FI.js.map +0 -1
  196. package/dist/chunk-CB3EXUM2.js.map +0 -1
  197. package/dist/chunk-DUFEONVN.cjs +0 -3
  198. package/dist/chunk-DUFEONVN.cjs.map +0 -1
  199. package/dist/chunk-IJHL3LMH.js +0 -2
  200. package/dist/chunk-IJHL3LMH.js.map +0 -1
  201. package/dist/chunk-LCYQQFUH.cjs +0 -2
  202. package/dist/chunk-LCYQQFUH.cjs.map +0 -1
  203. package/dist/chunk-LP3JYC3A.js +0 -2
  204. package/dist/chunk-LP3JYC3A.js.map +0 -1
  205. package/dist/chunk-OE2DBN4K.js.map +0 -1
  206. package/dist/chunk-OKKGPINQ.cjs +0 -5
  207. package/dist/chunk-OKKGPINQ.cjs.map +0 -1
  208. package/dist/chunk-OM7NOHJF.cjs +0 -2
  209. package/dist/chunk-OM7NOHJF.cjs.map +0 -1
  210. package/dist/chunk-PTXUWGRR.js +0 -3
  211. package/dist/chunk-PTXUWGRR.js.map +0 -1
  212. package/dist/chunk-Q7TBBV62.cjs.map +0 -1
  213. package/dist/chunk-RELMEWY6.js.map +0 -1
  214. package/dist/chunk-SFM4XFGJ.js +0 -2
  215. package/dist/chunk-SFM4XFGJ.js.map +0 -1
  216. package/dist/chunk-SRAU3BLV.cjs +0 -3
  217. package/dist/chunk-SRAU3BLV.cjs.map +0 -1
  218. package/dist/chunk-SUAGBRQ7.cjs.map +0 -1
  219. package/dist/chunk-UNKZ5XRC.cjs +0 -2
  220. package/dist/chunk-UNKZ5XRC.cjs.map +0 -1
  221. package/dist/chunk-WU7SBKVU.cjs +0 -2
  222. package/dist/chunk-WU7SBKVU.cjs.map +0 -1
  223. package/dist/chunk-X5K72MBV.js +0 -2
  224. package/dist/chunk-X5K72MBV.js.map +0 -1
  225. package/dist/chunk-ZVPZQ66D.cjs +0 -2
  226. package/dist/chunk-ZVPZQ66D.cjs.map +0 -1
@@ -1,2 +0,0 @@
1
- 'use strict';var chunkYBQOQTVL_cjs=require('./chunk-YBQOQTVL.cjs'),chunkS3DFU33X_cjs=require('./chunk-S3DFU33X.cjs'),chunkJ4LSAHCY_cjs=require('./chunk-J4LSAHCY.cjs'),chunkSUAGBRQ7_cjs=require('./chunk-SUAGBRQ7.cjs');chunkYBQOQTVL_cjs.e();var x=chunkYBQOQTVL_cjs.c("BACKTICK_OPEN"),Q=chunkYBQOQTVL_cjs.c("BIGINT"),P=chunkYBQOQTVL_cjs.c("COMMENT"),A=chunkYBQOQTVL_cjs.c("CURRENCY_SYMBOL"),N=chunkYBQOQTVL_cjs.c("DOLLAR"),g=chunkYBQOQTVL_cjs.c("DOT"),v=chunkYBQOQTVL_cjs.c("EURO"),$=chunkYBQOQTVL_cjs.c("HEX_COLOUR"),b=chunkYBQOQTVL_cjs.c("IDENT"),j=chunkYBQOQTVL_cjs.c("INLINE_SOLVE_START"),q=chunkYBQOQTVL_cjs.c("LSHIFT"),U=chunkYBQOQTVL_cjs.c("MINUS"),_=chunkYBQOQTVL_cjs.c("NEQ"),I=chunkYBQOQTVL_cjs.c("NUMBER"),M=chunkYBQOQTVL_cjs.c("PLUS_MINUS"),B=chunkYBQOQTVL_cjs.c("POUND"),X=chunkYBQOQTVL_cjs.c("RSHIFT"),D=chunkYBQOQTVL_cjs.c("RUBLE"),H=chunkYBQOQTVL_cjs.c("SLASH"),Y=chunkYBQOQTVL_cjs.c("STAR"),J=chunkYBQOQTVL_cjs.c("STRING"),Z=chunkYBQOQTVL_cjs.c("TAG"),K=chunkYBQOQTVL_cjs.c("UNIT"),ee=chunkYBQOQTVL_cjs.c("URSHIFT"),F=chunkYBQOQTVL_cjs.c("WON"),G=chunkYBQOQTVL_cjs.c("YEN");function te(){let c=new Uint8Array(128);for(let t=48;t<=57;t++)c[t]=2;for(let t=65;t<=90;t++)c[t]=3;for(let t=97;t<=122;t++)c[t]=3;return c[95]=3,c[46]=4,c[32]=1,c[9]=1,c[10]=1,c[13]=1,c[33]=5,c[37]=5,c[38]=5,c[40]=5,c[41]=5,c[42]=5,c[43]=5,c[44]=5,c[45]=5,c[47]=5,c[58]=5,c[59]=5,c[60]=5,c[61]=5,c[62]=5,c[63]=5,c[91]=5,c[93]=5,c[94]=5,c[123]=5,c[124]=5,c[125]=5,c[126]=5,c[64]=5,c[34]=6,c[35]=7,c[36]=8,c[96]=11,c}function E(c){return c===133||c===160||c===5760||c>=8192&&c<=8202||c===8203||c===8232||c===8233||c===8239||c===8287||c===12288||c===65279}var l=class{constructor(t,i,e,s,n,r,o,h,a,u){this.type=t;this.typeId=i;this.value=e;this.text=s;this.offset=n;this.lineBreaks=r;this.line=o;this.col=h;this.sourceEnd=a;this.fault=u;}},W={61:{61:"EQUALITY",62:"THEREFORE"},33:{61:"NEQ"},62:{61:"GTE"},60:{61:"LTE"},38:{38:"LOGICAL_AND"},124:{124:"LOGICAL_OR"},43:{61:"PLUS_EQUALS"},45:{61:"MINUS_EQUALS"}},z={43:"PLUS",45:"MINUS",42:"STAR",47:"SLASH",94:"CARET",37:"PERCENT",40:"LPAREN",41:"RPAREN",91:"LBRACKET",93:"RBRACKET",123:"LBRACE",125:"RBRACE",44:"COMMA",58:"COLON",59:"SEMICOLON",61:"EQUALS",63:"QUESTION",33:"BANG",38:"BIT_AND",124:"BIT_OR",60:"LT",62:"GT",126:"BIT_NOT",64:"AT"},se=(()=>{let c=new Set;for(let i=48;i<=57;i++)c.add(i);let t=[43,45,42,47,94,37,40,41,91,93,123,125,61,60,62,33,38,124,126,59,63];for(let i of t)c.add(i);return c.add(36),c.add(163),c.add(8364),c.add(165),c.add(8381),c.add(8361),c.add(96),c.add(46),c.add(35),c})(),R=class R{constructor(t="en",i){this.input="";this.pos=0;this.len=0;this.line=1;this.lineStartPos=0;this.groupingStack=[];this.pluginKeywordOwners=new Map;this.pluginUnitOwners=new Map;this.pluginOperatorOwners=new Map;this.pluginOperators=new Map;this.pluginUnits=new Set;this.hasPluginOps=false;this._inlineSolveSpans=[];this.pluginRawLinePatterns=[];this.pendingRawLineToken=null;this.localeCode=t,this.locale=chunkS3DFU33X_cjs.a(t),this.keywordMap=new Map;for(let[e,s]of Object.entries(this.locale.keywordMap))this.keywordMap.set(e.toLowerCase(),s);this.mergedKeywords=new Map(this.keywordMap),this.mergedUnits=chunkJ4LSAHCY_cjs.a;}matchRawLine(t){for(let i of this.pluginRawLinePatterns){let e=i.pattern.exec(t);if(e&&typeof e[1]=="string"){let s=e[1].trim();if(s.length>0)return new l(i.tokenType,chunkYBQOQTVL_cjs.c(i.tokenType),s,s,0,0,this.line,1)}}return null}rebuildMergedUnits(){this.mergedUnits=this.pluginUnits.size===0?chunkJ4LSAHCY_cjs.a:new Set([...chunkJ4LSAHCY_cjs.a,...this.pluginUnits]);}registerVocabulary(t){if(t.keywords)for(let i of Object.keys(t.keywords)){let e=i.toLowerCase();if(this.keywordMap.has(e))throw chunkSUAGBRQ7_cjs.c.config("PLUGIN_KEYWORD_COLLISION",`Plugin keyword "${i}" conflicts with built-in keyword (type: ${this.keywordMap.get(e)}). Built-in keywords cannot be overridden.`,{keyword:i,builtinType:this.keywordMap.get(e)})}if(t.operators){for(let i of Object.keys(t.operators))if(i.length===2){let e=i.charCodeAt(0),s=i.charCodeAt(1),n=W[e];if(n&&n[s]!==void 0)throw chunkSUAGBRQ7_cjs.c.config("PLUGIN_OPERATOR_COLLISION",`Plugin operator "${i}" conflicts with built-in operator (type: ${n[s]}). Built-in operators cannot be overridden.`,{operator:i,builtinType:n[s]});if(e===60&&s===60)throw chunkSUAGBRQ7_cjs.c.config("PLUGIN_OPERATOR_COLLISION",`Plugin operator "${i}" conflicts with built-in operator (type: LSHIFT). Built-in operators cannot be overridden.`,{operator:i,builtinType:"LSHIFT"});if(e===62&&s===62)throw chunkSUAGBRQ7_cjs.c.config("PLUGIN_OPERATOR_COLLISION",`Plugin operator "${i}" conflicts with built-in operator (type: RSHIFT). Built-in operators cannot be overridden.`,{operator:i,builtinType:"RSHIFT"});if(e===47&&s===47)throw chunkSUAGBRQ7_cjs.c.config("PLUGIN_OPERATOR_COLLISION",`Plugin operator "${i}" conflicts with built-in comment sequence. Comment sequences cannot be overridden.`,{operator:i,builtinType:"COMMENT"})}}if(t.units){for(let i of t.units)if(chunkJ4LSAHCY_cjs.a.has(i))throw chunkSUAGBRQ7_cjs.c.config("PLUGIN_UNIT_COLLISION",`Plugin unit "${i}" conflicts with a built-in unit. Built-in units cannot be overridden.`,{unit:i})}if(t.keywords)for(let[i,e]of Object.entries(t.keywords)){let s=i.toLowerCase();this.claim(this.pluginKeywordOwners,s,t,e),this.mergedKeywords.set(s,e);}if(t.operators){this.hasPluginOps=true;for(let[i,e]of Object.entries(t.operators))if(i.length===2){let s=i.charCodeAt(0),n=i.charCodeAt(1);this.claim(this.pluginOperatorOwners,s*65536+n,t,e);let r=this.pluginOperators.get(s);r||(r=new Map,this.pluginOperators.set(s,r)),r.set(n,e);}}if(t.units){for(let i of t.units){let e=this.pluginUnitOwners.get(i);e?e.push(t):this.pluginUnitOwners.set(i,[t]),this.pluginUnits.add(i);}this.rebuildMergedUnits();}t.rawLinePatterns&&this.pluginRawLinePatterns.push(...t.rawLinePatterns);}claim(t,i,e,s){let n=t.get(i);n?n.push({owner:e,tokenType:s}):t.set(i,[{owner:e,tokenType:s}]);}release(t,i,e){let s=t.get(i);if(!s)return;let n=s.filter(r=>r.owner!==e);if(n.length===0){t.delete(i);return}return t.set(i,n),n[n.length-1]}unregisterVocabulary(t){if(t.keywords)for(let i of Object.keys(t.keywords)){let e=i.toLowerCase(),s=this.release(this.pluginKeywordOwners,e,t);s?this.mergedKeywords.set(e,s.tokenType):this.mergedKeywords.delete(e);}if(t.operators){for(let i of Object.keys(t.operators))if(i.length===2){let e=i.charCodeAt(0),s=i.charCodeAt(1),n=this.release(this.pluginOperatorOwners,e*65536+s,t),r=this.pluginOperators.get(e);if(!r)continue;if(n){r.set(s,n.tokenType);continue}r.delete(s),r.size===0&&this.pluginOperators.delete(e);}this.hasPluginOps=this.pluginOperators.size>0;}if(t.units){for(let i of t.units){let e=this.pluginUnitOwners.get(i);if(!e)continue;let s=e.filter(n=>n!==t);if(s.length>0){this.pluginUnitOwners.set(i,s);continue}this.pluginUnitOwners.delete(i),this.pluginUnits.delete(i);}this.rebuildMergedUnits();}if(t.rawLinePatterns){let i=new Set(t.rawLinePatterns);this.pluginRawLinePatterns=this.pluginRawLinePatterns.filter(e=>!i.has(e));}}reset(t){this.input=t,this.pos=0,this.len=t.length,this.line=1,this.lineStartPos=0,this.pendingRawLineToken=this.pluginRawLinePatterns.length>0?this.matchRawLine(t):null;}scanDocument(t){this.input=t,this.pos=0,this.len=t.length,this.line=1,this.lineStartPos=0;let i=[],e=this.input,s=this.len;for(;this.pos<s;){let n=this.pos,r=this.pos;for(;r<s;){let C=e.charCodeAt(r);if(C===10||C===13)break;r++;}let o=this.line,h=this.classifyFromPositions(n,r),a=e.slice(n,r),u=[],f;if(!h.skip){let C=this.pluginRawLinePatterns.length>0?this.matchRawLine(a):null;if(C)u=[C];else {let w=this.len;this.len=r,h.contentOffset!==void 0&&(this.pos=h.contentOffset);try{this.tokenizeInto(u);}catch(S){if(!(S instanceof chunkSUAGBRQ7_cjs.b))throw S;f=S,u=[],this._inlineSolveSpans=[],this.line=o;}finally{this.len=w;}}}let p=[];if(h.hasInlineSolve)if(!h.skip&&u.length>0){let C=this.findInlineSolves(a);p=this._inlineSolveSpans.map((w,S)=>({start:C[S]?.start??0,end:C[S]?.end??0,expression:C[S]?.expression??"",columnNumber:C[S]?.columnNumber??w.columnNumber,startTokenIndex:w.startTokenIndex,endTokenIndex:w.endTokenIndex}));}else p=this.findInlineSolves(a);let T={text:a,lineNumber:o,startOffset:n,endOffset:r,classification:h,tokens:u,inlineSolves:p};if(f&&(T.error=f),i.push(T),this.pos=r,this.pos<s){let C=e.charCodeAt(this.pos);C===13?(this.pos++,this.pos<s&&e.charCodeAt(this.pos)===10&&this.pos++):C===10&&this.pos++;}this.line++,this.lineStartPos=this.pos;}return i}tokenizeAll(){if(this.pendingRawLineToken)return this._inlineSolveSpans=[],[this.pendingRawLineToken];let t=[];return this.tokenizeInto(t),t}tokenizeInto(t){let i=this.len;if(i===0){this._inlineSolveSpans=[];return}let e=0,s=null,n=[];if(i===1){let o=this.input.charCodeAt(0);switch(R.CHAR_CLASS[o]??0){case 2:t.push(new l("NUMBER",I,this.input,this.input,0,0,1,1)),e++;break;case 4:t.push(new l("DOT",g,".",".",0,0,1,1)),e++;break;case 3:{let a=this.input,u=a.toLowerCase();if(this.mergedUnits.has(a))t.push(new l("UNIT",K,a,a,0,0,1,1));else {let f=this.mergedKeywords.get(u);f?t.push(new l(f,chunkYBQOQTVL_cjs.c(f),a,a,0,0,1,1)):t.push(new l("IDENT",b,a,a,0,0,1,1));}e++;break}case 5:{let a=z[o];a&&(t.push(new l(a,chunkYBQOQTVL_cjs.c(a),this.input,this.input,0,0,1,1)),e++);break}case 6:this.pos=0,t.push(this.tokenizeString()),e++;break;case 7:this.pos=0,t.push(this.tokenizeComment()),e++;break;case 8:t.push(new l("DOLLAR",N,"$","$",0,0,1,1)),e++;break;case 11:t.push(new l("BACKTICK_OPEN",x,"`","`",0,0,1,1)),e++;break;default:{E(o)||(o===215?(t.push(new l("STAR",Y,"\xD7","\xD7",0,0,1,1)),e++):o===247?(t.push(new l("SLASH",H,"\xF7","\xF7",0,0,1,1)),e++):o===177?(t.push(new l("PLUS_MINUS",M,"\xB1","\xB1",0,0,1,1)),e++):o===8800?(t.push(new l("NEQ",_,"\u2260","\u2260",0,0,1,1)),e++):o===163?(t.push(new l("POUND",B,"\xA3","\xA3",0,0,1,1)),e++):o===8364?(t.push(new l("EURO",v,"\u20AC","\u20AC",0,0,1,1)),e++):o===165?(t.push(new l("YEN",G,"\xA5","\xA5",0,0,1,1)),e++):o===8381?(t.push(new l("RUBLE",D,"\u20BD","\u20BD",0,0,1,1)),e++):o===8361?(t.push(new l("WON",F,"\u20A9","\u20A9",0,0,1,1)),e++):o===8377?(t.push(new l("CURRENCY_SYMBOL",A,"\u20B9","\u20B9",0,0,1,1)),e++):o===8378?(t.push(new l("CURRENCY_SYMBOL",A,"\u20BA","\u20BA",0,0,1,1)),e++):o===8372?(t.push(new l("CURRENCY_SYMBOL",A,"\u20B4","\u20B4",0,0,1,1)),e++):o===8362?(t.push(new l("CURRENCY_SYMBOL",A,"\u20AA","\u20AA",0,0,1,1)),e++):o===8363?(t.push(new l("CURRENCY_SYMBOL",A,"\u20AB","\u20AB",0,0,1,1)),e++):o===8358?(t.push(new l("CURRENCY_SYMBOL",A,"\u20A6","\u20A6",0,0,1,1)),e++):o===8369?(t.push(new l("CURRENCY_SYMBOL",A,"\u20B1","\u20B1",0,0,1,1)),e++):o===8722||o===8211?(t.push(new l("MINUS",U,this.input,this.input,0,0,1,1)),e++):o>=128&&(t.push(new l("IDENT",b,this.input,this.input,0,0,1,1)),e++));break}}this._inlineSolveSpans=n;return}let r=this.input;for(this.groupingStack.length=0;this.pos<i;){let o=r.charCodeAt(this.pos),h=R.CHAR_CLASS[o]??0;if(s&&o===92&&this.pos+1<i&&r.charCodeAt(this.pos+1)===96){this.pos+=2;continue}switch(h){case 1:this.pos++,o===10?(this.line++,this.lineStartPos=this.pos,this.groupingStack.length=0):o===13&&(this.line++,this.pos<i&&r.charCodeAt(this.pos)===10&&this.pos++,this.lineStartPos=this.pos,this.groupingStack.length=0);break;case 2:t.push(this.tokenizeNumber()),e++;break;case 3:{let a=this.tokenizeIdentifier();a.type==="INLINE_SOLVE_START"&&(s={startTokenIndex:e,startColumn:a.col}),t.push(a),e++;break}case 4:if(this.pos+1<i)if((R.CHAR_CLASS[r.charCodeAt(this.pos+1)]??0)===2)t.push(this.tokenizeNumber());else {let u=this.pos-this.lineStartPos+1;t.push(new l("DOT",g,".",".",this.pos,0,this.line,u)),this.pos++;}else {let a=this.pos-this.lineStartPos+1;t.push(new l("DOT",g,".",".",this.pos,0,this.line,a)),this.pos++;}e++;break;case 5:t.push(this.tokenizeOperator()),e++;break;case 6:t.push(this.tokenizeString()),e++;break;case 7:t.push(this.tokenizeComment()),e++;break;case 8:{let a=this.pos-this.lineStartPos+1;t.push(new l("DOLLAR",N,"$","$",this.pos,0,this.line,a)),this.pos++,e++;break}case 11:{let a=this.pos-this.lineStartPos+1;if(t.push(new l("BACKTICK_OPEN",x,"`","`",this.pos,0,this.line,a)),this.pos++,s){let u=s;n.push({start:0,end:0,expression:"",columnNumber:u.startColumn,startTokenIndex:u.startTokenIndex,endTokenIndex:e}),s=null;}e++;break}default:{let a=this.pos-this.lineStartPos+1;if(E(o))this.pos++,(o===8232||o===8233||o===133)&&(this.line++,this.lineStartPos=this.pos);else if(o===215)t.push(new l("STAR",Y,"\xD7","\xD7",this.pos,0,this.line,a)),this.pos++,e++;else if(o===247)t.push(new l("SLASH",H,"\xF7","\xF7",this.pos,0,this.line,a)),this.pos++,e++;else if(o===177)t.push(new l("PLUS_MINUS",M,"\xB1","\xB1",this.pos,0,this.line,a)),this.pos++,e++;else if(o===8800)t.push(new l("NEQ",_,"\u2260","\u2260",this.pos,0,this.line,a)),this.pos++,e++;else if(o===163)t.push(new l("POUND",B,"\xA3","\xA3",this.pos,0,this.line,a)),this.pos++,e++;else if(o===8364)t.push(new l("EURO",v,"\u20AC","\u20AC",this.pos,0,this.line,a)),this.pos++,e++;else if(o===165)t.push(new l("YEN",G,"\xA5","\xA5",this.pos,0,this.line,a)),this.pos++,e++;else if(o===8381)t.push(new l("RUBLE",D,"\u20BD","\u20BD",this.pos,0,this.line,a)),this.pos++,e++;else if(o===8361)t.push(new l("WON",F,"\u20A9","\u20A9",this.pos,0,this.line,a)),this.pos++,e++;else if(o===8377)t.push(new l("CURRENCY_SYMBOL",A,"\u20B9","\u20B9",this.pos,0,this.line,a)),this.pos++,e++;else if(o===8378)t.push(new l("CURRENCY_SYMBOL",A,"\u20BA","\u20BA",this.pos,0,this.line,a)),this.pos++,e++;else if(o===8372)t.push(new l("CURRENCY_SYMBOL",A,"\u20B4","\u20B4",this.pos,0,this.line,a)),this.pos++,e++;else if(o===8362)t.push(new l("CURRENCY_SYMBOL",A,"\u20AA","\u20AA",this.pos,0,this.line,a)),this.pos++,e++;else if(o===8363)t.push(new l("CURRENCY_SYMBOL",A,"\u20AB","\u20AB",this.pos,0,this.line,a)),this.pos++,e++;else if(o===8358)t.push(new l("CURRENCY_SYMBOL",A,"\u20A6","\u20A6",this.pos,0,this.line,a)),this.pos++,e++;else if(o===8369)t.push(new l("CURRENCY_SYMBOL",A,"\u20B1","\u20B1",this.pos,0,this.line,a)),this.pos++,e++;else if(o===8722||o===8211){let u=this.input[this.pos];t.push(new l("MINUS",U,u,u,this.pos,0,this.line,a)),this.pos++,e++;}else o>=128?(t.push(this.tokenizeIdentifier()),e++):this.pos++;break}}}this._inlineSolveSpans=n;}*[Symbol.iterator](){let t=[];this.tokenizeInto(t),yield*t;}tokenizeNumber(){let t=this.input,i=this.len,e=this.pos,s=e,n=e-this.lineStartPos+1,r;if(t.charCodeAt(e)===48&&e+1<i){let f=t.charCodeAt(e+1);if(f===120||f===88){for(e+=2;e<i&&(r=t.charCodeAt(e),r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102);)e++;let p=t.slice(s,e);return this.pos=e,new l("NUMBER",I,p,p,s,0,this.line,n)}if(f===98||f===66){for(e+=2;e<i&&(r=t.charCodeAt(e),r===48||r===49);)e++;let p=t.slice(s,e);return this.pos=e,new l("NUMBER",I,p,p,s,0,this.line,n)}if(f===111||f===79){for(e+=2;e<i&&(r=t.charCodeAt(e),r>=48&&r<=55);)e++;let p=t.slice(s,e);return this.pos=e,new l("NUMBER",I,p,p,s,0,this.line,n)}}let o=false;for(;e<i&&(r=t.charCodeAt(e),r>=48&&r<=57);)o=true,e++;for(;o&&e<i&&(t.charCodeAt(e)===44||t.charCodeAt(e)===46)&&!(t.charCodeAt(e)===44&&this.groupingStack.length>0&&this.groupingStack[this.groupingStack.length-1]);){if(e+4<=i){let f=t.charCodeAt(e+1),p=t.charCodeAt(e+2),T=t.charCodeAt(e+3),C=e+4<i?t.charCodeAt(e+4):-1,w=!(C>=48&&C<=57);if(f>=48&&f<=57&&p>=48&&p<=57&&T>=48&&T<=57&&w){e+=4,o=true;continue}}break}let h=false;if(e<i&&t.charCodeAt(e)===46&&e+1<i){let f=t.charCodeAt(e+1);if(f>=48&&f<=57)for(h=true,e++;e<i&&(r=t.charCodeAt(e),r>=48&&r<=57);)e++;}let a=false;if(e<i){let f=t.charCodeAt(e);if((f===101||f===69)&&e+1<i){let p=t.charCodeAt(e+1);if(p>=48&&p<=57||p===43||p===45)for(a=true,e++,(p===43||p===45)&&e++;e<i&&(r=t.charCodeAt(e),r>=48&&r<=57);)e++;}}if(e<i&&t.charCodeAt(e)===110&&o&&!h&&!a){e++;let f=t.slice(s,e);return this.pos=e,new l("BIGINT",Q,f,f,s,0,this.line,n)}let u=t.slice(s,e);return this.pos=e,new l("NUMBER",I,u,u,s,0,this.line,n)}tokenizeIdentifier(){let t=this.input,i=this.len,e=this.pos,s=e,n=e-this.lineStartPos+1,r;for(;e<i&&(r=t.charCodeAt(e),r>=48&&r<=57||r>=65&&r<=90||r>=97&&r<=122||r===95||r>=128&&!E(r));)e++;let o=t.slice(s,e),h=o.toLowerCase();if(h==="s"&&e<i&&t.charCodeAt(e)===96){e++,this.pos=e;let f=t.slice(s,e);return new l("INLINE_SOLVE_START",j,f,f,s,0,this.line,n)}if(this.mergedUnits.has(o)&&!this.isFollowedByLParen(e))return this.pos=e,new l("UNIT",K,o,o,s,0,this.line,n);let u=this.mergedKeywords.get(h);return u?(this.pos=e,new l(u,chunkYBQOQTVL_cjs.c(u),o,o,s,0,this.line,n)):(this.pos=e,new l("IDENT",b,o,o,s,0,this.line,n))}isFollowedByLParen(t){let i=this.len,e=t;for(;e<i;){let s=this.input.charCodeAt(e);if(s===40)return true;if(s!==32&&s!==9)break;e++;}return false}precededByCallTarget(t){let i=this.input,e=this.lineStartPos,s=t-1;for(;s>=e&&(i.charCodeAt(s)===32||i.charCodeAt(s)===9);)s--;if(s<e)return false;let n=i.charCodeAt(s),r=p=>p>=48&&p<=57||p>=65&&p<=90||p>=97&&p<=122||p===95,o=p=>p>=65&&p<=90||p>=97&&p<=122||p===95;if(!r(n))return false;let h=s+1,a=false;for(;s>=e;){let p=i.charCodeAt(s);if(!r(p))break;o(p)&&(a=true),s--;}if(!a)return false;let u=i.slice(s+1,h).toLowerCase(),f=this.mergedKeywords.get(u);return f===void 0||f==="FUNC"}tokenizeOperator(){let t=this.input,i=this.pos,e=i-this.lineStartPos+1,s=t.charCodeAt(i),n=this.len;if(i+1<n){let h=t.charCodeAt(i+1),a=W[s];if(a){let u=a[h];if(u){let f=t.slice(i,i+2);return this.pos=i+2,new l(u,chunkYBQOQTVL_cjs.c(u),f,f,i,0,this.line,e)}}if(s===47&&h===47){let u=i+2;for(;u<n;){let p=t.charCodeAt(u);if(p===10||p===13)break;u++;}let f=t.slice(i,u);return this.pos=u,new l("COMMENT",P,f,f,i,0,this.line,e)}if(s===60&&h===60)return this.pos=i+2,new l("LSHIFT",q,"<<","<<",i,0,this.line,e);if(s===62&&h===62)return t.charCodeAt(i+2)===62?(this.pos=i+3,new l("URSHIFT",ee,">>>",">>>",i,0,this.line,e)):(this.pos=i+2,new l("RSHIFT",X,">>",">>",i,0,this.line,e));if(this.hasPluginOps){let u=this.pluginOperators.get(s);if(u){let f=u.get(h);if(f){let p=t.slice(i,i+2);return this.pos=i+2,new l(f,chunkYBQOQTVL_cjs.c(f),p,p,i,0,this.line,e)}}}}this.pos=i+1,s===91?this.groupingStack.push(true):s===40?this.groupingStack.push(this.precededByCallTarget(i)):(s===41||s===93)&&this.groupingStack.length>0&&this.groupingStack.pop();let r=z[s],o=t.charAt(i);return new l(r||"ERROR",chunkYBQOQTVL_cjs.c(r||"ERROR"),o,o,i,0,this.line,e)}tokenizeString(){let t=this.input,i=this.len,e=this.pos,s=e-this.lineStartPos+1,n=e+1,r=0;for(;n<i;){let o=t.charCodeAt(n);if(o===34){n++;let h=t.slice(e,n),a=t.slice(e+1,n-1);return this.pos=n,new l("STRING",J,a,h,e,r,this.line,s)}if(o===92&&n+1<i){n+=2;continue}o===10&&(this.line++,this.lineStartPos=n+1,r++),n++;}throw this.pos=n,chunkSUAGBRQ7_cjs.c.parsing("UNTERMINATED_STRING",`Unterminated string literal: ${t.slice(e,n)}`,{literal:t.slice(e,n),offset:e})}static hasExpressionIndicators(t,i,e){let s=se;for(let n=i;n<e;n++){let r=t.charCodeAt(n);if(s.has(r)||r>=128&&(r===215||r===247||r===8800||r===163||r===8364||r===165||r===8381||r===8361))return true}return false}skipMarkerGap(t,i){let e=this.input,s=t;for(;s<i&&(e.charCodeAt(s)===32||e.charCodeAt(s)===9);)s++;if(s+2<i&&e.charCodeAt(s)===91&&e.charCodeAt(s+2)===93){let n=s+3;for(;n<i&&(e.charCodeAt(n)===32||e.charCodeAt(n)===9);)n++;if(n>s+3)return n}return s}matchHexColourEnd(t,i){let e=this.input,s=t+1,n=0;for(;s<i;){let r=e.charCodeAt(s);if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))break;n++,s++;}if(n!==3&&n!==4&&n!==6&&n!==8)return -1;if(s<i){let r=e.charCodeAt(s);if(r>=48&&r<=57||r>=65&&r<=90||r>=97&&r<=122||r===95)return -1}return s}hasInlineSolveWithin(t,i){let e=this.input,s=i-1;for(let n=t;n<s;n++)if(e.charCodeAt(n)===115&&e.charCodeAt(n+1)===96)return true;return false}indexOfWithin(t,i,e){let s=this.input,n=e-t.length,r=t.charCodeAt(0);for(let o=i;o<=n;o++){if(s.charCodeAt(o)!==r)continue;let h=1;for(;h<t.length&&s.charCodeAt(o+h)===t.charCodeAt(h);)h++;if(h===t.length)return o}return -1}classifyFromPositions(t,i){let e=i;if(t>=e)return {type:"empty",skip:true,hasInlineSolve:false};let s=this.input,n=t;for(;n<e;){let h=s.charCodeAt(n);if(h!==32&&h!==9)break;n++;}if(n>=e)return {type:"empty",skip:true,hasInlineSolve:false};let r=s.charCodeAt(n),o;if(r===35){if(this.matchHexColourEnd(n,e)!==-1)return o===void 0&&(o=this.hasInlineSolveWithin(n,e)),{type:"expression",skip:false,hasInlineSolve:o};let h=1;for(;n+h<e&&s.charCodeAt(n+h)===35;)h++;return h<=6&&n+h<e&&s.charCodeAt(n+h)===32?{type:"heading",skip:true,hasInlineSolve:false}:{type:"heading",skip:true,hasInlineSolve:false}}if(r===62&&n+1<e&&s.charCodeAt(n+1)===32)return {type:"blockquote",skip:true,hasInlineSolve:false};if(r===96&&n+2<e&&s.charCodeAt(n+1)===96&&s.charCodeAt(n+2)===96)return {type:"code_fence",skip:true,hasInlineSolve:false};if(r===126&&n+2<e&&s.charCodeAt(n+1)===126&&s.charCodeAt(n+2)===126)return {type:"code_fence",skip:true,hasInlineSolve:false};if(r===36&&n+1<e&&s.charCodeAt(n+1)===36)return {type:"math_fence",skip:true,hasInlineSolve:false};if(r===45||r===42||r===95){let h=1;for(;n+h<e&&s.charCodeAt(n+h)===r;)h++;if(h>=3){let a=n+h;for(;a<e&&(s.charCodeAt(a)===32||s.charCodeAt(a)===9);)a++;if(a>=e)return {type:"hr",skip:true,hasInlineSolve:false}}}if((r===45||r===42||r===43)&&n+1<e&&s.charCodeAt(n+1)===32)return o===void 0&&(o=this.hasInlineSolveWithin(n,e)),{type:"list",skip:false,hasInlineSolve:o,contentOffset:this.skipMarkerGap(n+1,e)};if(r>=48&&r<=57){let h=n;for(;h<e&&s.charCodeAt(h)>=48&&s.charCodeAt(h)<=57;)h++;if(h<e&&s.charCodeAt(h)===46&&h+1<e&&s.charCodeAt(h+1)===32)return o===void 0&&(o=this.hasInlineSolveWithin(n,e)),{type:"list",skip:false,hasInlineSolve:o,contentOffset:this.skipMarkerGap(h+1,e)}}if(r===124){let h=n+1;for(;h<e;){let a=s.charCodeAt(h);if(a!==45&&a!==58&&a!==124&&a!==32&&a!==9&&a!==13)break;h++;}if(h>=e)return {type:"table_separator",skip:true,hasInlineSolve:false}}if(r===91&&n+1<e&&s.charCodeAt(n+1)===91){let h=this.indexOfWithin("]]",n+2,e);if(h!==-1){let a=h+2;for(;a<e&&(s.charCodeAt(a)===32||s.charCodeAt(a)===9);)a++;if(a>=e)return {type:"wikilink",skip:true,hasInlineSolve:false}}}if(r===33&&n+2<e&&s.charCodeAt(n+1)===91&&s.charCodeAt(n+2)===91){let h=this.indexOfWithin("]]",n+3,e);if(h!==-1){let a=h+2;for(;a<e&&(s.charCodeAt(a)===32||s.charCodeAt(a)===9);)a++;if(a>=e)return {type:"wikilink",skip:true,hasInlineSolve:false}}}if(r===47&&n+1<e&&s.charCodeAt(n+1)===47)return {type:"comment",skip:true,hasInlineSolve:false};if(r===62){let h=n+1;for(;h<e&&(s.charCodeAt(h)===32||s.charCodeAt(h)===9);)h++;if(h>=e)return {type:"blockquote",skip:true,hasInlineSolve:false}}if(r===45||r===42||r===43){let h=n+1;for(;h<e&&(s.charCodeAt(h)===32||s.charCodeAt(h)===9);)h++;if(h>=e)return {type:"list",skip:false,hasInlineSolve:false}}if(o===void 0&&(o=this.hasInlineSolveWithin(n,e)),!o){let h=true;for(let a=n;a<e;a++){let u=s.charCodeAt(a);if(u>=128||R.CHAR_CLASS[u]>1){h=false;break}}if(h)return {type:"empty",skip:true,hasInlineSolve:false}}return {type:"expression",skip:false,hasInlineSolve:o}}classifyLine(t){let i=this.input,e=this.len,s=this.pos;this.input=t,this.len=t.length,this.pos=0;let n=this.classifyFromPositions(0,t.length);return this.input=i,this.len=e,this.pos=s,n}getKeywords(){return Object.fromEntries(this.mergedKeywords)}findInlineSolves(t){let i=[],e=t.length,s=0;for(;s<e;){let n=t.indexOf("s`",s);if(n===-1)break;let r=n+2,o=r;for(;o<e;){let u=t.charCodeAt(o);if(u===92&&o+1<e){o+=2;continue}if(u===96)break;o++;}o>=e&&(o=e);let h=t.slice(r,o),a=o<e?o+1:o;i.push({start:n,end:a,expression:h,columnNumber:n+1}),s=a;}return i}tokenizeComment(){let t=this.input,i=this.len,e=this.pos,s=e-this.lineStartPos+1;if(t.charCodeAt(e)===35){let o=this.matchHexColourEnd(e,i);if(o!==-1){let p=t.slice(e,o);return this.pos=o,new l("HEX_COLOUR",$,p,p,e,0,this.line,s)}let h=t.charCodeAt(e+1),a=h>=65&&h<=90||h>=97&&h<=122,u=e>this.lineStartPos?t.charCodeAt(e-1):-1,f=u>=48&&u<=57||u>=65&&u<=90||u>=97&&u<=122||u===95;if(a&&!f){let p=e+2;for(;p<i;){let C=t.charCodeAt(p);if(!(C>=48&&C<=57||C>=65&&C<=90||C>=97&&C<=122||C===95||C===45))break;p++;}let T=t.slice(e+1,p);return this.pos=p,new l("TAG",Z,T,T,e,0,this.line,s)}}let n=this.pos;for(n+1<i&&t.charCodeAt(n+1)===47?n+=2:n++;n<i;){let o=t.charCodeAt(n);if(o===10||o===13)break;n++;}let r=t.slice(e,n);return this.pos=n,new l("COMMENT",P,r,r,e,0,this.line,s)}};R.CHAR_CLASS=te();var V=R;var le={"to the power of":"CARET","power of":"CARET","increase by":"INCREASE_BY","decrease by":"DECREASE_BY","times by":"TIMES_BY","multiply by":"MULTIPLY_BY","divide by":"DIVIDE_BY","multiplied by":"MULTIPLY_BY","divided by":"DIVIDE_BY"};exports.a=l;exports.b=V;exports.c=le;//# sourceMappingURL=chunk-WU7SBKVU.cjs.map
2
- //# sourceMappingURL=chunk-WU7SBKVU.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/lexer/ExpressionLexer.ts","../src/lexer/BuiltinPhrases.ts"],"names":["registerAllTokenTypes","TT_BACKTICK_OPEN","tokenTypeId","TT_BIGINT","TT_COMMENT","TT_CURRENCY_SYMBOL","TT_DOLLAR","TT_DOT","TT_EURO","TT_HEX_COLOUR","TT_IDENT","TT_INLINE_SOLVE_START","TT_LSHIFT","TT_MINUS","TT_NEQ","TT_NUMBER","TT_PLUS_MINUS","TT_POUND","TT_RSHIFT","TT_RUBLE","TT_SLASH","TT_STAR","TT_STRING","TT_TAG","TT_UNIT","TT_URSHIFT","TT_WON","TT_YEN","buildCharClassTable","table","i","isUnicodeSpace","cc","LexerToken","type","typeId","value","text","offset","lineBreaks","line","col","sourceEnd","fault","TWO_CHAR_OPS","OP_MAP","EXPRESSION_INDICATOR_CODES","set","opCodes","c","_ExpressionLexer","localeCode","_lookup","getLocale","k","v","knownUnits","rule","m","plugin","keyword","lower","ErrorFactory","chars","first","second","builtInSecondMap","unit","tokenType","inner","owners","key","owner","claims","remaining","claim","survivor","toRemove","r","input","results","docLen","lineStart","lineEnd","lineNumber","classification","lineText","tokens","error","rawToken","savedLen","thrown","EngineError","inlineSolves","charSpans","span","scanned","nlChar","out","len","tokenIndex","openSpan","collectedSpans","c0","identLower","kwType","opType","token","dash","pos","start","startCol","next","hasIntPart","d1","d2","d3","d4","isGroupOfExactlyThree","hasDecimal","nextCc","hasExponent","ec","identText","fullText","localeKwType","lookPos","parenPos","isWord","ch","isAlpha","wordEnd","hasAlpha","word","keywordType","c1","secondMap","twoCharType","commentPos","pluginInner","pluginType","end","indicatorCodes","from","after","hashPos","p","last","needle","hasInline","hashCount","count","trailPos","digitPos","tPos","tc","closePos","trail","onlySkippable","code","savedInput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,CAAG,EAC/B,GAAIN,CAAAA,GAAO,IAAMA,CAAAA,GAAO,EAAA,CAAI,MAC5BM,CAAAA,GACF,CAEA,IAAMxE,CAAAA,CAAO0C,EAAM,KAAA,CAAM+B,CAAAA,CAAOD,CAAG,CAAA,CACnC,OAAA,IAAA,CAAK,GAAA,CAAMA,CAAAA,CACJ,IAAI5E,CAAAA,CAAW,SAAA,CAAW7B,EAAYiC,CAAAA,CAAMA,CAAAA,CAAMyE,EAAO,CAAA,CAAG,IAAA,CAAK,IAAA,CAAMC,CAAQ,CACxF,CACF,EA51Da7D,EACa,UAAA,CAAatB,EAAAA,GADhC,IAAMiJ,CAAAA,CAAN3H,ECtcA,IAAM4H,GAA0C,CACtD,iBAAA,CAAmB,QACnB,UAAA,CAAY,OAAA,CACZ,cAAe,aAAA,CACf,aAAA,CAAe,cACf,UAAA,CAAY,UAAA,CACZ,cAAe,aAAA,CACf,WAAA,CAAa,YAGb,eAAA,CAAiB,aAAA,CACjB,aAAc,WACf","file":"chunk-WU7SBKVU.cjs","sourcesContent":["import { Token, tokenTypeId, registerAllTokenTypes } from '@solve-js/lexer/Token';\nimport { knownUnits } from '@solve-js/lexer/units';\nimport { getLocale, type ILocale } from '@solve-js/constants/locales';\nimport { ErrorFactory, EngineError } from '@solve-js/errors/UnifiedErrorFramework';\nimport type { TokenLookup } from '@solve-js/lexer/TokenClassRegistry';\n\n// Bootstrap all token types at module load\nregisterAllTokenTypes();\n\n// The ids of the token types this scanner constructs directly, resolved once.\n// tokenTypeId() is a Map lookup on a string key; it was being called at every\n// token construction (65 sites) to re-resolve a value that registerAllTokenTypes\n// above fixed at load, which measured at 5.9 ns against 0.4 ns for a constant,\n// roughly a twentieth of the cost of lexing a token. Types chosen at run time\n// (a plugin keyword, a locale keyword, an operator table entry) still resolve\n// through tokenTypeId() where they are used.\nconst TT_BACKTICK_OPEN = tokenTypeId('BACKTICK_OPEN');\nconst TT_BIGINT = tokenTypeId('BIGINT');\nconst TT_COMMENT = tokenTypeId('COMMENT');\nconst TT_CURRENCY_SYMBOL = tokenTypeId('CURRENCY_SYMBOL');\nconst TT_DOLLAR = tokenTypeId('DOLLAR');\nconst TT_DOT = tokenTypeId('DOT');\nconst TT_EURO = tokenTypeId('EURO');\nconst TT_HEX_COLOUR = tokenTypeId('HEX_COLOUR');\nconst TT_IDENT = tokenTypeId('IDENT');\nconst TT_INLINE_SOLVE_START = tokenTypeId('INLINE_SOLVE_START');\nconst TT_LSHIFT = tokenTypeId('LSHIFT');\nconst TT_MINUS = tokenTypeId('MINUS');\nconst TT_NEQ = tokenTypeId('NEQ');\nconst TT_NUMBER = tokenTypeId('NUMBER');\nconst TT_PLUS_MINUS = tokenTypeId('PLUS_MINUS');\nconst TT_POUND = tokenTypeId('POUND');\nconst TT_RSHIFT = tokenTypeId('RSHIFT');\nconst TT_RUBLE = tokenTypeId('RUBLE');\nconst TT_SLASH = tokenTypeId('SLASH');\nconst TT_STAR = tokenTypeId('STAR');\nconst TT_STRING = tokenTypeId('STRING');\nconst TT_TAG = tokenTypeId('TAG');\nconst TT_UNIT = tokenTypeId('UNIT');\nconst TT_URSHIFT = tokenTypeId('URSHIFT');\nconst TT_WON = tokenTypeId('WON');\nconst TT_YEN = tokenTypeId('YEN');\n\n// ── Markdown line classification (Phase B) ──────────────────────────────\n\n/** What a line is, structurally, before anything tries to evaluate it. */\nexport type MarkdownLineType =\n | 'expression'\n | 'prose'\n | 'heading'\n | 'blockquote'\n | 'list'\n | 'code_fence'\n | 'math_fence'\n | 'table'\n | 'table_separator'\n | 'hr'\n | 'wikilink'\n | 'comment'\n | 'empty';\n\n/**\n * What a line is and whether it holds anything to evaluate.\n *\n * Produced by a character-level scan that never consults the keyword, unit or\n * operator tables, so any lexer gives the same answer for the same line. See\n * `__tests__/lexer/LineClassificationIsVocabularyIndependent.spec.ts`.\n */\nexport interface LineClassification {\n /** The type of this markdown line */\n type: MarkdownLineType;\n /** Whether this line should be skipped (no expression evaluation) */\n skip: boolean;\n /** Whether the line contains inline solve markers (`s`...``) */\n hasInlineSolve: boolean;\n /**\n * Offset of the first evaluable character, when structural markup precedes\n * it. Absolute, in the same coordinates the classification was asked for,\n * and absent when the whole line is evaluable.\n *\n * A list marker is markup, not arithmetic. `- 100 + 20` is a bullet holding\n * `100 + 20`, but `-` is also a prefix operator, so without this the line\n * evaluated as negative one hundred and answered -80: a wrong answer that\n * looks like a right one. `*` and `+` in the same position could not even do\n * that, one erroring and the other correct by luck, so the three markers\n * disagreed with each other about the same document.\n *\n * Consumers must slice both the text and the token stream from here, or the\n * two describe different lines.\n */\n contentOffset?: number;\n}\n\n/** Inline solve position with precise coordinates */\nexport interface InlineSolveSpan {\n /** Character offset of the `s`` marker */\n start: number;\n /** Character offset past the closing `` ` `` */\n end: number;\n /** The expression text between the backticks */\n expression: string;\n /** 1-based column of the `s`` marker */\n columnNumber: number;\n /** Token index of INLINE_SOLVE_START in the line's token array (set during tokenization). */\n startTokenIndex?: number;\n /** Token index of closing BACKTICK_OPEN in the line's token array (set during tokenization). */\n endTokenIndex?: number;\n}\n\n/**\n * Result from a single line processed by scanDocument().\n * Combines line classification, tokenized tokens, and inline solve spans\n * into a single structure, eliminating the need for separate classifyLine()\n * findInlineSolves(), and per-line Lexer.reset() calls.\n */\nexport interface ScanLineResult {\n /** The raw line text (without trailing newline). */\n text: string;\n /** 1-based line number within the document. */\n lineNumber: number;\n /** Character offset of the line start within the document. */\n startOffset: number;\n /** Character offset of the line end (before newline). */\n endOffset: number;\n /** The line classification. */\n classification: LineClassification;\n /** Tokenized tokens (empty array if line is skipped). */\n tokens: Token[];\n /** Inline solve spans found in this line (empty if none). */\n inlineSolves: InlineSolveSpan[];\n /**\n * The structured error the tokeniser raised on this line, if it raised one\n * (an unterminated string literal is the one it can raise today). The line\n * carries no tokens then, and the rest of the document is unaffected: a\n * half-typed quote used to escape {@link ExpressionLexer.scanDocument} as\n * a throw and take every other line's result down with it.\n */\n error?: EngineError;\n}\n\n// ── Character class constants ─────────────────────────────────────────────\n// Used as the result of the CHAR_CLASS lookup table. V8 compiles the\n// outer switch on these small integer constants into a jump table.\nconst enum CharClass {\n SKIP = 0, // Invalid / control / unicode fallback\n WHITESPACE = 1, // space, tab, \\n, \\r\n DIGIT = 2, // 0-9\n ALPHA = 3, // a-z, A-Z, _\n DOT = 4, // . (could be decimal point or DOT token)\n OPERATOR = 5, // + - * / ^ % ( ) [ ] { } , : ; = ? & | ~ ! < >\n QUOTE = 6, // \"\n HASH = 7, // # (comment)\n DOLLAR = 8, // $\n POUND = 9, // £ (U+00A3)\n EURO = 10, // € (U+20AC)\n BACKTICK = 11, // `\n}\n\n// ── Static character class table (built once at module load) ──────────────\nfunction buildCharClassTable(): Uint8Array {\n const table = new Uint8Array(128);\n\n // Digits 0-9\n for (let i = 48; i <= 57; i++) table[i] = CharClass.DIGIT;\n\n // Uppercase A-Z\n for (let i = 65; i <= 90; i++) table[i] = CharClass.ALPHA;\n\n // Lowercase a-z\n for (let i = 97; i <= 122; i++) table[i] = CharClass.ALPHA;\n\n // Underscore\n table[95] = CharClass.ALPHA;\n\n // Dot\n table[46] = CharClass.DOT;\n\n // Whitespace\n table[32] = CharClass.WHITESPACE; // space\n table[9] = CharClass.WHITESPACE; // tab\n table[10] = CharClass.WHITESPACE; // \\n\n table[13] = CharClass.WHITESPACE; // \\r\n\n // Operators / punctuation\n table[33] = CharClass.OPERATOR; // !\n table[37] = CharClass.OPERATOR; // %\n table[38] = CharClass.OPERATOR; // &\n table[40] = CharClass.OPERATOR; // (\n table[41] = CharClass.OPERATOR; // )\n table[42] = CharClass.OPERATOR; // *\n table[43] = CharClass.OPERATOR; // +\n table[44] = CharClass.OPERATOR; // ,\n table[45] = CharClass.OPERATOR; // -\n table[47] = CharClass.OPERATOR; // /\n table[58] = CharClass.OPERATOR; // :\n table[59] = CharClass.OPERATOR; // ;\n table[60] = CharClass.OPERATOR; // <\n table[61] = CharClass.OPERATOR; // =\n table[62] = CharClass.OPERATOR; // >\n table[63] = CharClass.OPERATOR; // ?\n table[91] = CharClass.OPERATOR; // [\n table[93] = CharClass.OPERATOR; // ]\n table[94] = CharClass.OPERATOR; // ^\n table[123] = CharClass.OPERATOR; // {\n table[124] = CharClass.OPERATOR; // |\n table[125] = CharClass.OPERATOR; // }\n table[126] = CharClass.OPERATOR; // ~\n // \"@\" was previously unclassified (defaulted to CharClass.SKIP, silently\n // dropped before ever reaching OP_MAP). See OP_MAP's own \"@\" entry doc\n // comment for why this is being activated now.\n table[64] = CharClass.OPERATOR; // @\n\n // Other\n table[34] = CharClass.QUOTE; // \"\n table[35] = CharClass.HASH; // #\n table[36] = CharClass.DOLLAR; // $\n table[96] = CharClass.BACKTICK; // `\n\n return table;\n}\n\n/**\n * Whether a non-ASCII code point separates tokens rather than joining them.\n *\n * The CHAR_CLASS table above is 128 entries wide, so every code point past\n * ASCII falls through to one branch that reads it as part of an identifier.\n * That is right for `café`, `日本語` and emoji, and wrong for the dozen or so\n * code points that are whitespace without being ASCII whitespace. Without this,\n * a no-break space between two operands JOINED them: `1<NBSP>+<NBSP>1` lexed as\n * one identifier and reported \"Undefined variable: 1 + 1\", and a byte-order\n * mark at the head of a file did the same to its first line. Both arrive\n * constantly in pasted text, from a web page, a word processor, a spreadsheet\n * export, or a Windows editor that writes a BOM.\n *\n * The zero-width JOINERS are deliberately absent. U+200D is what holds a family\n * emoji together as one grapheme, and U+200C is its non-joining partner; both\n * bind their neighbours rather than separating them, so they stay identifier\n * characters. U+200B, the zero-width SPACE, is a separator despite being\n * invisible, which is exactly why it is worth handling: it is unreadable on\n * screen and would otherwise silently break the line it lands in.\n *\n * @param cc - A UTF-16 code unit, only meaningful for values >= 128.\n * @returns True when the character should be skipped like a space.\n */\nfunction isUnicodeSpace(cc: number): boolean {\n return (\n cc === 0x0085 || // NEL, next line\n cc === 0x00A0 || // no-break space\n cc === 0x1680 || // ogham space mark\n (cc >= 0x2000 && cc <= 0x200A) || // en quad through hair space, incl. figure/thin space\n cc === 0x200B || // zero-width space\n cc === 0x2028 || // line separator\n cc === 0x2029 || // paragraph separator\n cc === 0x202F || // narrow no-break space\n cc === 0x205F || // medium mathematical space\n cc === 0x3000 || // ideographic space\n cc === 0xFEFF // byte-order mark / zero-width no-break space\n );\n}\n\n// ── Monomorphic Token class ───────────────────────────────────────────────\n// V8 assigns a single stable HiddenClass because all properties are\n// initialized in the constructor and never added/removed afterwards.\n// This enables fast property access (inline cache hits) and allows\n// allocation in V8's nursery (cheap GC).\n// All 9 fields are always set, no optional fields, no different shapes.\n/**\n * A token, as the lexer produces it.\n *\n * A class rather than an object literal because tokens are created on every\n * keystroke and a shared hidden class keeps that path predictable for the\n * engine running it.\n */\nexport class LexerToken implements Token {\n constructor(\n public type: string,\n public typeId: number,\n public value: string,\n public text: string,\n public offset: number,\n public lineBreaks: number,\n public line: number,\n public col: number,\n /** See {@link Token.sourceEnd}. Set only on normalizer-fused tokens. */\n public sourceEnd?: number,\n /** See {@link Token.fault}. Set only on a fused token standing for a run the engine refuses to read. */\n public fault?: { readonly code: string; readonly message: string },\n ) {}\n}\n\n// ── Two-character operator lookup ─────────────────────────────────────────\n// Maps first-char → (second-char → token type). Used for operators like\n// ==, !=, >=, <=, **, <<, >>.\ninterface TwoCharOpMap {\n [firstChar: number]: { [secondChar: number]: string };\n}\nconst TWO_CHAR_OPS: TwoCharOpMap = {\n 61: { 61: 'EQUALITY', 62: 'THEREFORE' }, // ==, => (opposite char order from >='s GTE below — no collision)\n 33: { 61: 'NEQ' }, // !=\n 62: { 61: 'GTE' }, // >=\n 60: { 61: 'LTE' }, // <=\n 38: { 38: 'LOGICAL_AND' }, // &&\n 124: { 124: 'LOGICAL_OR' }, // ||\n 43: { 61: 'PLUS_EQUALS' }, // += (compound assignment, running totals)\n 45: { 61: 'MINUS_EQUALS' }, // -= (neither + nor - had a two-char op before)\n // Note: ** is NOT a single token, the existing moo lexer emits two\n // separate STAR tokens, and the parser consumes them that way.\n // 42: { 42: 'EXPONENT' }, // **, disabled for moo compatibility\n};\n// Note: LSHIFT (<<) and RSHIFT (>>) are handled separately because\n// 60 is also used for LTE, so we check LTE first then LSHIFT.\n\n// ── Single-character operator lookup ──────────────────────────────────────\nconst OP_MAP: Record<number, string> = {\n 43: 'PLUS', // +\n 45: 'MINUS', // -\n 42: 'STAR', // *\n 47: 'SLASH', // /\n 94: 'CARET', // ^\n 37: 'PERCENT', // %\n 40: 'LPAREN', // (\n 41: 'RPAREN', // )\n 91: 'LBRACKET', // [\n 93: 'RBRACKET', // ]\n 123: 'LBRACE', // {\n 125: 'RBRACE', // }\n 44: 'COMMA', // ,\n 58: 'COLON', // :\n 59: 'SEMICOLON',// ;\n 61: 'EQUALS', // =\n 63: 'QUESTION', // ?\n 33: 'BANG', // !\n 38: 'BIT_AND', // &\n 124: 'BIT_OR', // |\n 60: 'LT', // <\n 62: 'GT', // >\n 126: 'BIT_NOT', // ~\n // \"@\", activates the token type name already dormant-reserved for this\n // exact purpose (see Token.ts's OVER/RATE_AT doc comment and\n // normalizer/TokenNormalizer.ts's NON_WORD_NAMES, both of which already\n // anticipated \"AT\" as a future \"@\" symbol token before this addition).\n // Backs the time package's video-timecode literal's alternate fps\n // separator (`01:02:03:04 @ 30fps`, equivalent to `... at 30fps`). See\n // packages/time/parselets/VideoTimecodeParselet.ts.\n 64: 'AT', // @\n};\n\n/**\n * Plugin interface for extending the ExpressionLexer with custom tokens.\n *\n * Plugins can register:\n * - `keywords`: Map identifier strings to custom token types (checked after locale keywords).\n * - `operators`: Map multi-character operator sequences to custom token types.\n * - `units`: Register additional unit identifiers (checked alongside built-in units).\n *\n * Multi-word phrase matching has been moved to the TokenNormalizer post-lexer\n * stage. To register phrase patterns, use `IEnginePackage.normalizerRules` instead.\n *\n * All registrations are additive, built-in patterns still work.\n */\nexport interface LexerVocabulary {\n /**\n * Keyword → tokenType mappings. Each key is a lowercase identifier that,\n * when encountered, will emit the specified token type instead of IDENT.\n * These are checked AFTER the locale's built-in keywordMap, so locale\n * keywords take priority.\n */\n keywords?: Record<string, string>;\n\n /**\n * Multi-character operator → tokenType mappings. Each key is the exact\n * character sequence (e.g., \"::\", \"->\", \"=>\") and the value is the token\n * type to emit. Two-character operators take priority during matching.\n * Built-in operators (==, !=, >=, <=, <<, >>) always take priority.\n */\n operators?: Record<string, string>;\n\n /**\n * Additional unit identifiers to recognize (e.g., \"gp\", \"osrs\", \"tile\").\n * These are checked alongside the built-in `knownUnits` set.\n */\n units?: string[];\n\n /**\n * Whole-line patterns matched against the RAW line text, BEFORE any\n * per-character tokenization begins.\n *\n * Every other extension point in this file (`keywords`/`operators`/\n * `units`, plus `IEnginePackage.phrases`/`normalizerRules`) transforms\n * a token STREAM -- they all assume the line is, at some granularity,\n * valid Solve syntax. This hook exists for the one shape that isn't:\n * a package whose grammar captures arbitrary free-form text terminated\n * by a fixed marker (e.g. a natural-language query ending in `= ?`),\n * where the text itself (\"distance to the moon\") would never tokenize\n * or parse as a normal expression and must be captured verbatim\n * instead -- see `packages/knowledge/` for the reference use.\n *\n * Each entry's `pattern` is tested (via `RegExp.exec`) against the\n * full, untrimmed line text. If it matches AND capture group 1 is\n * non-empty after trimming, the ENTIRE line becomes a single\n * synthetic token of `tokenType` whose `value`/`text` is the trimmed\n * capture group -- the character-by-character scanner never runs for\n * that line. Patterns are tried in registration order; the first\n * match wins. A package registering a rule here still needs a\n * `prefixParselets` entry for `tokenType` to actually consume the\n * resulting token.\n *\n * Because this bypasses tokenization entirely, a matching line can\n * contain characters that would otherwise be lexer errors (unmatched\n * quotes, stray symbols, ...) -- by design, since the whole point is\n * to hand the package raw text the normal pipeline was never meant to\n * parse.\n */\n rawLinePatterns?: Array<{ pattern: RegExp; tokenType: string }>;\n}\n\n// ── Expression gating (L1) ──────────────────────────────────────────────\n// Pre-computed Set of character codes that indicate an expression might\n// be present. Used by hasExpressionIndicators() to gate prose lines\n// before full tokenization.\n//\n// NOTE: Currently unused, L1 prose gating was removed from classifyFromPositions()\n// because it incorrectly skipped keyword-only lines (\"pi\"), single identifiers\n// (\"hello\"), and short alpha lines. Retained for future re-implementation with\n// keyword-awareness and proper test coverage.\nconst EXPRESSION_INDICATOR_CODES = (() => {\n const set = new Set<number>();\n // Digits 0-9\n for (let i = 48; i <= 57; i++) set.add(i);\n // Operators / punctuation\n // Note: colon (58) is intentionally excluded, it's common in prose\n // (e.g., \"Subject: Hello world\") and would cause false-positive\n // expression classification. Variable assignment lines like\n // \":myVar = 5\" are still caught by '=' and digit indicators.\n const opCodes = [43, 45, 42, 47, 94, 37, 40, 41, 91, 93, 123, 125, 61, 60, 62, 33, 38, 124, 126, 59, 63];\n for (const c of opCodes) set.add(c);\n // Currency\n set.add(36); // $\n set.add(0x00A3); // £\n set.add(0x20AC); // €\n set.add(0x00A5); // ¥\n set.add(0x20BD); // ₽\n set.add(0x20A9); // ₩\n // Backtick (inline solve)\n set.add(96); // `\n // Dot (could be decimal)\n set.add(46); // .\n // Hash (comment, still an expression indicator)\n set.add(35); // #\n return set;\n})();\n\n// ── ExpressionLexer ───────────────────────────────────────────────────────\n/**\n * Character-by-character tokenizer for expression text.\n *\n * Scans a raw line/expression string into a stream of typed tokens\n * (numbers, identifiers, operators, units, keywords, ...), handling\n * markdown-line classification (`classifyLine`), inline `` s`...` `` solve\n * spans, and package-contributed vocabulary (registered via\n * {@link registerVocabulary}/{@link unregisterVocabulary}, keywords\n * operators, and units a package wants recognized as their own token\n * types rather than falling through to generic identifiers).\n *\n * Most consumers should use the higher-level {@link Lexer} wrapper, which\n * adds streaming `next()`/`peek()` access over this class's scan results.\n */\nexport class ExpressionLexer {\n private static readonly CHAR_CLASS = buildCharClassTable();\n\n\t// Instance state\n private input: string = '';\n private pos: number = 0;\n private len: number = 0;\n\n // Line / column tracking (1-indexed)\n private line: number = 1;\n private lineStartPos: number = 0;\n\n // Open-bracket context stack for the current line, one entry per unclosed\n // `(`/`[`, `true` when a comma inside it is a separator rather than a\n // thousands group. A `[` (vector/matrix) and a CALL `(` (`rgb(255,255,255)`,\n // preceded by an identifier) are separator contexts; a bare GROUPING `(`\n // (`(1,000)`, preceded by an operator or the line start) is not, so a\n // parenthesised thousands number still reads as one scalar. The number scanner\n // consults the innermost entry. Tracked here because the flat token stream\n // carries no nesting otherwise; reset per line, so an unbalanced bracket\n // cannot bleed the decision into the next.\n private groupingStack: boolean[] = [];\n\n // Keyword map: lowercase identifier → token type (locale keywords only)\n private keywordMap: Map<string, string>;\n\n // ── Merged lookup collections (keywordMap + plugin keywords, knownUnits + pluginUnits)\n private mergedKeywords: Map<string, string>;\n // ReadonlySet: only membership is ever tested, which lets the common\n // no-plugin-units case share the built-in `knownUnits` set without a copy.\n private mergedUnits: ReadonlySet<string>;\n\n /**\n * Who registered each plugin keyword, unit and two-character operator, in\n * registration order. Two packages may claim the same word (the\n * compatibility index warns, and the last registered wins, as before); the\n * owner lists make unregistration exact, so removing one package hands the\n * word back to the other rather than deleting it for both.\n */\n private pluginKeywordOwners: Map<string, Array<{ owner: LexerVocabulary; tokenType: string }>> = new Map();\n private pluginUnitOwners: Map<string, LexerVocabulary[]> = new Map();\n private pluginOperatorOwners: Map<number, Array<{ owner: LexerVocabulary; tokenType: string }>> = new Map();\n\n // Plugin-extensible two-char operators: firstChar → (secondChar → tokenType)\n private pluginOperators: Map<number, Map<number, string>> = new Map();\n\n // Plugin-extensible units (merged with knownUnits)\n private pluginUnits: Set<string> = new Set();\t// Fast-path guards: skip plugin lookups entirely when no plugins registered\n\tprivate hasPluginOps = false;\n\n // Locale for function-identifier lookups\n private localeCode: string;\n private locale: ILocale;\n\n /**\n * Inline solve spans collected during the most recent tokenization pass.\n * Populated by tokenizeInto() and consumed by scanDocument().\n */\n _inlineSolveSpans: InlineSolveSpan[] = [];\n\n // Plugin-extensible raw-line patterns. See LexerVocabulary.rawLinePatterns.\n private pluginRawLinePatterns: Array<{ pattern: RegExp; tokenType: string }> = [];\n\n /**\n * If a `rawLinePatterns` rule matches the FULL text most recently passed\n * to {@link reset}, this holds the single synthetic token that\n * {@link tokenizeAll} should return instead of running the\n * character-by-character scanner. Cleared (re-evaluated) on every\n * {@link reset} call. `null` when no plugin registered any raw-line\n * patterns, or none matched, the overwhelmingly common case, checked\n * with a `length === 0` guard before ever touching this field so a\n * plugin-free lexer pays zero cost for the feature.\n */\n private pendingRawLineToken: Token | null = null;\n\n /**\n * Test `text` against every registered `rawLinePatterns` rule, in\n * registration order. Returns a synthetic token for the first rule\n * whose `pattern` matches AND whose capture group 1 is non-empty after\n * trimming; returns `null` if no rule matches (the normal\n * character-by-character scanner should run instead).\n */\n private matchRawLine(text: string): Token | null {\n for (const rule of this.pluginRawLinePatterns) {\n const m = rule.pattern.exec(text);\n if (m && typeof m[1] === 'string') {\n const value = m[1].trim();\n if (value.length > 0) {\n return new LexerToken(rule.tokenType, tokenTypeId(rule.tokenType), value, value, 0, 0, this.line, 1);\n }\n }\n }\n return null;\n }\n\n /** Rebuild merged keyword and unit collections after plugin registration. */\n // `knownUnits` is a 1000+ entry built-in set. A single combined rebuild used\n // to copy it (and the whole keyword map) on every registerVocabulary call, so\n // each keyword-only package paid for it for nothing, the single largest cost\n // in engine construction. The merged keyword map is now maintained\n // incrementally (a plugin keyword can never shadow a built-in, so it is a plain\n // set/delete on the existing map, see registerVocabulary), and only the units\n // still need an occasional rebuild, done here.\n private rebuildMergedUnits(): void {\n // No plugin units is the common case: reference the built-in set directly\n // rather than copying 1000+ entries. mergedUnits is read-only (membership\n // tests only), so sharing the constant is safe; a later plugin unit builds a\n // fresh union instead of mutating it.\n this.mergedUnits = this.pluginUnits.size === 0\n ? knownUnits\n : new Set([...knownUnits, ...this.pluginUnits]);\n }\n\n /**\n * @param localeCode - Locale whose keyword table seeds the lexer.\n * @param _lookup - Ignored. The lexer built its keyword, unit and phrase\n * tables from the locale and the registered packages and never read the\n * lookup it was handed; the parameter stays so existing callers compile.\n * @deprecated Removed in 3.0.\n */\n constructor(localeCode = 'en', _lookup?: TokenLookup) {\n this.localeCode = localeCode;\n this.locale = getLocale(localeCode);\n this.keywordMap = new Map<string, string>();\n for (const [k, v] of Object.entries(this.locale.keywordMap)) {\n this.keywordMap.set(k.toLowerCase(), v);\n }\n this.mergedKeywords = new Map(this.keywordMap);\n // No plugin units yet: share the built-in set (read-only). A later plugin\n // unit builds a fresh union in rebuildMergedUnits() rather than mutating it.\n this.mergedUnits = knownUnits;\n }\n\n /**\n * Register a plugin to extend the lexer with custom tokens.\n *\n * All registrations are additive, built-in patterns still work.\n * Keywords, operators, and units from the plugin are merged\n * with existing ones. Calling multiple times adds more entries.\n *\n * Note: multi-word phrases are now handled by the TokenNormalizer\n * (see `IEnginePackage.normalizerRules`), not the lexer.\n *\n * Built-in tokens CANNOT be overridden. Throws a EngineError if the\n * plugin attempts to register a keyword, operator, or unit\n * that conflicts with a built-in one.\n */\n registerVocabulary(plugin: LexerVocabulary): void {\n // Every guard runs before anything is written. A collision on the third\n // keyword used to leave the first two registered, so a registration that\n // failed still changed the lexer.\n if (plugin.keywords) {\n for (const keyword of Object.keys(plugin.keywords)) {\n const lower = keyword.toLowerCase();\n // Guard: prevent overriding built-in locale keywords\n if (this.keywordMap.has(lower)) {\n throw ErrorFactory.config(\n 'PLUGIN_KEYWORD_COLLISION',\n `Plugin keyword \"${keyword}\" conflicts with built-in keyword ` +\n `(type: ${this.keywordMap.get(lower)}). Built-in keywords cannot be overridden.`,\n { keyword, builtinType: this.keywordMap.get(lower) }\n );\n }\n }\n }\n if (plugin.operators) {\n for (const chars of Object.keys(plugin.operators)) {\n // Only 2-char operators take the fast path; others are ignored here.\n if (chars.length === 2) {\n const first = chars.charCodeAt(0);\n const second = chars.charCodeAt(1);\n // Guard: prevent overriding built-in two-char operators (==, !=, >=, <=)\n const builtInSecondMap = TWO_CHAR_OPS[first];\n if (builtInSecondMap && builtInSecondMap[second] !== undefined) {\n throw ErrorFactory.config(\n 'PLUGIN_OPERATOR_COLLISION',\n `Plugin operator \"${chars}\" conflicts with built-in operator ` +\n `(type: ${builtInSecondMap[second]}). Built-in operators cannot be overridden.`,\n { operator: chars, builtinType: builtInSecondMap[second] }\n );\n }\n // Guard: prevent overriding LSHIFT (<<) and RSHIFT (>>)\n if (first === 60 && second === 60) {\n throw ErrorFactory.config(\n 'PLUGIN_OPERATOR_COLLISION',\n `Plugin operator \"${chars}\" conflicts with built-in operator ` +\n `(type: LSHIFT). Built-in operators cannot be overridden.`,\n { operator: chars, builtinType: 'LSHIFT' }\n );\n }\n if (first === 62 && second === 62) {\n throw ErrorFactory.config(\n 'PLUGIN_OPERATOR_COLLISION',\n `Plugin operator \"${chars}\" conflicts with built-in operator ` +\n `(type: RSHIFT). Built-in operators cannot be overridden.`,\n { operator: chars, builtinType: 'RSHIFT' }\n );\n }\n // Guard: prevent overriding comment sequences (//)\n if (first === 47 && second === 47) {\n throw ErrorFactory.config(\n 'PLUGIN_OPERATOR_COLLISION',\n `Plugin operator \"${chars}\" conflicts with built-in comment sequence. ` +\n `Comment sequences cannot be overridden.`,\n { operator: chars, builtinType: 'COMMENT' }\n );\n }\n }\n }\n }\n if (plugin.units) {\n for (const unit of plugin.units) {\n // Guard: prevent overriding built-in units\n if (knownUnits.has(unit)) {\n throw ErrorFactory.config(\n 'PLUGIN_UNIT_COLLISION',\n `Plugin unit \"${unit}\" conflicts with a built-in unit. ` +\n `Built-in units cannot be overridden.`,\n { unit }\n );\n }\n }\n }\n\n if (plugin.keywords) {\n for (const [keyword, tokenType] of Object.entries(plugin.keywords)) {\n const lower = keyword.toLowerCase();\n this.claim(this.pluginKeywordOwners, lower, plugin, tokenType);\n // Straight into the merged view: guarded above against shadowing a\n // built-in, so no full rebuild is needed.\n this.mergedKeywords.set(lower, tokenType);\n }\n }\n\n if (plugin.operators) {\n this.hasPluginOps = true;\n for (const [chars, tokenType] of Object.entries(plugin.operators)) {\n if (chars.length === 2) {\n const first = chars.charCodeAt(0);\n const second = chars.charCodeAt(1);\n this.claim(this.pluginOperatorOwners, first * 65536 + second, plugin, tokenType);\n let inner = this.pluginOperators.get(first);\n if (!inner) {\n inner = new Map();\n this.pluginOperators.set(first, inner);\n }\n inner.set(second, tokenType);\n }\n }\n }\n\n if (plugin.units) {\n for (const unit of plugin.units) {\n const owners = this.pluginUnitOwners.get(unit);\n if (owners) owners.push(plugin);\n else this.pluginUnitOwners.set(unit, [plugin]);\n this.pluginUnits.add(unit);\n }\n this.rebuildMergedUnits();\n }\n\n if (plugin.rawLinePatterns) {\n this.pluginRawLinePatterns.push(...plugin.rawLinePatterns);\n }\n }\n\n /** Record `owner`'s claim on `key`. The newest claim is the one in force. */\n private claim<K>(owners: Map<K, Array<{ owner: LexerVocabulary; tokenType: string }>>, key: K, owner: LexerVocabulary, tokenType: string): void {\n const claims = owners.get(key);\n if (claims) claims.push({ owner, tokenType });\n else owners.set(key, [{ owner, tokenType }]);\n }\n\n /** Drop `owner`'s claim on `key`, and return the claim now in force, if any is left. */\n private release<K>(owners: Map<K, Array<{ owner: LexerVocabulary; tokenType: string }>>, key: K, owner: LexerVocabulary): { owner: LexerVocabulary; tokenType: string } | undefined {\n const claims = owners.get(key);\n if (!claims) return undefined;\n const remaining = claims.filter((claim) => claim.owner !== owner);\n if (remaining.length === 0) {\n owners.delete(key);\n return undefined;\n }\n owners.set(key, remaining);\n return remaining[remaining.length - 1];\n }\n\n /**\n * Unregister a plugin, removing its custom tokens from the lexer.\n *\n * This is the inverse of registerVocabulary(). All keywords, operators,\n * and units registered by the plugin are removed. After\n * unregistration, those tokens will revert to their default behavior\n * (e.g., keywords become IDENT, operators become ERROR).\n *\n * Calling unregisterVocabulary with a plugin that was never registered\n * is safe, it simply has no effect.\n */\n unregisterVocabulary(plugin: LexerVocabulary): void {\n if (plugin.keywords) {\n for (const keyword of Object.keys(plugin.keywords)) {\n const lower = keyword.toLowerCase();\n const survivor = this.release(this.pluginKeywordOwners, lower, plugin);\n if (survivor) this.mergedKeywords.set(lower, survivor.tokenType);\n else this.mergedKeywords.delete(lower);\n }\n }\n\n if (plugin.operators) {\n for (const chars of Object.keys(plugin.operators)) {\n if (chars.length === 2) {\n const first = chars.charCodeAt(0);\n const second = chars.charCodeAt(1);\n const survivor = this.release(this.pluginOperatorOwners, first * 65536 + second, plugin);\n const inner = this.pluginOperators.get(first);\n if (!inner) continue;\n if (survivor) {\n inner.set(second, survivor.tokenType);\n continue;\n }\n inner.delete(second);\n if (inner.size === 0) {\n this.pluginOperators.delete(first);\n }\n }\n }\n this.hasPluginOps = this.pluginOperators.size > 0;\n }\n\n if (plugin.units) {\n for (const unit of plugin.units) {\n const owners = this.pluginUnitOwners.get(unit);\n if (!owners) continue;\n const remaining = owners.filter((owner) => owner !== plugin);\n if (remaining.length > 0) {\n this.pluginUnitOwners.set(unit, remaining);\n continue;\n }\n this.pluginUnitOwners.delete(unit);\n this.pluginUnits.delete(unit);\n }\n\n this.rebuildMergedUnits();\n }\n\n if (plugin.rawLinePatterns) {\n const toRemove = new Set(plugin.rawLinePatterns);\n this.pluginRawLinePatterns = this.pluginRawLinePatterns.filter((r) => !toRemove.has(r));\n }\n }\n\n reset(input: string): void {\n this.input = input;\n this.pos = 0;\n this.len = input.length;\n this.line = 1;\n this.lineStartPos = 0;\n this.pendingRawLineToken = this.pluginRawLinePatterns.length > 0 ? this.matchRawLine(input) : null;\n }\n\n /**\n * Scan a full document text in a single pass, classifying each line and\n * tokenizing non-skipped lines.\n *\n * Replaces the separate classifyLine() + findInlineSolves() + per-line\n * reset() + tokenizeAll() pattern with a single character-by-character\n * walk through the entire document. Key benefits:\n *\n * - **Single reset()**: `this.pos`, `this.len`, `this.line`, and\n * `this.lineStartPos` are set once for the whole document, not per-line.\n * - **Single classification**: classifyLine() runs once per line inline;\n * skipped lines are jumped over without tokenization.\n * - **Shared tokenization**: Non-skipped lines are tokenized using the\n * existing state machine, yielding Token[] without per-line reset().\n * - **Inline solve detection**: findInlineSolves() is called only for\n * lines that classifyLine() marks as having inline solves.\n *\n * Tokenization is scoped to each line by temporarily restricting\n * `this.len` to the line end position, so tokenizeInto() naturally\n * stops at the line boundary. After tokenization, `this.len` is\n * restored and `this.pos` advances past the newline.\n *\n * @param text The full document text (with newlines).\n * @returns Array of ScanLineResult, one per line, in document order.\n */\n scanDocument(text: string): ScanLineResult[] {\n this.input = text;\n this.pos = 0;\n this.len = text.length;\n this.line = 1;\n this.lineStartPos = 0;\n\n const results: ScanLineResult[] = [];\n const input = this.input;\n const docLen = this.len;\n\n while (this.pos < docLen) {\n const lineStart = this.pos;\n\n // ── Find end of current line (newline boundary) ───────────────\n let lineEnd = this.pos;\n while (lineEnd < docLen) {\n const cc = input.charCodeAt(lineEnd);\n if (cc === 10 || cc === 13) break; // \\n or \\r\n lineEnd++;\n }\n\n const lineNumber = this.line;\n\n // ── Classify the line ─────────────────────────────────────────\n // Uses classifyFromPositions() to read from this.input directly\n // avoids allocating a substring and keeps classification reads\n // within the same memory region as tokenization.\n const classification = this.classifyFromPositions(lineStart, lineEnd);\n\n // ── Slice line text for ScanLineResult.text ────────────────\n // Hoisted above tokenization (rather than after, as originally) so the\n // raw-line-pattern check below can test the exact substring a plugin\n // registered via `LexerVocabulary.rawLinePatterns`. See reset()/\n // tokenizeAll() for the single-expression-string equivalent of this\n // same check.\n const lineText = input.slice(lineStart, lineEnd);\n\n // ── Tokenize non-skipped lines ────────────────────────────────\n let tokens: Token[] = [];\n let error: EngineError | undefined;\n if (!classification.skip) {\n const rawToken = this.pluginRawLinePatterns.length > 0 ? this.matchRawLine(lineText) : null;\n if (rawToken) {\n tokens = [rawToken];\n } else {\n // Scope tokenization to just this line by temporarily restricting len.\n // tokenizeInto() reads `this.len` once on entry, so setting\n // this.len = lineEnd first ensures tokenization stops at the line\n // boundary. After tokenization,\n // this.pos will be at lineEnd (the newline position).\n const savedLen = this.len;\n this.len = lineEnd;\n // Start past any structural marker, so the marker never becomes a\n // token. Token source offsets stay absolute, so everything\n // downstream (spans, highlighting, inline solves) still lines up\n // with the raw document.\n if (classification.contentOffset !== undefined) this.pos = classification.contentOffset;\n try {\n this.tokenizeInto(tokens);\n } catch (thrown) {\n // A tokeniser error belongs to this line, the way a parse error\n // already does. Letting it escape aborted the whole scan, so one\n // half-typed quote blanked every other line's result. The line\n // keeps its text and its error; the scan carries on from the\n // next line, with the position restored to where this one ends.\n if (!(thrown instanceof EngineError)) throw thrown;\n error = thrown;\n tokens = [];\n this._inlineSolveSpans = [];\n this.line = lineNumber;\n } finally {\n this.len = savedLen;\n }\n // this.pos is set to lineEnd below, which also covers the error path.\n }\n }\n\n // ── Detect inline solves ──────────────────────────────────────\n // Two data sources are merged:\n // 1. _inlineSolveSpans, token indices collected inline during\n // tokenizeInto(). Provides correct startTokenIndex /\n // endTokenIndex. Also handles \\` escape (skips the pair\n // instead of closing the span early).\n // 2. findInlineSolves(), character-level string scan for\n // expression text. Still needed because token-based\n // reconstruction loses whitespace (the lexer skips spaces),\n // which breaks multi-word expressions like\n // \"2 weeks in days\" → \"2weeksindays\" (wrong tokenization).\n let inlineSolves: InlineSolveSpan[] = [];\n if (classification.hasInlineSolve) {\n if (!classification.skip && tokens.length > 0) {\n const charSpans = this.findInlineSolves(lineText);\n inlineSolves = this._inlineSolveSpans.map((span, i) => ({\n start: charSpans[i]?.start ?? 0,\n end: charSpans[i]?.end ?? 0,\n expression: charSpans[i]?.expression ?? '',\n columnNumber: charSpans[i]?.columnNumber ?? span.columnNumber,\n startTokenIndex: span.startTokenIndex,\n endTokenIndex: span.endTokenIndex,\n }));\n } else {\n // Skipped lines weren't tokenized, fall back to string scan\n inlineSolves = this.findInlineSolves(lineText);\n }\n }\n\n const scanned: ScanLineResult = {\n text: lineText,\n lineNumber,\n startOffset: lineStart,\n endOffset: lineEnd,\n classification,\n tokens,\n inlineSolves,\n };\n if (error) scanned.error = error;\n results.push(scanned);\n\n // ── Advance past newline ─────────────────────────────────────\n this.pos = lineEnd;\n if (this.pos < docLen) {\n const nlChar = input.charCodeAt(this.pos);\n if (nlChar === 13) { // \\r\n this.pos++;\n if (this.pos < docLen && input.charCodeAt(this.pos) === 10) {\n this.pos++; // skip \\n in \\r\\n\n }\n } else if (nlChar === 10) { // \\n\n this.pos++;\n }\n }\n this.line++;\n this.lineStartPos = this.pos;\n }\n\n return results;\n }\n\n /**\n * Tokenize an expression string into an array of Tokens.\n *\n * Runs {@link tokenizeInto} into a fresh array.\n *\n * Optimizations:\n * - CHAR_CLASS jump table (Uint8Array) → switch on small integers\n * - Direct character-code dispatch (c0 cached pattern)\n * - Mathematical digit parsing (integer math, not slice+parseFloat)\n * - Inline operator tokenizer with two-char peek-ahead\n * - Whitespace eliminated in-lexer (never emitted)\n * - 0-char and 1-char fast paths\n */\n tokenizeAll(): Token[] {\n if (this.pendingRawLineToken) {\n this._inlineSolveSpans = [];\n return [this.pendingRawLineToken];\n }\n const out: Token[] = [];\n this.tokenizeInto(out);\n return out;\n }\n\n // ── Scanner ──────────────────────────────────────────────────────────\n /**\n * Scan the current input and append every token to `out`.\n *\n * This is the scanner itself: {@link tokenizeAll} and the iterator are\n * thin wrappers over it. It pushes into an array the caller owns rather\n * than yielding, because a generator paid a resume per token and\n * `Array.from` a second pass on top, and because a caller that catches a\n * tokeniser fault (highlighting a line with an unterminated quote) still\n * holds the tokens read before it.\n *\n * IMPORTANT: `this.len` is read ONCE on entry (const len = this.len).\n * `scanDocument()` relies on this to scope a pass to a single line by\n * restricting `this.len` to the line end before calling. Do not re-read\n * `this.len` mid-loop without also updating `scanDocument()`.\n *\n * @param out - The array to append to. Left as it was if the input is empty.\n */\n tokenizeInto(out: Token[]): void {\n const len = this.len;\n\n // ── 0-char fast path ────────────────────────────────────────────────\n if (len === 0) { this._inlineSolveSpans = []; return; }\n\n // Inline solve tracking state, collected inline during tokenization\n let tokenIndex = 0;\n let openSpan: { startTokenIndex: number; startColumn: number } | null = null;\n const collectedSpans: InlineSolveSpan[] = [];\n\n // ── 1-char fast path ────────────────────────────────────────────────\n if (len === 1) {\n const c0 = this.input.charCodeAt(0);\n const cc = ExpressionLexer.CHAR_CLASS[c0] ?? CharClass.SKIP;\n\n switch (cc) {\n case CharClass.DIGIT:\n out.push(new LexerToken('NUMBER', TT_NUMBER, this.input, this.input, 0, 0, 1, 1));\n tokenIndex++;\n break;\n\n case CharClass.DOT:\n // A lone '.' is a DOT, as the main loop makes it. This case used to\n // share the NUMBER arm above, so a stray dot on a line of its own\n // evaluated to 0 while \". \" or \"a.\" reported an error.\n out.push(new LexerToken('DOT', TT_DOT, '.', '.', 0, 0, 1, 1));\n tokenIndex++;\n break;\n\n case CharClass.ALPHA: {\n const input = this.input;\n const identLower = input.toLowerCase();\n // Use pre-merged collections (built-in + plugin), single lookup each\n if (this.mergedUnits.has(input)) {\n out.push(new LexerToken('UNIT', TT_UNIT, input, input, 0, 0, 1, 1));\n } else {\n const kwType = this.mergedKeywords.get(identLower);\n if (kwType) {\n out.push(new LexerToken(kwType, tokenTypeId(kwType), input, input, 0, 0, 1, 1));\n } else {\n out.push(new LexerToken('IDENT', TT_IDENT, input, input, 0, 0, 1, 1));\n }\n }\n tokenIndex++;\n break;\n }\n\n case CharClass.OPERATOR: {\n const opType = OP_MAP[c0];\n if (opType) {\n out.push(new LexerToken(opType, tokenTypeId(opType), this.input, this.input, 0, 0, 1, 1));\n tokenIndex++;\n }\n break;\n }\n\n case CharClass.QUOTE:\n // Delegate to tokenizeString for correctness (handles unterminated)\n this.pos = 0;\n out.push(this.tokenizeString());\n tokenIndex++;\n break;\n\n case CharClass.HASH:\n // Delegate to tokenizeComment for correctness\n this.pos = 0;\n out.push(this.tokenizeComment());\n tokenIndex++;\n break;\n\n case CharClass.DOLLAR:\n out.push(new LexerToken('DOLLAR', TT_DOLLAR, '$', '$', 0, 0, 1, 1));\n tokenIndex++;\n break;\n\n case CharClass.BACKTICK:\n // s` is 2 chars, openSpan can never be set in the 1-char fast path\n out.push(new LexerToken('BACKTICK_OPEN', TT_BACKTICK_OPEN, '`', '`', 0, 0, 1, 1));\n tokenIndex++;\n break;\n\n default: {\n // CharClass.SKIP, includes non-ASCII characters (code >= 128)\n if (isUnicodeSpace(c0)) {\n // A line holding nothing but a no-break space or a byte-order mark\n // holds no expression, exactly as a line holding one space does.\n // Yielding an IDENT for it made it an undefined variable instead.\n } else if (c0 === 0x00D7) { // × → STAR\n out.push(new LexerToken('STAR', TT_STAR, '\\u00D7', '\\u00D7', 0, 0, 1, 1));\n tokenIndex++;\n } else if (c0 === 0x00F7) { // ÷ → SLASH\n out.push(new LexerToken('SLASH', TT_SLASH, '\\u00F7', '\\u00F7', 0, 0, 1, 1));\n tokenIndex++;\n } else if (c0 === 0x00B1) { // U+00B1 plus-minus sign, the uncertainty operator\n out.push(new LexerToken('PLUS_MINUS', TT_PLUS_MINUS, '\\u00B1', '\\u00B1', 0, 0, 1, 1));\n tokenIndex++;\n } else if (c0 === 0x2260) { // ≠ → NEQ\n out.push(new LexerToken('NEQ', TT_NEQ, '\\u2260', '\\u2260', 0, 0, 1, 1));\n tokenIndex++;\n } else if (c0 === 0x00A3) { // £\n out.push(new LexerToken('POUND', TT_POUND, '\\u00A3', '\\u00A3', 0, 0, 1, 1));\n tokenIndex++;\n } else if (c0 === 0x20AC) { // €\n out.push(new LexerToken('EURO', TT_EURO, '\\u20AC', '\\u20AC', 0, 0, 1, 1));\n tokenIndex++;\n } else if (c0 === 0x00A5) { // ¥\n out.push(new LexerToken('YEN', TT_YEN, '¥', '¥', 0, 0, 1, 1));\n tokenIndex++;\n } else if (c0 === 0x20BD) { // ₽\n out.push(new LexerToken('RUBLE', TT_RUBLE, '₽', '₽', 0, 0, 1, 1));\n tokenIndex++;\n } else if (c0 === 0x20A9) { // ₩\n out.push(new LexerToken('WON', TT_WON, '₩', '₩', 0, 0, 1, 1));\n tokenIndex++;\n } else if (c0 === 0x20B9) { // ₹ (Indian rupee) — see uom/CurrencyAliases.ts\n out.push(new LexerToken('CURRENCY_SYMBOL', TT_CURRENCY_SYMBOL, '₹', '₹', 0, 0, 1, 1));\n tokenIndex++;\n } else if (c0 === 0x20BA) { // ₺ (Turkish lira)\n out.push(new LexerToken('CURRENCY_SYMBOL', TT_CURRENCY_SYMBOL, '₺', '₺', 0, 0, 1, 1));\n tokenIndex++;\n } else if (c0 === 0x20B4) { // ₴ (Ukrainian hryvnia)\n out.push(new LexerToken('CURRENCY_SYMBOL', TT_CURRENCY_SYMBOL, '₴', '₴', 0, 0, 1, 1));\n tokenIndex++;\n } else if (c0 === 0x20AA) { // ₪ (Israeli new shekel)\n out.push(new LexerToken('CURRENCY_SYMBOL', TT_CURRENCY_SYMBOL, '₪', '₪', 0, 0, 1, 1));\n tokenIndex++;\n } else if (c0 === 0x20AB) { // ₫ (Vietnamese dong)\n out.push(new LexerToken('CURRENCY_SYMBOL', TT_CURRENCY_SYMBOL, '₫', '₫', 0, 0, 1, 1));\n tokenIndex++;\n } else if (c0 === 0x20A6) { // ₦ (Nigerian naira)\n out.push(new LexerToken('CURRENCY_SYMBOL', TT_CURRENCY_SYMBOL, '₦', '₦', 0, 0, 1, 1));\n tokenIndex++;\n } else if (c0 === 0x20B1) { // ₱ (Philippine peso)\n out.push(new LexerToken('CURRENCY_SYMBOL', TT_CURRENCY_SYMBOL, '₱', '₱', 0, 0, 1, 1));\n tokenIndex++;\n } else if (c0 === 0x2212 || c0 === 0x2013) { // − (minus sign) and – (en dash) → MINUS\n out.push(new LexerToken('MINUS', TT_MINUS, this.input, this.input, 0, 0, 1, 1));\n tokenIndex++;\n } else if (c0 >= 128) {\n // Unknown unicode, treat as IDENT for forward compatibility\n out.push(new LexerToken('IDENT', TT_IDENT, this.input, this.input, 0, 0, 1, 1));\n tokenIndex++;\n }\n break;\n }\n }\n this._inlineSolveSpans = collectedSpans;\n return;\n }\n\n const input = this.input;\n // Fresh nesting stack for this pass (see the field's doc).\n this.groupingStack.length = 0;\n\n // ── Main tokenization loop ──────────────────────────────────────────\n while (this.pos < len) {\n const c0 = input.charCodeAt(this.pos);\n const cc = ExpressionLexer.CHAR_CLASS[c0] ?? CharClass.SKIP;\n\n // ── Escaped backtick inside inline solve ────────────────────────\n // \\` is treated as an escaped backtick, skip both characters\n // without closing the inline solve span. Without this, the\n // backtick would close the span early, producing wrong expression\n // text for expressions like s`hello \\` world`.\n if (openSpan && c0 === 92 && this.pos + 1 < len && input.charCodeAt(this.pos + 1) === 96) {\n this.pos += 2; // skip \\ and `\n continue;\n }\n\n switch (cc) {\n // ── Whitespace, skip entirely, track newlines ────────────────\n case CharClass.WHITESPACE:\n this.pos++;\n if (c0 === 10) { // \\n\n this.line++;\n this.lineStartPos = this.pos;\n this.groupingStack.length = 0; // each line groups thousands on its own\n } else if (c0 === 13) { // \\r\n this.line++;\n if (this.pos < len && input.charCodeAt(this.pos) === 10) {\n this.pos++; // skip \\n in \\r\\n\n }\n this.lineStartPos = this.pos;\n this.groupingStack.length = 0;\n }\n break;\n\n // ── Digit, inline number tokenizer ───────────────────────────\n case CharClass.DIGIT:\n out.push(this.tokenizeNumber());\n tokenIndex++;\n break;\n\n // ── Alpha / underscore, identifier or keyword ────────────────\n case CharClass.ALPHA: {\n const token = this.tokenizeIdentifier();\n if (token.type === 'INLINE_SOLVE_START') {\n openSpan = { startTokenIndex: tokenIndex, startColumn: token.col };\n }\n out.push(token);\n tokenIndex++;\n break;\n }\n\n // ── Dot, could be decimal (.5) or DOT token ─────────────────\n case CharClass.DOT:\n if (this.pos + 1 < len) {\n const nextCc = ExpressionLexer.CHAR_CLASS[input.charCodeAt(this.pos + 1)] ?? CharClass.SKIP;\n if (nextCc === CharClass.DIGIT) {\n out.push(this.tokenizeNumber());\n } else {\n const col = this.pos - this.lineStartPos + 1;\n out.push(new LexerToken('DOT', TT_DOT, '.', '.', this.pos, 0, this.line, col));\n this.pos++;\n }\n } else {\n const col = this.pos - this.lineStartPos + 1;\n out.push(new LexerToken('DOT', TT_DOT, '.', '.', this.pos, 0, this.line, col));\n this.pos++;\n }\n tokenIndex++;\n break;\n\n // ── Operator / punctuation ────────────────────────────────────\n case CharClass.OPERATOR:\n out.push(this.tokenizeOperator());\n tokenIndex++;\n break;\n\n // ── String literal ────────────────────────────────────────────\n case CharClass.QUOTE:\n out.push(this.tokenizeString());\n tokenIndex++;\n break;\n\n // ── Comment (# or //) ─────────────────────────────────────────\n case CharClass.HASH:\n out.push(this.tokenizeComment());\n tokenIndex++;\n break;\n\n // ── Dollar sign $ ─────────────────────────────────────────────\n case CharClass.DOLLAR: {\n const col = this.pos - this.lineStartPos + 1;\n out.push(new LexerToken('DOLLAR', TT_DOLLAR, '$', '$', this.pos, 0, this.line, col));\n this.pos++;\n tokenIndex++;\n break;\n }\n\n // ── Backtick ` ───────────────────────────────────────────────\n case CharClass.BACKTICK: {\n const col = this.pos - this.lineStartPos + 1;\n out.push(new LexerToken('BACKTICK_OPEN', TT_BACKTICK_OPEN, '`', '`', this.pos, 0, this.line, col));\n this.pos++;\n if (openSpan) {\n const span = openSpan; // narrow for TS\n collectedSpans.push({\n start: 0, end: 0, expression: '',\n columnNumber: span.startColumn,\n startTokenIndex: span.startTokenIndex,\n endTokenIndex: tokenIndex,\n });\n openSpan = null;\n }\n tokenIndex++;\n break;\n }\n\n // ── Non-ASCII characters ─────────────────────────────────────\n default: {\n const col = this.pos - this.lineStartPos + 1;\n if (isUnicodeSpace(c0)) {\n // Separates its neighbours instead of joining them. See\n // isUnicodeSpace()'s doc comment: this branch is why a sum pasted\n // out of a web page or a spreadsheet evaluates at all.\n this.pos++;\n if (c0 === 0x2028 || c0 === 0x2029 || c0 === 0x0085) {\n // The three that are line breaks rather than spaces, tracked the\n // same way \"\\n\" is above so a later token reports its own line.\n this.line++;\n this.lineStartPos = this.pos;\n }\n } else if (c0 === 0x00D7) { // × → STAR\n out.push(new LexerToken('STAR', TT_STAR, '\\u00D7', '\\u00D7', this.pos, 0, this.line, col));\n this.pos++;\n tokenIndex++;\n } else if (c0 === 0x00F7) { // ÷ → SLASH\n out.push(new LexerToken('SLASH', TT_SLASH, '\\u00F7', '\\u00F7', this.pos, 0, this.line, col));\n this.pos++;\n tokenIndex++;\n } else if (c0 === 0x00B1) { // U+00B1 plus-minus sign, the uncertainty operator\n out.push(new LexerToken('PLUS_MINUS', TT_PLUS_MINUS, '\\u00B1', '\\u00B1', this.pos, 0, this.line, col));\n this.pos++;\n tokenIndex++;\n } else if (c0 === 0x2260) { // ≠ → NEQ\n out.push(new LexerToken('NEQ', TT_NEQ, '\\u2260', '\\u2260', this.pos, 0, this.line, col));\n this.pos++;\n tokenIndex++;\n } else if (c0 === 0x00A3) { // £\n out.push(new LexerToken('POUND', TT_POUND, '\\u00A3', '\\u00A3', this.pos, 0, this.line, col));\n this.pos++;\n tokenIndex++;\n } else if (c0 === 0x20AC) { // €\n out.push(new LexerToken('EURO', TT_EURO, '\\u20AC', '\\u20AC', this.pos, 0, this.line, col));\n this.pos++;\n tokenIndex++;\n } else if (c0 === 0x00A5) { // ¥\n out.push(new LexerToken('YEN', TT_YEN, '¥', '¥', this.pos, 0, this.line, col));\n this.pos++;\n tokenIndex++;\n } else if (c0 === 0x20BD) { // ₽\n out.push(new LexerToken('RUBLE', TT_RUBLE, '₽', '₽', this.pos, 0, this.line, col));\n this.pos++;\n tokenIndex++;\n } else if (c0 === 0x20A9) { // ₩\n out.push(new LexerToken('WON', TT_WON, '₩', '₩', this.pos, 0, this.line, col));\n this.pos++;\n tokenIndex++;\n } else if (c0 === 0x20B9) { // ₹ (Indian rupee) — see uom/CurrencyAliases.ts\n out.push(new LexerToken('CURRENCY_SYMBOL', TT_CURRENCY_SYMBOL, '₹', '₹', this.pos, 0, this.line, col));\n this.pos++;\n tokenIndex++;\n } else if (c0 === 0x20BA) { // ₺ (Turkish lira)\n out.push(new LexerToken('CURRENCY_SYMBOL', TT_CURRENCY_SYMBOL, '₺', '₺', this.pos, 0, this.line, col));\n this.pos++;\n tokenIndex++;\n } else if (c0 === 0x20B4) { // ₴ (Ukrainian hryvnia)\n out.push(new LexerToken('CURRENCY_SYMBOL', TT_CURRENCY_SYMBOL, '₴', '₴', this.pos, 0, this.line, col));\n this.pos++;\n tokenIndex++;\n } else if (c0 === 0x20AA) { // ₪ (Israeli new shekel)\n out.push(new LexerToken('CURRENCY_SYMBOL', TT_CURRENCY_SYMBOL, '₪', '₪', this.pos, 0, this.line, col));\n this.pos++;\n tokenIndex++;\n } else if (c0 === 0x20AB) { // ₫ (Vietnamese dong)\n out.push(new LexerToken('CURRENCY_SYMBOL', TT_CURRENCY_SYMBOL, '₫', '₫', this.pos, 0, this.line, col));\n this.pos++;\n tokenIndex++;\n } else if (c0 === 0x20A6) { // ₦ (Nigerian naira)\n out.push(new LexerToken('CURRENCY_SYMBOL', TT_CURRENCY_SYMBOL, '₦', '₦', this.pos, 0, this.line, col));\n this.pos++;\n tokenIndex++;\n } else if (c0 === 0x20B1) { // ₱ (Philippine peso)\n out.push(new LexerToken('CURRENCY_SYMBOL', TT_CURRENCY_SYMBOL, '₱', '₱', this.pos, 0, this.line, col));\n this.pos++;\n tokenIndex++;\n } else if (c0 === 0x2212 || c0 === 0x2013) {\n // The minus sign (U+2212) and the en dash (U+2013) are what a word\n // processor or a web page turns a typed hyphen into, and both read\n // as subtraction when pasted. The em dash stays prose: it is a\n // sentence mark, not an operator.\n const dash = this.input[this.pos];\n out.push(new LexerToken('MINUS', TT_MINUS, dash, dash, this.pos, 0, this.line, col));\n this.pos++;\n tokenIndex++;\n } else if (c0 >= 128) {\n // Unknown unicode, treat as IDENT for forward compatibility.\n // tokenizeIdentifier() now includes cc >= 128 in its reading loop,\n // so this properly advances past all consecutive Unicode chars.\n out.push(this.tokenizeIdentifier());\n tokenIndex++;\n } else {\n // Unknown ASCII, silently skip\n this.pos++;\n }\n break;\n }\n }\n }\n this._inlineSolveSpans = collectedSpans;\n }\n\n /**\n * Iterate the tokens of the current input.\n *\n * Runs {@link tokenizeInto} first, so the tokens are the same as before,\n * but a fault part way through the line is thrown from the first\n * `next()` rather than at the token it occurred on. A caller that wants\n * the tokens read before a fault calls {@link tokenizeInto} with its own\n * array.\n */\n *[Symbol.iterator](): Generator<Token, void, undefined> {\n const out: Token[] = [];\n this.tokenizeInto(out);\n yield* out;\n }\n\n // ── Inline number tokenizer ────────────────────────────────────────────\n /**\n * Character-by-character number parsing.\n *\n * Supports: integers, floats, scientific notation (1.5e10, 1.5e-10),\n * hex (0xFF), binary (0b1010), octal (0o17), BigInt suffix (123n),\n * thousands separators (1,234 or 1.234.567).\n *\n * Returns a LexerToken and advances `this.pos` past the number.\n */\n private tokenizeNumber(): Token {\n const input = this.input;\n const len = this.len;\n let pos = this.pos;\n const start = pos;\n const startCol = pos - this.lineStartPos + 1;\n let cc: number;\n\n // ── Hex literal: 0x / 0X ───────────────────────────────────────────\n if (input.charCodeAt(pos) === 48 && pos + 1 < len) {\n const next = input.charCodeAt(pos + 1);\n if (next === 0x78 || next === 0x58) { // 'x' or 'X'\n pos += 2;\n while (\n pos < len &&\n ((cc = input.charCodeAt(pos)),\n (cc >= 48 && cc <= 57) || (cc >= 65 && cc <= 70) || (cc >= 97 && cc <= 102))\n ) {\n pos++;\n }\n const text = input.slice(start, pos);\n this.pos = pos;\n return new LexerToken('NUMBER', TT_NUMBER, text, text, start, 0, this.line, startCol);\n }\n // ── Binary literal: 0b / 0B ─────────────────────────────────────\n if (next === 0x62 || next === 0x42) { // 'b' or 'B'\n pos += 2;\n while (pos < len && ((cc = input.charCodeAt(pos)), cc === 48 || cc === 49)) {\n pos++;\n }\n const text = input.slice(start, pos);\n this.pos = pos;\n return new LexerToken('NUMBER', TT_NUMBER, text, text, start, 0, this.line, startCol);\n }\n // ── Octal literal: 0o / 0O ───────────────────────────────────────\n if (next === 0x6F || next === 0x4F) { // 'o' or 'O'\n pos += 2;\n while (pos < len && ((cc = input.charCodeAt(pos)), cc >= 48 && cc <= 55)) {\n pos++;\n }\n const text = input.slice(start, pos);\n this.pos = pos;\n return new LexerToken('NUMBER', TT_NUMBER, text, text, start, 0, this.line, startCol);\n }\n }\n\n let hasIntPart = false;\n\n // ── Integer part ───────────────────────────────────────────────────\n while (pos < len && ((cc = input.charCodeAt(pos)), cc >= 48 && cc <= 57)) {\n hasIntPart = true;\n pos++;\n }\n\n // ── Thousands separators, coalesce with digits ────────────────────\n while (hasIntPart && pos < len && (input.charCodeAt(pos) === 44 || input.charCodeAt(pos) === 46)) {\n // A comma inside a call or bracket is an argument/element separator, not a\n // thousands group: `rgb(255,255,255)` is three numbers and `[100,200,300]`\n // a three-element vector, not `255255255`/`100200300`. A comma in a bare\n // grouping paren (`(1,000)`) still groups thousands, and so does a\n // top-level comma (`1,000,000`). The innermost bracket's context decides;\n // the `.` grouping form is context-free and unaffected. See\n // {@link groupingStack}.\n if (\n input.charCodeAt(pos) === 44 &&\n this.groupingStack.length > 0 &&\n this.groupingStack[this.groupingStack.length - 1]\n ) {\n break;\n }\n if (pos + 4 <= len) {\n const d1 = input.charCodeAt(pos + 1);\n const d2 = input.charCodeAt(pos + 2);\n const d3 = input.charCodeAt(pos + 3);\n // A genuine thousands group is always exactly 3 digits, followed\n // by either another separator, or a non-digit (end of number,\n // operator, unit, EOF), never a 4th consecutive digit. Without\n // this check, a plain decimal fraction with 4+ digits after the\n // point, e.g. \"0.0001\", had its first 3 fractional digits\n // misread as a \".\" thousands-group, silently truncating the\n // number to \"0.000\" and leaving the remaining digit(s) as a\n // separate, unrelated NUMBER token right after it (so\n // \"0.0001 BTC to USD\" tokenized as \"0.000\", \"1\", \"BTC\", \"to\",\n // \"USD\", two number literals instead of one, and evaluated to\n // a bare 0 instead of a real BTC quantity).\n const d4 = pos + 4 < len ? input.charCodeAt(pos + 4) : -1;\n const isGroupOfExactlyThree = !(d4 >= 48 && d4 <= 57);\n if (\n d1 >= 48 && d1 <= 57 &&\n d2 >= 48 && d2 <= 57 &&\n d3 >= 48 && d3 <= 57 &&\n isGroupOfExactlyThree\n ) {\n pos += 4;\n hasIntPart = true;\n continue;\n }\n }\n break;\n }\n\n // ── Decimal part (.xxx) ───────────────────────────────────────────\n let hasDecimal = false;\n if (pos < len && input.charCodeAt(pos) === 46) {\n if (pos + 1 < len) {\n const nextCc = input.charCodeAt(pos + 1);\n if (nextCc >= 48 && nextCc <= 57) {\n hasDecimal = true;\n pos++;\n while (pos < len && ((cc = input.charCodeAt(pos)), cc >= 48 && cc <= 57)) {\n pos++;\n }\n }\n }\n }\n\n // ── Exponent (e / E [+-]? \\n+) ────────────────────────────────────\n let hasExponent = false;\n if (pos < len) {\n const ec = input.charCodeAt(pos);\n if (ec === 0x65 || ec === 0x45) { // 'e' or 'E'\n if (pos + 1 < len) {\n const next = input.charCodeAt(pos + 1);\n if (\n (next >= 48 && next <= 57) ||\n next === 43 || next === 45 // + or -\n ) {\n hasExponent = true;\n pos++;\n if (next === 43 || next === 45) pos++;\n while (pos < len && ((cc = input.charCodeAt(pos)), cc >= 48 && cc <= 57)) {\n pos++;\n }\n }\n }\n }\n }\n\n // ── BigInt suffix check ────────────────────────────────────────────\n if (pos < len && input.charCodeAt(pos) === 110) { // 'n'\n if (hasIntPart && !hasDecimal && !hasExponent) {\n pos++;\n const text = input.slice(start, pos);\n this.pos = pos;\n return new LexerToken('BIGINT', TT_BIGINT, text, text, start, 0, this.line, startCol);\n }\n }\n\n // ── Emit NUMBER token ──────────────────────────────────────────────\n const text = input.slice(start, pos);\n this.pos = pos;\n return new LexerToken('NUMBER', TT_NUMBER, text, text, start, 0, this.line, startCol);\n }\n\n // ── Inline identifier / keyword tokenizer ──────────────────────────────\n /**\n * Reads [a-zA-Z_][a-zA-Z0-9_]* and resolves to:\n * - A unit type (via knownUnits, case-sensitive)\n * - A keyword type (via locale keywordMap, case-insensitive)\n * - IDENT if none of the above\n *\n * Multi-word phrases (e.g., \"to the power of\") are handled by the\n * TokenNormalizer post-lexer pass, not the lexer.\n */\n private tokenizeIdentifier(): Token {\n const input = this.input;\n const len = this.len;\n let pos = this.pos;\n const start = pos;\n const startCol = pos - this.lineStartPos + 1;\n let cc: number;\n\n // Read [a-zA-Z0-9_]* plus any Unicode (>= 128) including emoji surrogate pairs.\n // Without this, non-ASCII characters cause an infinite loop: the default case\n // calls tokenizeIdentifier(), the while loop doesn't match the Unicode char,\n // pos never advances, and the outer loop re-reads the same char forever.\n while (\n pos < len &&\n ((cc = input.charCodeAt(pos)),\n (cc >= 48 && cc <= 57) || // 0-9\n (cc >= 65 && cc <= 90) || // A-Z\n (cc >= 97 && cc <= 122) || // a-z\n cc === 95 || // _\n (cc >= 128 && !isUnicodeSpace(cc))) // Unicode (accented chars, emoji, etc.), but not Unicode whitespace\n ) {\n pos++;\n }\n\n const identText = input.slice(start, pos);\n const identLower = identText.toLowerCase();\n\n // ── Inline solve marker: s` (lowercase 's' followed by backtick) ──\n if (identLower === 's' && pos < len && input.charCodeAt(pos) === 96) {\n pos++;\n this.pos = pos;\n const fullText = input.slice(start, pos);\n return new LexerToken('INLINE_SOLVE_START', TT_INLINE_SOLVE_START, fullText, fullText, start, 0, this.line, startCol);\n }\n\n // ── Unit lookup (case-sensitive)\n const isKnownUnit = this.mergedUnits.has(identText);\n if (isKnownUnit) {\n if (!this.isFollowedByLParen(pos)) {\n this.pos = pos;\n return new LexerToken('UNIT', TT_UNIT, identText, identText, start, 0, this.line, startCol);\n }\n }\n\n // ── Keyword lookup (case-insensitive)\n const localeKwType = this.mergedKeywords.get(identLower);\n if (localeKwType) {\n this.pos = pos;\n return new LexerToken(localeKwType, tokenTypeId(localeKwType), identText, identText, start, 0, this.line, startCol);\n }\n\n // ── Fall through: emit IDENT\n // Multi-word phrases are now handled by the TokenNormalizer post-lexer pass,\n // which keeps the lexer slim and focused on single-token production.\n this.pos = pos;\n return new LexerToken('IDENT', TT_IDENT, identText, identText, start, 0, this.line, startCol);\n }\n\n /**\n * Peek past in-expression whitespace (space, tab) from `pos` to check\n * if the next significant character is '('.\n */\n private isFollowedByLParen(pos: number): boolean {\n const len = this.len;\n let lookPos = pos;\n while (lookPos < len) {\n const cc = this.input.charCodeAt(lookPos);\n if (cc === 40) return true;\n if (cc !== 32 && cc !== 9) break;\n lookPos++;\n }\n return false;\n }\n\n // ── Inline operator tokenizer ─────────────────────────────────────────\n /**\n * Whether the `(` at `parenPos` opens a function call rather than a bare\n * grouping, deciding whether a comma inside it is a separator or a thousands\n * group (see {@link groupingStack}).\n *\n * It is a call when the nearest non-whitespace character before it belongs to\n * the value the call applies to: a closing `)`/`]` (a call on a result), or an\n * IDENTIFIER (`rgb(`, `vec2(`). A run of digits alone is a number, not an\n * identifier, so `2(1,000)` is implicit multiplication over the grouping\n * `(1,000)`, not a call, while `vec2(` and `atan2(` (identifiers that end in a\n * digit) are calls. A `(` after an operator, a comma, or the line start is a\n * grouping.\n */\n private precededByCallTarget(parenPos: number): boolean {\n const input = this.input;\n const start = this.lineStartPos;\n let i = parenPos - 1;\n while (i >= start && (input.charCodeAt(i) === 32 || input.charCodeAt(i) === 9)) i--; // skip spaces/tabs\n if (i < start) return false; // line start (or only whitespace before): a grouping\n const c = input.charCodeAt(i);\n const isWord = (ch: number): boolean =>\n (ch >= 48 && ch <= 57) || (ch >= 65 && ch <= 90) || (ch >= 97 && ch <= 122) || ch === 95;\n const isAlpha = (ch: number): boolean =>\n (ch >= 65 && ch <= 90) || (ch >= 97 && ch <= 122) || ch === 95;\n // A non-word char before \"(\" (an operator, a comma, a `)`/`]`, or the line\n // start) is a grouping. There is no curried/first-class call or index-\n // application in this grammar, so `)(` and `](` are implicit multiplication\n // over a grouping (`(2)(1,000)` is `2 * 1000`), not a call. The only call\n // targets are an identifier or a FUNC keyword, handled below.\n if (!isWord(c)) return false;\n // Walk back over the whole word run. A bare number run (`2(1,000)`) is\n // implicit multiplication over a grouping, not a call.\n const wordEnd = i + 1;\n let hasAlpha = false;\n while (i >= start) {\n const ch = input.charCodeAt(i);\n if (!isWord(ch)) break;\n if (isAlpha(ch)) hasAlpha = true;\n i--;\n }\n if (!hasAlpha) return false;\n // The word is an identifier. A KEYWORD that is not a function name is a\n // word-operator or connective (`mod`, `xor`, `and`, `to`, `in`) or a\n // constant (`pi`, `e`), and the `(...)` after it is a grouped operand, so\n // its comma still groups thousands (`100 mod (1,000)` is `100 mod 1000`).\n // A plain identifier (a function like `rgb`, or a variable) or a function\n // keyword (`sqrt`, `max`) is a real call target, where the comma separates.\n const word = input.slice(i + 1, wordEnd).toLowerCase();\n const keywordType = this.mergedKeywords.get(word);\n return keywordType === undefined || keywordType === \"FUNC\";\n }\n\n /**\n * Reads an operator/punctuation token.\n * Handles two-char operators (==, !=, >=, <=, **) and the special\n * cases << (LSHIFT) and >> (RSHIFT).\n */\n private tokenizeOperator(): Token {\n const input = this.input;\n const pos = this.pos;\n const col = pos - this.lineStartPos + 1;\n const c0 = input.charCodeAt(pos);\n const len = this.len;\n\n // ── Two-character operators ────────────────────────────────────────\n if (pos + 1 < len) {\n const c1 = input.charCodeAt(pos + 1);\n\n // ==, !=, >=, <=\n const secondMap = TWO_CHAR_OPS[c0];\n if (secondMap) {\n const twoCharType = secondMap[c1];\n if (twoCharType) {\n const text = input.slice(pos, pos + 2);\n this.pos = pos + 2;\n return new LexerToken(twoCharType, tokenTypeId(twoCharType), text, text, pos, 0, this.line, col);\n }\n }\n\n // // comment\n if (c0 === 47 && c1 === 47) {\n let commentPos = pos + 2;\n while (commentPos < len) {\n const cc = input.charCodeAt(commentPos);\n if (cc === 10 || cc === 13) break;\n commentPos++;\n }\n const text = input.slice(pos, commentPos);\n this.pos = commentPos;\n return new LexerToken('COMMENT', TT_COMMENT, text, text, pos, 0, this.line, col);\n }\n\n // << (LSHIFT), >> (RSHIFT) and >>> (URSHIFT).\n //\n // >>> is tested before >>, or the two-char match would consume the first\n // two angle brackets and leave a stray > for the parser to choke on.\n if (c0 === 60 && c1 === 60) {\n this.pos = pos + 2;\n return new LexerToken('LSHIFT', TT_LSHIFT, '<<', '<<', pos, 0, this.line, col);\n }\n if (c0 === 62 && c1 === 62) {\n if (input.charCodeAt(pos + 2) === 62) {\n this.pos = pos + 3;\n return new LexerToken('URSHIFT', TT_URSHIFT, '>>>', '>>>', pos, 0, this.line, col);\n }\n this.pos = pos + 2;\n return new LexerToken('RSHIFT', TT_RSHIFT, '>>', '>>', pos, 0, this.line, col);\n }\n\n // ── Plugin-registered two-char operators ──────────────────────\n if (this.hasPluginOps) {\n const pluginInner = this.pluginOperators.get(c0);\n if (pluginInner) {\n const pluginType = pluginInner.get(c1);\n if (pluginType) {\n const text = input.slice(pos, pos + 2);\n this.pos = pos + 2;\n return new LexerToken(pluginType, tokenTypeId(pluginType), text, text, pos, 0, this.line, col);\n }\n }\n }\n }\n\n // ── Single-character operator ──────────────────────────────────────\n this.pos = pos + 1;\n // Track `(`/`[` nesting so the number scanner can tell a thousands group\n // from an argument/element separator (see {@link groupingStack}). `[` always\n // opens a separator context (a vector/matrix). `(` opens a separator context\n // only when it is a CALL, i.e. it directly follows a value the call applies\n // to, an identifier/unit, or a closing `)`/`]`; a bare GROUPING `(`, after an\n // operator or the line start, keeps thousands so `(1,000)` stays one number.\n // `)`/`]` pop; a stray closer with an empty stack is ignored.\n if (c0 === 91) { // [\n this.groupingStack.push(true);\n } else if (c0 === 40) { // (\n this.groupingStack.push(this.precededByCallTarget(pos));\n } else if (c0 === 41 || c0 === 93) { // ) or ]\n if (this.groupingStack.length > 0) this.groupingStack.pop();\n }\n const opType = OP_MAP[c0];\n const text = input.charAt(pos);\n return new LexerToken(opType || 'ERROR', tokenTypeId(opType || 'ERROR'), text, text, pos, 0, this.line, col);\n }\n\n // ── String literal tokenizer ──────────────────────────────────────────\n /**\n * Reads a double-quoted string literal. Supports backslash escapes.\n *\n * `text` is the raw source slice, quotes included, because that is what\n * `offset` + `text.length` has to span for a host to underline the literal.\n * `value` is the PAYLOAD, quotes excluded, because that is what\n * `PUSH_STRING` puts into the Value.\n *\n * The two used to be the same string. `\"abc\"` carried the five characters\n * `\"abc\"` as its value, which was invisible on screen (the formatter prints\n * the payload raw and the retained quotes landed where a display would have\n * put them back) and not invisible anywhere else: `parseFloat('\"5\"')` is NaN\n * whatever the digits say, so `\"5\" + 5` answered 5.\n *\n * An unterminated literal is an error rather than a string that happens to\n * reach the end of the line. It used to return what it had, so `\"abc` and\n * `\"abc\"` were indistinguishable by payload once the quotes were stripped,\n * which is the other half of why they are stripped here rather than later.\n */\n private tokenizeString(): Token {\n const input = this.input;\n const len = this.len;\n const start = this.pos;\n const startCol = start - this.lineStartPos + 1;\n let pos = start + 1;\n let lineBreaks = 0;\n\n while (pos < len) {\n const c0 = input.charCodeAt(pos);\n if (c0 === 34) {\n pos++;\n const text = input.slice(start, pos);\n const value = input.slice(start + 1, pos - 1);\n this.pos = pos;\n return new LexerToken('STRING', TT_STRING, value, text, start, lineBreaks, this.line, startCol);\n }\n if (c0 === 92 && pos + 1 < len) {\n pos += 2;\n continue;\n }\n if (c0 === 10) {\n this.line++;\n this.lineStartPos = pos + 1;\n lineBreaks++;\n }\n pos++;\n }\n\n this.pos = pos;\n throw ErrorFactory.parsing(\n \"UNTERMINATED_STRING\",\n `Unterminated string literal: ${input.slice(start, pos)}`,\n { literal: input.slice(start, pos), offset: start },\n );\n }\n\n // ── Markdown line scanner (Phase B) ───────────────────────────────────\n\n /**\n * L1 expression gating: quickly determine if a line contains any\n * characters that indicate an expression (digits, operators, currency,\n * backticks, parentheses, etc.).\n *\n * Pure prose lines (e.g., \"The quick brown fox jumps over the lazy dog\")\n * return false and can be skipped without full tokenization (L2).\n *\n * This is a fast character-by-character scan that stops at the first\n * expression indicator. Called once per line in classifyFromPositions().\n */\n static hasExpressionIndicators(input: string, start: number, end: number): boolean {\n const indicatorCodes = EXPRESSION_INDICATOR_CODES;\n for (let i = start; i < end; i++) {\n const cc = input.charCodeAt(i);\n // Check digits and operators via pre-computed Set (O(1) lookup)\n if (indicatorCodes.has(cc)) return true;\n // Unicode math/currency symbols (≥ 128, not in the 128-byte table)\n if (cc >= 128) {\n // ×, ÷, ≠, £, €, ¥, ₽, ₩, common expression symbols\n if (cc === 0x00D7 || cc === 0x00F7 || cc === 0x2260 ||\n cc === 0x00A3 || cc === 0x20AC ||\n cc === 0x00A5 || cc === 0x20BD || cc === 0x20A9) {\n return true;\n }\n }\n }\n return false;\n }\n\n /**\n * Classify a line by its character positions within this.input.\n * Reads directly from this.input using start/end boundaries.\n * DOES NOT modify this.pos, purely a read-only classifier.\n */\n /**\n * Advance past the whitespace after a list marker, and past a task-item\n * checkbox if one follows.\n *\n * The checkbox is included because it is markup by the same argument the\n * marker is, and because leaving it stopped the line dead: `- [ ] 100 + 20`\n * lexed `[ ]` as a matrix literal and reported that a matrix cannot be\n * empty, which tells a user writing a to-do list nothing they can act on.\n *\n * @param from - Offset just past the marker character.\n * @param end - Line end, never read past.\n * @returns Offset of the first evaluable character.\n */\n private skipMarkerGap(from: number, end: number): number {\n const input = this.input;\n let pos = from;\n while (pos < end && (input.charCodeAt(pos) === 32 || input.charCodeAt(pos) === 9)) pos++;\n\n // `[ ]`, `[x]`, `[X]`, or any single-character state Obsidian allows.\n if (pos + 2 < end && input.charCodeAt(pos) === 91 && input.charCodeAt(pos + 2) === 93) {\n let after = pos + 3;\n while (after < end && (input.charCodeAt(after) === 32 || input.charCodeAt(after) === 9)) after++;\n // Only when whitespace followed, so `[1,2]` opening a real matrix is\n // never mistaken for a checkbox.\n if (after > pos + 3) return after;\n }\n return pos;\n }\n\n /**\n * The end offset (exclusive) of a `#hex` colour literal starting at `hashPos`,\n * or -1 if the run there is not one. A colour is `#` followed by EXACTLY 3, 4,\n * 6 or 8 hex digits (the CSS forms `#rgb`/`#rgba`/`#rrggbb`/`#rrggbbaa`) and\n * then a boundary, not a longer word or number. This is the one predicate that\n * carves colours out of the two things `#` otherwise means, a markdown heading\n * at line start and a comment mid-line, and it is pure character logic so line\n * classification stays vocabulary-independent. Examples: `#f00`, `#ff0000`,\n * `#deadbeef` match; `# Heading` (space), `#tag`/`#todo` (non-hex letter),\n * `#12345` (length 5), `#ff0000zz` (trailing word) do not.\n */\n private matchHexColourEnd(hashPos: number, end: number): number {\n const input = this.input;\n let p = hashPos + 1;\n let n = 0;\n while (p < end) {\n const c = input.charCodeAt(p);\n const isHex = (c >= 48 && c <= 57) || (c >= 65 && c <= 70) || (c >= 97 && c <= 102);\n if (!isHex) break;\n n++;\n p++;\n }\n if (n !== 3 && n !== 4 && n !== 6 && n !== 8) return -1;\n if (p < end) {\n const c = input.charCodeAt(p);\n const isWord = (c >= 48 && c <= 57) || (c >= 65 && c <= 90) || (c >= 97 && c <= 122) || c === 95;\n if (isWord) return -1;\n }\n return p;\n }\n\n /**\n * Whether an inline-solve opener (`s` + backtick) occurs in `[from, end)`.\n *\n * Bounded by hand rather than written as `input.indexOf(\"s\\`\", from)`. This\n * used to be the `indexOf` form with an `idx < end` check afterwards, which\n * is correct but not bounded: when {@link scanDocument} is classifying,\n * `this.input` is the whole document, so a line with no marker scanned to\n * the END OF THE DOCUMENT before the check could reject the hit. Every line\n * paid for every line after it, and a whole-document parse was quadratic in\n * line count (measured at 28.9 us per line at 10,000 lines against 10.1 us\n * at 1,000, and two thirds of the parse's self time in a profile). A prose\n * document with many candidate `s` characters was worse still. The\n * wikilink close in {@link indexOfWithin} had the same shape.\n */\n private hasInlineSolveWithin(from: number, end: number): boolean {\n const input = this.input;\n const last = end - 1;\n for (let i = from; i < last; i++) {\n if (input.charCodeAt(i) === 115 && input.charCodeAt(i + 1) === 96) return true;\n }\n return false;\n }\n\n /**\n * `input.indexOf(needle, from)` restricted to `[from, end)`, returning -1\n * when the needle does not occur wholly before `end`. See\n * {@link hasInlineSolveWithin} for why the plain `indexOf` was not enough.\n */\n private indexOfWithin(needle: string, from: number, end: number): number {\n const input = this.input;\n const last = end - needle.length;\n const first = needle.charCodeAt(0);\n for (let i = from; i <= last; i++) {\n if (input.charCodeAt(i) !== first) continue;\n let k = 1;\n while (k < needle.length && input.charCodeAt(i + k) === needle.charCodeAt(k)) k++;\n if (k === needle.length) return i;\n }\n return -1;\n }\n\n private classifyFromPositions(start: number, end: number): LineClassification {\n const len = end;\n\n if (start >= len) {\n return { type: 'empty', skip: true, hasInlineSolve: false };\n }\n\n const input = this.input;\n let pos = start;\n\n while (pos < len) {\n const cc = input.charCodeAt(pos);\n if (cc !== 32 && cc !== 9) break;\n pos++;\n }\n\n if (pos >= len) {\n return { type: 'empty', skip: true, hasInlineSolve: false };\n }\n\n const c0 = input.charCodeAt(pos);\n let hasInline: boolean | undefined;\n\n // ── Heading: #{1,6} ' ' ──────────────────────────────────────────\n if (c0 === 35) {\n // A bare #hex colour is a value, not a heading. A real heading has a space\n // after its #(s), so the colour shape (# + 3/4/6/8 hex digits) never\n // collides with one. This line is tokenized like any expression.\n if (this.matchHexColourEnd(pos, len) !== -1) {\n if (hasInline === undefined) hasInline = this.hasInlineSolveWithin(pos, len);\n return { type: 'expression', skip: false, hasInlineSolve: hasInline };\n }\n let hashCount = 1;\n while (pos + hashCount < len && input.charCodeAt(pos + hashCount) === 35) {\n hashCount++;\n }\n if (hashCount <= 6 && pos + hashCount < len && input.charCodeAt(pos + hashCount) === 32) {\n return { type: 'heading', skip: true, hasInlineSolve: false };\n }\n return { type: 'heading', skip: true, hasInlineSolve: false };\n }\n\n // ── Blockquote: > ' ' ────────────────────────────────────────────\n if (c0 === 62) {\n if (pos + 1 < len && input.charCodeAt(pos + 1) === 32) {\n return { type: 'blockquote', skip: true, hasInlineSolve: false };\n }\n }\n\n // ── Code fence: ``` or ~~~ ────────────────────────────────────────\n if (c0 === 96 && pos + 2 < len && input.charCodeAt(pos + 1) === 96 && input.charCodeAt(pos + 2) === 96) {\n return { type: 'code_fence', skip: true, hasInlineSolve: false };\n }\n if (c0 === 126 && pos + 2 < len && input.charCodeAt(pos + 1) === 126 && input.charCodeAt(pos + 2) === 126) {\n return { type: 'code_fence', skip: true, hasInlineSolve: false };\n }\n\n // ── Math fence: $$ ────────────────────────────────────────────────\n if (c0 === 36 && pos + 1 < len && input.charCodeAt(pos + 1) === 36) {\n return { type: 'math_fence', skip: true, hasInlineSolve: false };\n }\n\n // ── Horizontal rule: ---, ***, ___ (3+ same char, then only whitespace)\n if (c0 === 45 || c0 === 42 || c0 === 95) {\n let count = 1;\n while (pos + count < len && input.charCodeAt(pos + count) === c0) {\n count++;\n }\n if (count >= 3) {\n let trailPos = pos + count;\n while (trailPos < len && (input.charCodeAt(trailPos) === 32 || input.charCodeAt(trailPos) === 9)) {\n trailPos++;\n }\n if (trailPos >= len) {\n return { type: 'hr', skip: true, hasInlineSolve: false };\n }\n }\n }\n\n // ── Unordered list: - ' ', * ' ', + ' ' ──────────────────────────\n if ((c0 === 45 || c0 === 42 || c0 === 43) && pos + 1 < len && input.charCodeAt(pos + 1) === 32) {\n if (hasInline === undefined) hasInline = this.hasInlineSolveWithin(pos, len);\n // The space is what makes this a marker rather than an operator, and it\n // is required by CommonMark for exactly that reason. `-100 + 20` has no\n // space and stays arithmetic; `- 100 + 20` is a bullet.\n return { type: 'list', skip: false, hasInlineSolve: hasInline, contentOffset: this.skipMarkerGap(pos + 1, len) };\n }\n\n // ── Ordered list: \\n+ '. ' ────────────────────────────────────────\n if (c0 >= 48 && c0 <= 57) {\n let digitPos = pos;\n while (digitPos < len && input.charCodeAt(digitPos) >= 48 && input.charCodeAt(digitPos) <= 57) {\n digitPos++;\n }\n if (digitPos < len && input.charCodeAt(digitPos) === 46) {\n if (digitPos + 1 < len && input.charCodeAt(digitPos + 1) === 32) {\n if (hasInline === undefined) hasInline = this.hasInlineSolveWithin(pos, len);\n return { type: 'list', skip: false, hasInlineSolve: hasInline, contentOffset: this.skipMarkerGap(digitPos + 1, len) };\n }\n }\n }\n\n // ── Table / table separator: | ────────────────────────────────────\n if (c0 === 124) {\n let tPos = pos + 1;\n while (tPos < len) {\n const tc = input.charCodeAt(tPos);\n if (tc !== 45 && tc !== 58 && tc !== 124 && tc !== 32 && tc !== 9 && tc !== 13) break;\n tPos++;\n }\n if (tPos >= len) {\n return { type: 'table_separator', skip: true, hasInlineSolve: false };\n }\n }\n\n // ── Wikilink / embed: [[ or ![[ ───────────────────────────────────\n if (c0 === 91 && pos + 1 < len && input.charCodeAt(pos + 1) === 91) {\n const closePos = this.indexOfWithin(']]', pos + 2, len);\n if (closePos !== -1) {\n let trailPos = closePos + 2;\n while (trailPos < len && (input.charCodeAt(trailPos) === 32 || input.charCodeAt(trailPos) === 9)) {\n trailPos++;\n }\n if (trailPos >= len) {\n return { type: 'wikilink', skip: true, hasInlineSolve: false };\n }\n }\n }\n if (c0 === 33 && pos + 2 < len && input.charCodeAt(pos + 1) === 91 && input.charCodeAt(pos + 2) === 91) {\n const closePos = this.indexOfWithin(']]', pos + 3, len);\n if (closePos !== -1) {\n let trailPos = closePos + 2;\n while (trailPos < len && (input.charCodeAt(trailPos) === 32 || input.charCodeAt(trailPos) === 9)) {\n trailPos++;\n }\n if (trailPos >= len) {\n return { type: 'wikilink', skip: true, hasInlineSolve: false };\n }\n }\n }\n\n // ── Comment: // ──────────────────────────────────────────────────\n if (c0 === 47 && pos + 1 < len && input.charCodeAt(pos + 1) === 47) {\n return { type: 'comment', skip: true, hasInlineSolve: false };\n }\n\n // ── Default: expression or prose line ─────────────────────────────\n if (c0 === 62) {\n let trail = pos + 1;\n while (trail < len && (input.charCodeAt(trail) === 32 || input.charCodeAt(trail) === 9)) trail++;\n if (trail >= len) return { type: 'blockquote', skip: true, hasInlineSolve: false };\n }\n if (c0 === 45 || c0 === 42 || c0 === 43) {\n let trail = pos + 1;\n while (trail < len && (input.charCodeAt(trail) === 32 || input.charCodeAt(trail) === 9)) trail++;\n if (trail >= len) return { type: 'list', skip: false, hasInlineSolve: false };\n }\n if (hasInline === undefined) hasInline = this.hasInlineSolveWithin(pos, len);\n\n // A line built only from characters the tokenizer discards produces no\n // tokens, so it has nothing to evaluate. Whitespace-only lines already\n // classify as empty above; the gap was an unknown ASCII character like a\n // backslash, which the lexer skips (it falls through to CharClass.SKIP)\n // rather than tokenising. A run of them (\"\\\\\", \"\\\\\\\\\") reached the\n // expression path, lexed to an empty token stream, and the engine reported\n // that stream as the number 0: a result on screen for a line that holds no\n // expression at all. Classify it as empty, the same as a blank line, so\n // every surface (the batch parse, the incremental evaluator, and the\n // playground's shouldEvaluateLine) skips it rather than answering 0. A\n // non-ASCII code point is real content (it lexes as an IDENT for forward\n // compatibility), so only ASCII whitespace and skip characters count here.\n if (!hasInline) {\n let onlySkippable = true;\n for (let i = pos; i < len; i++) {\n const code = input.charCodeAt(i);\n if (code >= 128 || ExpressionLexer.CHAR_CLASS[code] > CharClass.WHITESPACE) {\n onlySkippable = false;\n break;\n }\n }\n if (onlySkippable) {\n return { type: 'empty', skip: true, hasInlineSolve: false };\n }\n }\n\n // Return expression, all non-markdown-structure lines are tokenized.\n // (L1 prose gating removed: it incorrectly skipped keyword-only lines\n // like \"pi\", single identifiers like \"hello\", and any line without\n // digits/operators/currency. Can be re-added with keyword-awareness\n // and proper test coverage.)\n return { type: 'expression', skip: false, hasInlineSolve: hasInline };\n }\n\n /**\n * Classify a single line of markdown text.\n */\n classifyLine(lineText: string): LineClassification {\n const savedInput = this.input;\n const savedLen = this.len;\n const savedPos = this.pos;\n this.input = lineText;\n this.len = lineText.length;\n this.pos = 0;\n const result = this.classifyFromPositions(0, lineText.length);\n this.input = savedInput;\n this.len = savedLen;\n this.pos = savedPos;\n return result;\n }\n\n /**\n * Every keyword this lexer currently recognizes, locale keywords\n * (`pi`, `sqrt`, `convert`, ...) merged with any plugin-contributed ones\n * from `registerVocabulary()` (e.g. a package's custom keywords), mapped to\n * the token type they lex to. A snapshot copy, not a live reference\n * mutating the return value has no effect on the lexer.\n */\n getKeywords(): Record<string, string> {\n return Object.fromEntries(this.mergedKeywords);\n }\n\n /**\n * Find all inline solve markers in a line with precise coordinate mapping.\n */\n findInlineSolves(lineText: string): InlineSolveSpan[] {\n const results: InlineSolveSpan[] = [];\n const len = lineText.length;\n let pos = 0;\n\n while (pos < len) {\n const sPos = lineText.indexOf('s`', pos);\n if (sPos === -1) break;\n\n const exprStart = sPos + 2;\n\n let exprEnd = exprStart;\n while (exprEnd < len) {\n const cc = lineText.charCodeAt(exprEnd);\n if (cc === 92 && exprEnd + 1 < len) {\n exprEnd += 2;\n continue;\n }\n if (cc === 96) break;\n exprEnd++;\n }\n\n if (exprEnd >= len) {\n exprEnd = len;\n }\n\n const expression = lineText.slice(exprStart, exprEnd);\n const end = exprEnd < len ? exprEnd + 1 : exprEnd;\n\n results.push({\n start: sPos,\n end,\n expression,\n columnNumber: sPos + 1,\n });\n\n pos = end;\n }\n\n return results;\n }\n\n // ── Comment tokenizer ─────────────────────────────────────────────────\n /**\n * Reads a comment: # to end of line, or // to end of line.\n */\n private tokenizeComment(): Token {\n const input = this.input;\n const len = this.len;\n const start = this.pos;\n const startCol = start - this.lineStartPos + 1;\n\n // A `#hex` colour literal is not a comment. Recognised here (the single\n // choke-point both `#` call sites reach) so `#ff0000` becomes a HEX_COLOUR\n // token while `# comment`, `#tag`, `#face` (length 4 all-hex still counts as a\n // colour) and `// c` stay comments. Only fires when the char is `#`, never `/`.\n if (input.charCodeAt(start) === 35) {\n const hexEnd = this.matchHexColourEnd(start, len);\n if (hexEnd !== -1) {\n const text = input.slice(start, hexEnd);\n this.pos = hexEnd;\n return new LexerToken('HEX_COLOUR', TT_HEX_COLOUR, text, text, start, 0, this.line, startCol);\n }\n\n // A bounded `#tag` annotation: `#` then a letter then a run of\n // `[A-Za-z0-9_-]`, consuming only the tag, not the rest of the line. So\n // `1200 #housing // note` keeps the `// note` comment, and a mid-line tag\n // no longer swallows the line. `# ` (space) and `#123` (leading digit)\n // still fall through to a comment; a line-start `#` is a heading\n // (classified elsewhere); a `#hex` colour is caught above.\n const first = input.charCodeAt(start + 1);\n const isLetter = (first >= 65 && first <= 90) || (first >= 97 && first <= 122);\n // #198: a `#` glued to the end of a word or number is not a tag. The\n // category-tag scanner (packages/tags/TagScanner.ts) only counts a tag at\n // a non-word boundary (`(?:^|[^0-9A-Za-z_])#...`), so `100#food`, `$100#food`\n // and `a#b` are excluded there; the lexer must agree, or a line renders\n // tagged but is silently left out of the totals. A line-first `#` never\n // reaches here (the classifier makes it a heading), so a mid-line tag only\n // needs its preceding character to be a non-word char.\n const prevCode = start > this.lineStartPos ? input.charCodeAt(start - 1) : -1;\n const prevIsWordChar =\n (prevCode >= 48 && prevCode <= 57) ||\n (prevCode >= 65 && prevCode <= 90) ||\n (prevCode >= 97 && prevCode <= 122) ||\n prevCode === 95;\n if (isLetter && !prevIsWordChar) {\n let tagEnd = start + 2;\n while (tagEnd < len) {\n const c = input.charCodeAt(tagEnd);\n const isTagChar = (c >= 48 && c <= 57) || (c >= 65 && c <= 90) || (c >= 97 && c <= 122) || c === 95 || c === 45;\n if (!isTagChar) break;\n tagEnd++;\n }\n // Store the name without the `#`, matching how LINE_REF keeps the bare\n // number.\n const name = input.slice(start + 1, tagEnd);\n this.pos = tagEnd;\n return new LexerToken('TAG', TT_TAG, name, name, start, 0, this.line, startCol);\n }\n }\n\n let pos = this.pos;\n\n if (pos + 1 < len && input.charCodeAt(pos + 1) === 47) {\n pos += 2;\n } else {\n pos++;\n }\n\n while (pos < len) {\n const c0 = input.charCodeAt(pos);\n if (c0 === 10 || c0 === 13) break;\n pos++;\n }\n\n const text = input.slice(start, pos);\n this.pos = pos;\n return new LexerToken('COMMENT', TT_COMMENT, text, text, start, 0, this.line, startCol);\n }\n}","/**\n * The engine's own multi-word phrases and the token each one fuses into.\n *\n * One table, read by two consumers: the lexer's token lookup\n * (`lexer/tokenRegistration.ts`) and the normalizer's phrase trie\n * (`engine/ExpressionEngine.ts`, via `normalizer/BuiltinNormalizerRules.ts`).\n * It used to be two hand-copied tables, and they drifted: the lexer's copy\n * never learned \"divided by\". A phrase added here reaches both.\n *\n * @module BuiltinPhrases\n */\n\n/** Built-in phrase → token type. See the module doc. */\nexport const BUILTIN_PHRASES: Record<string, string> = {\n\t\"to the power of\": \"CARET\",\n\t\"power of\": \"CARET\",\n\t\"increase by\": \"INCREASE_BY\",\n\t\"decrease by\": \"DECREASE_BY\",\n\t\"times by\": \"TIMES_BY\",\n\t\"multiply by\": \"MULTIPLY_BY\",\n\t\"divide by\": \"DIVIDE_BY\",\n\t// The past-tense spellings, which is how the operation is usually written\n\t// out: \"3 multiplied by 4\". Same tokens, so no new parselets.\n\t\"multiplied by\": \"MULTIPLY_BY\",\n\t\"divided by\": \"DIVIDE_BY\",\n};\n"]}
@@ -1,2 +0,0 @@
1
- import {c as c$1}from'./chunk-RELMEWY6.js';var d=0,l=0,c=Number.POSITIVE_INFINITY,h=0,y=Number.POSITIVE_INFINITY;function g(e,t,r){return c$1.execution({code:"ALLOCATION_LIMIT_EXCEEDED",message:`Evaluating this expression would materialise ${e.toLocaleString("en-US")} ${t}, past the limit of ${c.toLocaleString("en-US")} elements for one evaluation`,expected:`at most ${c.toLocaleString("en-US")} elements materialised while evaluating one expression`,found:`a request for ${e.toLocaleString("en-US")} more ${t}, on top of ${r.toLocaleString("en-US")} already materialised`,suggestion:"use a smaller collection or matrix, or raise the engine's vm.maxAllocatedElements setting",context:{requested:e,what:t,used:r,limit:c}})}function M(e){d++===0&&(l=0,c=e.getMaxAllocatedElements(),h=0,y=e.getMaxFunctionCalls());}function _(){d>0&&d--;}function D(e,t){if(d!==0){if(!(e>=0))throw g(e,t,l);if(l+=e,l>c)throw g(e,t,l-e)}}function S(e,t){if(d!==0&&(!(e>=0)||l+e>c))throw g(e,t,l)}function R(e,t){return S(e,t),new Array(e)}function P(){if(d!==0&&++h>y)throw c$1.execution({code:"FUNCTION_CALL_LIMIT_EXCEEDED",message:`Evaluating this expression would make more than ${y.toLocaleString("en-US")} user-defined-function calls, which is the limit for one evaluation`,expected:`at most ${y.toLocaleString("en-US")} function calls while evaluating one expression`,found:"a call past that limit, from a chain of functions that each call others more than once",suggestion:"check for a function that calls itself (or a chain of them) more times than intended, or raise the engine's vm.maxFunctionCalls setting",context:{calls:h,callLimit:y}})}var N=(n=>(n[n.Number=0]="Number",n[n.Hex=1]="Hex",n[n.BigInt=2]="BigInt",n[n.String=3]="String",n[n.Datetime=4]="Datetime",n[n.Percentage=5]="Percentage",n[n.Uom=6]="Uom",n[n.Matrix=7]="Matrix",n[n.Range=8]="Range",n[n.Symbolic=9]="Symbolic",n[n.Boolean=10]="Boolean",n[n.Unit=11]="Unit",n[n.Pending=12]="Pending",n[n.Error=13]="Error",n[n.Colour=14]="Colour",n[n.Split=15]="Split",n[n.Chart=16]="Chart",n[n.IpCidr=17]="IpCidr",n))(N||{}),m=class m{constructor(t=512){this.arena=[];this.index=0;this.initialSize=t;for(let r=0;r<t;r++)this.arena.push(new a(0,0));}acquire(t,r,o){if(this.index<this.arena.length){let s=this.arena[this.index++];return s.recycle(t,r,o),s}let f=new a(t,r,o);return this.arena.push(f),this.index++,f}reset(){let t=this.index;this.index=0,!(this.arena.length<=this.initialSize)&&(this.arena.length<=t*m.SHRINK_WHEN_HOLDING_TIMES||(this.arena.length=Math.max(this.initialSize,t*m.KEEP_TIMES)));}get usage(){return this.index}get capacity(){return this.arena.length}};m.SHRINK_WHEN_HOLDING_TIMES=4,m.KEEP_TIMES=2;var b=m,i=null,u=false;function A(e){return i||(i=new b(e)),i.reset(),u=true,i}function O(){u=false;}function C(){return u}function $(e){let t=new a(e.type,e.value,e.unit);return e.exact!==void 0&&(t.exact=e.exact),e.rational!==void 0&&(t.rational=e.rational),e.uncertainty!==void 0&&(t.uncertainty=e.uncertainty),e.grain!==void 0&&(t.grain=e.grain),e.zone!==void 0&&(t.zone=e.zone),t}var E=process.env.NODE_ENV==="development";function q(e){return E&&!C()&&(e.toNumber(),Object.freeze(e)),e}var a=class{constructor(t,r,o){this.type=t,this.value=r,this.unit=o,typeof r=="number"&&(this._cachedNumber=r);}recycle(t,r,o){this.type=t,this.value=r,this.unit=o,this._cachedNumber=typeof r=="number"?r:void 0,this.timedOut=void 0,this.exact=void 0,this.rational=void 0,this.uncertainty=void 0,this.decimalPlaces=void 0,this.grain=void 0,this.zone=void 0;}isNumber(){return this.type===0}isHex(){return this.type===1}isBigInt(){return this.type===2}isString(){return this.type===3}isMatrix(){return this.type===7}isVectorShape(){if(this.type!==7)return false;let t=this.value;return t.rows===1||t.cols===1}isRange(){return this.type===8}isColour(){return this.type===14}isChart(){return this.type===16}isIpCidr(){return this.type===17}isSymbolic(){return this.type===9}isError(){return this.type===13}isPending(){return this.type===12}isFault(){return this.type===13||this.type===12}get errorCode(){return this.type===13?this.value:void 0}get errorMessage(){return this.type===13?this.unit:void 0}toNumber(){if(this.type===12||this.type===13)return 0;if(this.type===7){let r=this.value;return r.rows===1&&r.cols===1&&typeof r.data[0]=="number"?r.data[0]:0}if(this.type===8||this.type===14||this.type===16)return 0;if(this.type===17)return this.value.addr??0;if(this.type===15)return this.value.shares[0].value;if(this.type===9)return 0;if(this.type===10)return this.value===true?1:0;if(this._cachedNumber!==void 0)return this._cachedNumber;if(typeof this.value=="bigint")return this._cachedNumber=Number(this.value),this._cachedNumber;let t=parseFloat(this.value);return this._cachedNumber=isNaN(t)?0:t,this._cachedNumber}isNaN(){if(this.type===12||this.type===13)return false;if(this.type===7){let t=this.value;return t.rows===1&&t.cols===1&&typeof t.data[0]=="number"?isNaN(t.data[0]):false}return this.type===8||this.type===14||this.type===15||this.type===16||this.type===17||this.type===9||this.type===10?false:typeof this.value=="number"?isNaN(this.value):typeof this.value=="bigint"?false:isNaN(parseFloat(this.value))}};function x(e){return u&&i?i.acquire(0,e):new a(0,e)}function B(e,t){let r=x(e);return r.exact=t,r}function H(e,t){let r=x(e);return r.rational=t,r}function z(e,t){let r=x(e);return r.uncertainty=t,r}function k(e,t="hex"){let r=t==="hex"?void 0:t;return u&&i?i.acquire(1,e,r):new a(1,e,r)}function j(e){return u&&i?i.acquire(2,e):new a(2,e)}function K(e){return u&&i?i.acquire(3,e):new a(3,e)}function T(e,t){return u&&i?i.acquire(6,e,t):new a(6,e,t)}function G(e,t,r){let o=T(e,t);return o.exact=r,o}function Y(e,t,r){return T(e,`${t}/${r}`)}function W(e){return typeof e=="string"&&e.includes("/")}function X(e){let t=e.indexOf("/");if(t<0)throw c$1.internal("INVALID_RATE_UNIT",`splitRateUnit: "${e}" is not a rate unit (expected "numerator/denominator")`,{unit:e});return {numerator:e.slice(0,t),denominator:e.slice(t+1)}}var V="timecode@";function J(e){return `${V}${e}`}function v(e){return typeof e=="string"&&e.startsWith(V)}function Q(e){if(!v(e))throw c$1.internal("INVALID_TIMECODE_UNIT",`timecodeFps: "${e}" is not a timecode unit (expected "timecode@<fps>")`,{unit:e});return parseFloat(e.slice(V.length))}function I(e,t,r){D(r.length,"matrix cells");let o=r.some(s=>typeof s=="object"&&s!==null&&"kind"in s),f={rows:e,cols:t,data:r,hasSymbolic:o};return u&&i?i.acquire(7,f):new a(7,f)}function Z(e){return I(1,e.length,e)}function ee(e){return I(e.length,1,e)}function te(e,t){let r={min:e,max:t};return u&&i?i.acquire(8,r):new a(8,r)}function re(e){return u&&i?i.acquire(14,e):new a(14,e)}function ne(e){return u&&i?i.acquire(15,e):new a(15,e)}function ie(e){return u&&i?i.acquire(16,e):new a(16,e)}function ae(e){return u&&i?i.acquire(17,e):new a(17,e)}function ue(e){return u&&i?i.acquire(9,e):new a(9,e)}function oe(e){return u&&i?i.acquire(10,e):new a(10,e)}function le(e,t,r){let o=u&&i?i.acquire(4,e):new a(4,e);return t!==void 0&&(o.grain=t),r!==void 0&&(o.zone=r),o}function se(e){return u&&i?i.acquire(5,e):new a(5,e)}function pe(e){return new a(12,e)}function ce(e,t){return new a(13,e,t)}function de(e,t,r){return e.type===13||e.type===12?e:t!==void 0&&(t.type===13||t.type===12)?t:r!==void 0&&(r.type===13||r.type===12)?r:null}function me(e){for(let t=0;t<e.length;t++){let r=e[t];if(r.type===13||r.type===12)return r}return null}export{v as A,Q as B,I as C,Z as D,ee as E,te as F,re as G,ne as H,ie as I,ae as J,ue as K,oe as L,le as M,se as N,pe as O,ce as P,de as Q,me as R,M as a,_ as b,D as c,S as d,R as e,P as f,N as g,A as h,O as i,C as j,$ as k,q as l,a as m,x as n,B as o,H as p,z as q,k as r,j as s,K as t,T as u,G as v,Y as w,W as x,X as y,J as z};//# sourceMappingURL=chunk-X5K72MBV.js.map
2
- //# sourceMappingURL=chunk-X5K72MBV.js.map