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