solve-engine 1.2.0 → 2.1.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-2LFLR3VZ.cjs +2 -0
- package/dist/chunk-2LFLR3VZ.cjs.map +1 -0
- package/dist/chunk-2RWAXT6O.js +0 -1
- package/dist/chunk-32GC2FHC.cjs +2 -0
- package/dist/chunk-32GC2FHC.cjs.map +1 -0
- package/dist/chunk-4BZIYU7S.cjs +3 -0
- package/dist/chunk-4BZIYU7S.cjs.map +1 -0
- package/dist/chunk-4E4YVQKK.js +5 -0
- package/dist/chunk-4E4YVQKK.js.map +1 -0
- package/dist/chunk-4QVBSG6B.cjs +2 -0
- package/dist/chunk-4QVBSG6B.cjs.map +1 -0
- package/dist/chunk-5FO4PDIG.js +2 -0
- package/dist/chunk-5FO4PDIG.js.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-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-76F3LCIL.js +4 -0
- package/dist/chunk-76F3LCIL.js.map +1 -0
- package/dist/chunk-7BXPCWKM.cjs +2 -0
- package/dist/chunk-7BXPCWKM.cjs.map +1 -0
- package/dist/chunk-7GK3XEZF.js +2 -0
- package/dist/chunk-7GK3XEZF.js.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-E2Q3PQ2G.js +3 -0
- package/dist/chunk-E2Q3PQ2G.js.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-EVI6OHQH.cjs +2 -0
- package/dist/chunk-EVI6OHQH.cjs.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-G7TBEQRQ.js +2 -0
- package/dist/chunk-G7TBEQRQ.js.map +1 -0
- package/dist/chunk-GK2OHWRF.cjs +5 -0
- package/dist/chunk-GK2OHWRF.cjs.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-I52MYCVI.js +3 -0
- package/dist/chunk-I52MYCVI.js.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-JUIJ6NRD.cjs +3 -0
- package/dist/chunk-JUIJ6NRD.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-OVKDDTXO.cjs +3 -0
- package/dist/chunk-OVKDDTXO.cjs.map +1 -0
- 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-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-SYYE3QAX.cjs +2 -0
- package/dist/chunk-SYYE3QAX.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-TN5E6JU6.js +2 -0
- package/dist/chunk-TN5E6JU6.js.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-U4AEVL5Z.js +2 -0
- package/dist/chunk-U4AEVL5Z.js.map +1 -0
- package/dist/chunk-UURM7P3P.cjs +4 -0
- package/dist/chunk-UURM7P3P.cjs.map +1 -0
- package/dist/chunk-VAGS5JS7.cjs +2 -0
- package/dist/chunk-VAGS5JS7.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-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-Y7O4D3BJ.cjs +2 -0
- package/dist/chunk-Y7O4D3BJ.cjs.map +1 -0
- package/dist/chunk-YAHGSBMC.js +2 -0
- package/dist/chunk-YAHGSBMC.js.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-YJHY7CMN.cjs.map +0 -1
- 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-RNKDIXDV.js
DELETED
|
@@ -1,336 +0,0 @@
|
|
|
1
|
-
import { getTokenCategory } from './chunk-LSALB3IN.js';
|
|
2
|
-
import { ExpressionLexer } from './chunk-ORM7CHYZ.js';
|
|
3
|
-
import { getLocale } from './chunk-XBTEO4OB.js';
|
|
4
|
-
import { knownUnits } from './chunk-SBUFNJVE.js';
|
|
5
|
-
|
|
6
|
-
// src/lexer/LexerState.ts
|
|
7
|
-
var LexerState = /* @__PURE__ */ ((LexerState2) => {
|
|
8
|
-
LexerState2["Main"] = "main";
|
|
9
|
-
LexerState2["Inline"] = "inline";
|
|
10
|
-
LexerState2["String"] = "string";
|
|
11
|
-
return LexerState2;
|
|
12
|
-
})(LexerState || {});
|
|
13
|
-
|
|
14
|
-
// src/lexer/Lexer.ts
|
|
15
|
-
var Lexer = class {
|
|
16
|
-
/**
|
|
17
|
-
* @param localeCode - Locale code (e.g., "en", "de"). Defaults to "en".
|
|
18
|
-
* @param tokenLookup - Optional TokenLookup from TokenClassRegistry.
|
|
19
|
-
* When provided, configures ExpressionLexer to use registry-built
|
|
20
|
-
* keyword/unit/phrase lookups instead of internal instance maps.
|
|
21
|
-
*/
|
|
22
|
-
constructor(localeCode = "en", tokenLookup) {
|
|
23
|
-
this.currentState = "main" /* Main */;
|
|
24
|
-
this.hasPeeked = false;
|
|
25
|
-
// Materialized token array from the last reset() call, used for
|
|
26
|
-
// next()/peek() streaming access.
|
|
27
|
-
this.tokens = [];
|
|
28
|
-
this.tokenIdx = 0;
|
|
29
|
-
this.expressionLexer = new ExpressionLexer(localeCode, tokenLookup);
|
|
30
|
-
}
|
|
31
|
-
reset(input, state) {
|
|
32
|
-
const newState = state ?? "main" /* Main */;
|
|
33
|
-
this.currentState = newState;
|
|
34
|
-
this.hasPeeked = false;
|
|
35
|
-
this.peekedToken = void 0;
|
|
36
|
-
if (newState === "main" /* Main */) {
|
|
37
|
-
const classification = this.expressionLexer.classifyLine(input);
|
|
38
|
-
if (classification.skip) {
|
|
39
|
-
this.tokens = [];
|
|
40
|
-
this.tokenIdx = 0;
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
this.expressionLexer.reset(input);
|
|
44
|
-
this.tokens = this.expressionLexer.tokenizeAll();
|
|
45
|
-
this.tokenIdx = 0;
|
|
46
|
-
} else {
|
|
47
|
-
this.expressionLexer.reset(input);
|
|
48
|
-
this.tokens = this.expressionLexer.tokenizeAll();
|
|
49
|
-
this.tokenIdx = 0;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Classify a single line of markdown text (Phase B).
|
|
54
|
-
* Delegates to the ExpressionLexer's character-by-character scanner.
|
|
55
|
-
*/
|
|
56
|
-
classifyLine(lineText) {
|
|
57
|
-
return this.expressionLexer.classifyLine(lineText);
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Find all inline solve markers in a line (Phase B).
|
|
61
|
-
* Delegates to the ExpressionLexer's character-by-character scanner.
|
|
62
|
-
*/
|
|
63
|
-
findInlineSolves(lineText) {
|
|
64
|
-
return this.expressionLexer.findInlineSolves(lineText);
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Every keyword this lexer currently recognizes (locale + plugin-contributed),
|
|
68
|
-
* mapped to the token type it lexes to. Delegates to the ExpressionLexer.
|
|
69
|
-
*/
|
|
70
|
-
getKeywords() {
|
|
71
|
-
return this.expressionLexer.getKeywords();
|
|
72
|
-
}
|
|
73
|
-
next() {
|
|
74
|
-
if (this.hasPeeked) {
|
|
75
|
-
this.hasPeeked = false;
|
|
76
|
-
return this.peekedToken;
|
|
77
|
-
}
|
|
78
|
-
if (this.tokenIdx < this.tokens.length) {
|
|
79
|
-
return this.tokens[this.tokenIdx++];
|
|
80
|
-
}
|
|
81
|
-
return void 0;
|
|
82
|
-
}
|
|
83
|
-
peek() {
|
|
84
|
-
if (this.hasPeeked) return this.peekedToken;
|
|
85
|
-
this.peekedToken = this.next();
|
|
86
|
-
this.hasPeeked = true;
|
|
87
|
-
return this.peekedToken;
|
|
88
|
-
}
|
|
89
|
-
[Symbol.iterator]() {
|
|
90
|
-
return this.tokens[Symbol.iterator]();
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Register a plugin to extend the lexer with custom tokens.
|
|
94
|
-
* Delegates to the underlying ExpressionLexer.
|
|
95
|
-
*
|
|
96
|
-
* @see LexerVocabulary for the supported extension points.
|
|
97
|
-
*/
|
|
98
|
-
registerVocabulary(plugin) {
|
|
99
|
-
this.expressionLexer.registerVocabulary(plugin);
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* Unregister a plugin, removing its custom tokens from the lexer.
|
|
103
|
-
* Delegates to the underlying ExpressionLexer.
|
|
104
|
-
*/
|
|
105
|
-
unregisterVocabulary(plugin) {
|
|
106
|
-
this.expressionLexer.unregisterVocabulary(plugin);
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* Reset the lexer for expression-only text, skips the classifyLine()
|
|
110
|
-
* overhead in reset() for callers that already know the input is an
|
|
111
|
-
* evaluable expression (e.g., after isEmptyLine() confirmed non-skip).
|
|
112
|
-
*/
|
|
113
|
-
resetExpression(input) {
|
|
114
|
-
this.currentState = "main" /* Main */;
|
|
115
|
-
this.hasPeeked = false;
|
|
116
|
-
this.peekedToken = void 0;
|
|
117
|
-
this.expressionLexer.reset(input);
|
|
118
|
-
this.tokens = this.expressionLexer.tokenizeAll();
|
|
119
|
-
this.tokenIdx = 0;
|
|
120
|
-
}
|
|
121
|
-
/**
|
|
122
|
-
* Scan a full document in one pass, classifying each line and
|
|
123
|
-
* tokenizing non-skipped lines. Delegates to ExpressionLexer.
|
|
124
|
-
*
|
|
125
|
-
* @returns ScanLineResult[], one per line, with classification + tokens.
|
|
126
|
-
*/
|
|
127
|
-
scanDocument(text) {
|
|
128
|
-
return this.expressionLexer.scanDocument(text);
|
|
129
|
-
}
|
|
130
|
-
getState() {
|
|
131
|
-
return this.currentState;
|
|
132
|
-
}
|
|
133
|
-
setState(state) {
|
|
134
|
-
this.currentState = state;
|
|
135
|
-
}
|
|
136
|
-
getHighlightTokens(lineText) {
|
|
137
|
-
const classification = this.expressionLexer.classifyLine(lineText);
|
|
138
|
-
if (classification.skip && lineText.startsWith("> ")) {
|
|
139
|
-
return this.collectHighlightTokens(lineText.slice(2));
|
|
140
|
-
}
|
|
141
|
-
if (classification.skip) {
|
|
142
|
-
return [];
|
|
143
|
-
}
|
|
144
|
-
return this.collectHighlightTokens(lineText);
|
|
145
|
-
}
|
|
146
|
-
/**
|
|
147
|
-
* The same tokens {@link getHighlightTokens} reduces, before reduction.
|
|
148
|
-
*
|
|
149
|
-
* Exists because normalization operates on tokens, not on the flattened
|
|
150
|
-
* shape, and a consumer that wants phrase-fused highlighting has to run the
|
|
151
|
-
* normalizer between the two. See `LanguageService.getSemanticTokens`.
|
|
152
|
-
*
|
|
153
|
-
* @param lineText - One line of source.
|
|
154
|
-
* @returns Every token on the line that is worth painting, unreduced.
|
|
155
|
-
*/
|
|
156
|
-
getHighlightTokenObjects(lineText) {
|
|
157
|
-
const classification = this.expressionLexer.classifyLine(lineText);
|
|
158
|
-
if (classification.skip && lineText.startsWith("> ")) {
|
|
159
|
-
return this.collectTokenObjects(lineText.slice(2));
|
|
160
|
-
}
|
|
161
|
-
if (classification.skip) return [];
|
|
162
|
-
return this.collectTokenObjects(lineText);
|
|
163
|
-
}
|
|
164
|
-
collectTokenObjects(lineText) {
|
|
165
|
-
this.resetExpression(lineText);
|
|
166
|
-
const result = [];
|
|
167
|
-
for (const token of this) {
|
|
168
|
-
if (token.type === "WS" || token.type === "NEWLINE") continue;
|
|
169
|
-
if (token.type.startsWith("MD_")) continue;
|
|
170
|
-
if (token.type === "INLINE_SOLVE_START" || token.type === "BACKTICK_CLOSE") continue;
|
|
171
|
-
result.push(token);
|
|
172
|
-
}
|
|
173
|
-
return result;
|
|
174
|
-
}
|
|
175
|
-
collectHighlightTokens(lineText) {
|
|
176
|
-
return this.collectTokenObjects(lineText).map((token) => ({
|
|
177
|
-
type: token.type,
|
|
178
|
-
value: token.value,
|
|
179
|
-
offset: token.offset,
|
|
180
|
-
col: token.col,
|
|
181
|
-
// `text`, not `value`: this is a span into the source, and the two
|
|
182
|
-
// differ for a string literal, whose value is the payload while its
|
|
183
|
-
// text still carries the quote characters the reader typed.
|
|
184
|
-
length: token.text.length,
|
|
185
|
-
category: getTokenCategory(token.type)
|
|
186
|
-
}));
|
|
187
|
-
}
|
|
188
|
-
};
|
|
189
|
-
var sharedLexer = new Lexer("en", void 0);
|
|
190
|
-
|
|
191
|
-
// src/lexer/TokenClassRegistry.ts
|
|
192
|
-
var TokenClassRegistry = class {
|
|
193
|
-
constructor() {
|
|
194
|
-
this.classes = [];
|
|
195
|
-
this.localeKeywordMap = null;
|
|
196
|
-
this.localePhraseMap = null;
|
|
197
|
-
this.unitNames = null;
|
|
198
|
-
}
|
|
199
|
-
/**
|
|
200
|
-
* Register a provider's TokenClass. Must be called BEFORE build().
|
|
201
|
-
* Can be called multiple times to add more entries.
|
|
202
|
-
*
|
|
203
|
-
* Built-in token types CANNOT be overridden, throws a EngineError
|
|
204
|
-
* if the TokenClass attempts to register a keyword that conflicts
|
|
205
|
-
* with an already-registered token type.
|
|
206
|
-
*/
|
|
207
|
-
register(tokenClass) {
|
|
208
|
-
this.classes.push(tokenClass);
|
|
209
|
-
}
|
|
210
|
-
/**
|
|
211
|
-
* Unregister all TokenClasses for a given token type.
|
|
212
|
-
* Useful for plugin unload. Requires rebuild() to take effect.
|
|
213
|
-
*/
|
|
214
|
-
unregister(tokenType) {
|
|
215
|
-
this.classes = this.classes.filter((c) => c.tokenType !== tokenType);
|
|
216
|
-
}
|
|
217
|
-
/**
|
|
218
|
-
* Set the locale's keyword→type map and optional phrase map.
|
|
219
|
-
* Called on locale change. Priority 0 (cannot override providers with higher priority).
|
|
220
|
-
*/
|
|
221
|
-
setLocale(keywordMap, phraseMap) {
|
|
222
|
-
this.localeKeywordMap = keywordMap;
|
|
223
|
-
this.localePhraseMap = phraseMap ?? null;
|
|
224
|
-
}
|
|
225
|
-
/**
|
|
226
|
-
* Set the unit name set. Called when unit list changes.
|
|
227
|
-
* Units are stored separately (checked AFTER keyword lookup fails).
|
|
228
|
-
*
|
|
229
|
-
* Takes a ReadonlySet because the caller's set is derived from the
|
|
230
|
-
* conversion tables and must not be mutated; this class only ever reads it.
|
|
231
|
-
*/
|
|
232
|
-
setUnits(unitNames) {
|
|
233
|
-
this.unitNames = unitNames;
|
|
234
|
-
}
|
|
235
|
-
/**
|
|
236
|
-
* Build the optimized TokenLookup from all registered sources.
|
|
237
|
-
*
|
|
238
|
-
* Merge order (later overrides earlier):
|
|
239
|
-
* 1. Locale keywords (priority 0)
|
|
240
|
-
* 2. Provider classes (sorted by priority ascending)
|
|
241
|
-
*
|
|
242
|
-
* Returns a frozen TokenLookup that the Lexer consumes.
|
|
243
|
-
* Call build() again after register()/setLocale()/setUnits() changes.
|
|
244
|
-
*/
|
|
245
|
-
build() {
|
|
246
|
-
const keywordToType = /* @__PURE__ */ new Map();
|
|
247
|
-
if (this.localeKeywordMap) {
|
|
248
|
-
for (const [keyword, tokenType] of Object.entries(this.localeKeywordMap)) {
|
|
249
|
-
keywordToType.set(keyword.toLowerCase(), tokenType);
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
const sorted = [...this.classes].sort((a, b) => (a.priority ?? 0) - (b.priority ?? 0));
|
|
253
|
-
for (const tc of sorted) {
|
|
254
|
-
for (const keyword of Object.keys(tc.keywords)) {
|
|
255
|
-
keywordToType.set(keyword.toLowerCase(), tc.tokenType);
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
const phraseTrie = this.buildPhraseTrie();
|
|
259
|
-
const phraseStartWords = this.buildPhraseStartWords();
|
|
260
|
-
return {
|
|
261
|
-
keywordToType,
|
|
262
|
-
phraseTrie,
|
|
263
|
-
phraseStartWords,
|
|
264
|
-
unitNames: this.unitNames ?? /* @__PURE__ */ new Set()
|
|
265
|
-
};
|
|
266
|
-
}
|
|
267
|
-
// ── Private helpers ─────────────────────────────────────────────────────
|
|
268
|
-
buildPhraseTrie() {
|
|
269
|
-
const root = { children: /* @__PURE__ */ new Map() };
|
|
270
|
-
if (this.localePhraseMap) {
|
|
271
|
-
for (const [phrase, tokenType] of Object.entries(this.localePhraseMap)) {
|
|
272
|
-
this.insertPhrase(root, phrase.toLowerCase(), tokenType);
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
for (const tc of this.classes) {
|
|
276
|
-
if (!tc.phrases) continue;
|
|
277
|
-
for (const phrase of Object.keys(tc.phrases)) {
|
|
278
|
-
this.insertPhrase(root, phrase.toLowerCase(), tc.tokenType);
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
return root.children.size > 0 ? root : null;
|
|
282
|
-
}
|
|
283
|
-
insertPhrase(root, phrase, tokenType) {
|
|
284
|
-
const words = phrase.split(" ");
|
|
285
|
-
let node = root;
|
|
286
|
-
for (const word of words) {
|
|
287
|
-
if (!node.children.has(word)) {
|
|
288
|
-
node.children.set(word, { children: /* @__PURE__ */ new Map() });
|
|
289
|
-
}
|
|
290
|
-
node = node.children.get(word);
|
|
291
|
-
}
|
|
292
|
-
if (!node.type) {
|
|
293
|
-
node.type = tokenType;
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
buildPhraseStartWords() {
|
|
297
|
-
const startWords = /* @__PURE__ */ new Set();
|
|
298
|
-
if (this.localePhraseMap) {
|
|
299
|
-
for (const phrase of Object.keys(this.localePhraseMap)) {
|
|
300
|
-
const first = phrase.split(" ")[0].toLowerCase();
|
|
301
|
-
startWords.add(first);
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
for (const tc of this.classes) {
|
|
305
|
-
if (!tc.phrases) continue;
|
|
306
|
-
for (const phrase of Object.keys(tc.phrases)) {
|
|
307
|
-
const first = phrase.split(" ")[0].toLowerCase();
|
|
308
|
-
startWords.add(first);
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
return startWords;
|
|
312
|
-
}
|
|
313
|
-
};
|
|
314
|
-
|
|
315
|
-
// src/lexer/tokenRegistration.ts
|
|
316
|
-
var BUILTIN_PHRASES = {
|
|
317
|
-
"to the power of": "CARET",
|
|
318
|
-
"power of": "CARET",
|
|
319
|
-
"increase by": "INCREASE_BY",
|
|
320
|
-
"decrease by": "DECREASE_BY",
|
|
321
|
-
"times by": "TIMES_BY",
|
|
322
|
-
"multiply by": "MULTIPLY_BY",
|
|
323
|
-
"multiplied by": "MULTIPLY_BY",
|
|
324
|
-
"divide by": "DIVIDE_BY"
|
|
325
|
-
};
|
|
326
|
-
function buildTokenLookup(localeCode = "en") {
|
|
327
|
-
const locale = getLocale(localeCode);
|
|
328
|
-
const registry = new TokenClassRegistry();
|
|
329
|
-
registry.setLocale(locale.keywordMap, BUILTIN_PHRASES);
|
|
330
|
-
registry.setUnits(knownUnits);
|
|
331
|
-
return registry.build();
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
export { Lexer, LexerState, buildTokenLookup, sharedLexer };
|
|
335
|
-
//# sourceMappingURL=chunk-RNKDIXDV.js.map
|
|
336
|
-
//# sourceMappingURL=chunk-RNKDIXDV.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/lexer/LexerState.ts","../src/lexer/Lexer.ts","../src/lexer/TokenClassRegistry.ts","../src/lexer/tokenRegistration.ts"],"names":["LexerState"],"mappings":";;;;;;AAMO,IAAK,UAAA,qBAAAA,WAAAA,KAAL;AACN,EAAAA,YAAA,MAAA,CAAA,GAAO,MAAA;AACP,EAAAA,YAAA,QAAA,CAAA,GAAS,QAAA;AACT,EAAAA,YAAA,QAAA,CAAA,GAAS,QAAA;AAHE,EAAA,OAAAA,WAAAA;AAAA,CAAA,EAAA,UAAA,IAAA,EAAA;;;ACaL,IAAM,QAAN,MAAY;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAkBjB,WAAA,CAAY,UAAA,GAAa,IAAA,EAAM,WAAA,EAA2B;AAf1D,IAAA,IAAA,CAAQ,YAAA,GAAA,MAAA;AAER,IAAA,IAAA,CAAQ,SAAA,GAAY,KAAA;AAIpB;AAAA;AAAA,IAAA,IAAA,CAAQ,SAAkB,EAAC;AAC3B,IAAA,IAAA,CAAQ,QAAA,GAAmB,CAAA;AAYzB,IAAA,IAAA,CAAK,eAAA,GAAkB,IAAI,eAAA,CAAgB,UAAA,EAAY,WAAW,CAAA;AAAA,EACpE;AAAA,EAEA,KAAA,CAAM,OAAe,KAAA,EAA0B;AAC7C,IAAA,MAAM,QAAA,GAAW,KAAA,IAAA,MAAA;AACjB,IAAA,IAAA,CAAK,YAAA,GAAe,QAAA;AACpB,IAAA,IAAA,CAAK,SAAA,GAAY,KAAA;AACjB,IAAA,IAAA,CAAK,WAAA,GAAc,MAAA;AAKnB,IAAA,IAAI,QAAA,KAAA,MAAA,aAA8B;AAChC,MAAA,MAAM,cAAA,GAAiB,IAAA,CAAK,eAAA,CAAgB,YAAA,CAAa,KAAK,CAAA;AAC9D,MAAA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AAA,EAAe,aAAA;AAAA,EACf,UAAA,EAAY,UAAA;AAAA,EACZ,aAAA,EAAe,aAAA;AAAA,EACf,eAAA,EAAiB,aAAA;AAAA,EACjB,WAAA,EAAa;AACf,CAAA;AAiBO,SAAS,gBAAA,CAAiB,aAAa,IAAA,EAAmB;AAC/D,EAAA,MAAM,MAAA,GAAkB,UAAU,UAAU,CAAA;AAC5C,EAAA,MAAM,QAAA,GAAW,IAAI,kBAAA,EAAmB;AAGxC,EAAA,QAAA,CAAS,SAAA,CAAU,MAAA,CAAO,UAAA,EAAY,eAAe,CAAA;AAGrD,EAAA,QAAA,CAAS,SAAS,UAAU,CAAA;AAG5B,EAAA,OAAO,SAAS,KAAA,EAAM;AACxB","file":"chunk-RNKDIXDV.js","sourcesContent":["/**\n * Lexer state machine modes.\n * - Main: document-level scanning with markdown classification\n * - Inline: expression embedded in markdown inline solve (`s\\`...\\``)\n * - String: inside a double-quoted string literal\n */\nexport enum LexerState {\n\tMain = \"main\",\n\tInline = \"inline\",\n\tString = \"string\",\n}\n","import { ExpressionLexer, LineClassification, LexerVocabulary, type ScanLineResult } from \"./ExpressionLexer\";\nimport { Token } from \"@solve-js/lexer/Token\";\nimport { LexerState } from \"@solve-js/lexer/LexerState\";\nimport { getTokenCategory } from \"@solve-js/language/TokenCategoryMap\";\nimport type { TokenCategory } from \"@solve-js/language/TokenCategory\";\nimport type { TokenLookup } from \"@solve-js/lexer/TokenClassRegistry\";\n\n/**\n * Public tokenizer wrapper around {@link ExpressionLexer}.\n *\n * `ExpressionLexer` does the actual character-by-character scanning;\n * `Lexer` adds a materialized-token-array streaming interface\n * (`next()`/`peek()`) plus line-classification state (`reset()`) so\n * callers can iterate a line's tokens without re-scanning on each peek.\n *\n * Each `ExpressionEngine` instance owns its own `Lexer`, and packages\n * extend it via {@link registerVocabulary} (keywords, operators, units)\n * see `IEnginePackage.lexerVocabulary`.\n */\nexport class Lexer {\n /** Expression-mode lexer (Phase A: V8-optimized, replaces moo) */\n private expressionLexer: ExpressionLexer;\n private currentState: LexerState = LexerState.Main;\n private peekedToken: Token | undefined;\n private hasPeeked = false;\n\n // Materialized token array from the last reset() call, used for\n // next()/peek() streaming access.\n private tokens: Token[] = [];\n private tokenIdx: number = 0;\n\n /**\n * @param localeCode - Locale code (e.g., \"en\", \"de\"). Defaults to \"en\".\n * @param tokenLookup - Optional TokenLookup from TokenClassRegistry.\n * When provided, configures ExpressionLexer to use registry-built\n * keyword/unit/phrase lookups instead of internal instance maps.\n */\n constructor(localeCode = \"en\", tokenLookup?: TokenLookup) {\n // Pass the lookup directly to ExpressionLexer's constructor, it's an\n // instance field now, not a static. Each Lexer instance gets its own\n // isolated lookup, preventing cross-instance corruption.\n this.expressionLexer = new ExpressionLexer(localeCode, tokenLookup);\n }\n\n reset(input: string, state?: LexerState): void {\n const newState = state ?? LexerState.Main;\n this.currentState = newState;\n this.hasPeeked = false;\n this.peekedToken = undefined;\n\n // Phase B: Main state classifies the line with the markdown scanner.\n // Skip lines (headings, fences, HRs, etc.) produce empty token arrays.\n // Expression lines and lines with inline solves are tokenized normally.\n if (newState === LexerState.Main) {\n const classification = this.expressionLexer.classifyLine(input);\n if (classification.skip) {\n this.tokens = [];\n this.tokenIdx = 0;\n return;\n }\n // Expression line or markdown line with inline solves, tokenize.\n this.expressionLexer.reset(input);\n this.tokens = this.expressionLexer.tokenizeAll();\n this.tokenIdx = 0;\n } else {\n // Non-main states (Inline, String), expression tokenization.\n this.expressionLexer.reset(input);\n this.tokens = this.expressionLexer.tokenizeAll();\n this.tokenIdx = 0;\n }\n }\n\n /**\n * Classify a single line of markdown text (Phase B).\n * Delegates to the ExpressionLexer's character-by-character scanner.\n */\n classifyLine(lineText: string): LineClassification {\n return this.expressionLexer.classifyLine(lineText);\n }\n\n /**\n * Find all inline solve markers in a line (Phase B).\n * Delegates to the ExpressionLexer's character-by-character scanner.\n */\n findInlineSolves(lineText: string) {\n return this.expressionLexer.findInlineSolves(lineText);\n }\n\n /**\n * Every keyword this lexer currently recognizes (locale + plugin-contributed),\n * mapped to the token type it lexes to. Delegates to the ExpressionLexer.\n */\n getKeywords(): Record<string, string> {\n return this.expressionLexer.getKeywords();\n }\n\n next(): Token | undefined {\n if (this.hasPeeked) {\n this.hasPeeked = false;\n return this.peekedToken;\n }\n // Materialized token array (ExpressionLexer path).\n if (this.tokenIdx < this.tokens.length) {\n return this.tokens[this.tokenIdx++];\n }\n return undefined;\n }\n\n peek(): Token | undefined {\n if (this.hasPeeked) return this.peekedToken;\n this.peekedToken = this.next();\n this.hasPeeked = true;\n return this.peekedToken;\n }\n\n [Symbol.iterator](): Iterator<Token> {\n return this.tokens[Symbol.iterator]();\n }\n\n /**\n * Register a plugin to extend the lexer with custom tokens.\n * Delegates to the underlying ExpressionLexer.\n *\n * @see LexerVocabulary for the supported extension points.\n */\n registerVocabulary(plugin: LexerVocabulary): void {\n this.expressionLexer.registerVocabulary(plugin);\n }\n\n /**\n * Unregister a plugin, removing its custom tokens from the lexer.\n * Delegates to the underlying ExpressionLexer.\n */\n unregisterVocabulary(plugin: LexerVocabulary): void {\n this.expressionLexer.unregisterVocabulary(plugin);\n }\n\n /**\n * Reset the lexer for expression-only text, skips the classifyLine()\n * overhead in reset() for callers that already know the input is an\n * evaluable expression (e.g., after isEmptyLine() confirmed non-skip).\n */\n resetExpression(input: string): void {\n this.currentState = LexerState.Main;\n this.hasPeeked = false;\n this.peekedToken = undefined;\n this.expressionLexer.reset(input);\n this.tokens = this.expressionLexer.tokenizeAll();\n this.tokenIdx = 0;\n }\n\n /**\n * Scan a full document in one pass, classifying each line and\n * tokenizing non-skipped lines. Delegates to ExpressionLexer.\n *\n * @returns ScanLineResult[], one per line, with classification + tokens.\n */\n scanDocument(text: string): ScanLineResult[] {\n return this.expressionLexer.scanDocument(text);\n }\n\n getState(): LexerState {\n return this.currentState;\n }\n\n setState(state: LexerState): void {\n this.currentState = state;\n }\n\n getHighlightTokens(lineText: string): {type: string; value: string; offset: number; col: number; length: number; category: TokenCategory | undefined}[] {\n const classification = this.expressionLexer.classifyLine(lineText);\n\n // For blockquote lines, strip the \"> \" prefix and tokenize the expression content.\n // This lets expressions inside blockquotes (e.g., \"> 1 + 2\") get syntax highlighted\n // while pure structural lines (headings, code fences) remain unhighlighted.\n if (classification.skip && lineText.startsWith(\"> \")) {\n return this.collectHighlightTokens(lineText.slice(2));\n }\n\n if (classification.skip) {\n return [];\n }\n\n return this.collectHighlightTokens(lineText);\n }\n\n /**\n * The same tokens {@link getHighlightTokens} reduces, before reduction.\n *\n * Exists because normalization operates on tokens, not on the flattened\n * shape, and a consumer that wants phrase-fused highlighting has to run the\n * normalizer between the two. See `LanguageService.getSemanticTokens`.\n *\n * @param lineText - One line of source.\n * @returns Every token on the line that is worth painting, unreduced.\n */\n getHighlightTokenObjects(lineText: string): Token[] {\n const classification = this.expressionLexer.classifyLine(lineText);\n if (classification.skip && lineText.startsWith(\"> \")) {\n return this.collectTokenObjects(lineText.slice(2));\n }\n if (classification.skip) return [];\n return this.collectTokenObjects(lineText);\n }\n\n private collectTokenObjects(lineText: string): Token[] {\n this.resetExpression(lineText);\n const result: Token[] = [];\n for (const token of this) {\n if (token.type === \"WS\" || token.type === \"NEWLINE\") continue;\n if (token.type.startsWith(\"MD_\")) continue;\n if (token.type === \"INLINE_SOLVE_START\" || token.type === \"BACKTICK_CLOSE\") continue;\n result.push(token);\n }\n return result;\n }\n\n private collectHighlightTokens(lineText: string): {type: string; value: string; offset: number; col: number; length: number; category: TokenCategory | undefined}[] {\n return this.collectTokenObjects(lineText).map(token => ({\n type: token.type,\n value: token.value,\n offset: token.offset,\n col: token.col,\n // `text`, not `value`: this is a span into the source, and the two\n // differ for a string literal, whose value is the payload while its\n // text still carries the quote characters the reader typed.\n length: token.text.length,\n category: getTokenCategory(token.type),\n }));\n }\n}\n\n/**\n * A lexer for operations that do not depend on registered vocabulary.\n *\n * Line classification and inline-solve detection read characters looking for\n * headings, comment markers, fences and backtick spans, and never consult the\n * keyword, unit or operator tables. Every lexer therefore returns the same\n * answer, so the callers that have no engine to ask can use this one. Checked\n * by `__tests__/lexer/LineClassificationIsVocabularyIndependent.spec.ts`.\n *\n * Do not tokenize with this. An engine's own lexer carries the vocabulary its\n * packages registered; this one carries none.\n */\nexport const sharedLexer = new Lexer(\"en\", undefined);","/**\n * TokenClass, Plugin-extensible keyword registration for the Lexer.\n *\n * Providers call `registry.register(tokenClass)` to teach the lexer about\n * their keywords. The registry merges locale keywords, provider keywords,\n * phrase mappings, and unit names into an optimized TokenLookup structure\n * consumed by the Lexer.\n *\n * @example\n * registry.register({\n * tokenType: 'CARET',\n * keywords: {},\n * phrases: { 'to the power of': true, 'power of': true },\n * priority: 10,\n * description: 'Exponentiation operators (x^y)',\n * });\n */\nexport interface TokenClass {\n /** The token type string produced by the lexer (e.g., \"FUNC\", \"PI\", \"CARET\").\n * Must match a token type that a ParseletRegistry has a parselet for. */\n tokenType: string;\n\n /** Single-word keywords (case-insensitive). The lexer lowercases input\n * before lookup, so these should be lowercase. Example:\n * { sqrt: true, abs: true, sin: true, cos: true } for tokenType \"FUNC\" */\n keywords: Record<string, boolean>;\n\n /** Multi-word phrases (case-insensitive). Matched by the built-in PhraseMatcher\n * via the phrase trie. Example:\n * { \"to the power of\": true, \"power of\": true } for tokenType \"CARET\" */\n phrases?: Record<string, boolean>;\n\n /** Priority for conflict resolution. When two TokenClasses register\n * the same keyword, the higher-priority class wins. Locale keywords\n * have priority 0 (set via setLocale). Providers should use\n * priority >= 10 to override locale defaults. Default: 0 */\n priority?: number;\n\n /** Human-readable description for debugging and introspection */\n description?: string;\n}\n\n// ── Phrase Trie ──────────────────────────────────────────────────────────────\n\n/** Trie node for multi-word phrase matching. */\nexport interface PhraseNode {\n /** Complete phrase token type (null = intermediate node) */\n type?: string;\n children: Map<string, PhraseNode>;\n}\n\n// ── TokenLookup, Optimized lookup structure for the Lexer ──────────────────\n\n/**\n * The optimized lookup structure built by TokenClassRegistry.build().\n * Consumed by the Lexer for O(1) keyword → token type lookups and\n * O(word-count) phrase matching.\n */\nexport interface TokenLookup {\n /** Lowercase keyword → token type. O(1) Map lookup. */\n keywordToType: Map<string, string>;\n\n /** Phrase trie for multi-word matching. Root node with children maps.\n * Null if no phrases registered. */\n phraseTrie: PhraseNode | null;\n\n /** Set of lowercase first-words of all registered phrases.\n * Used by the lexer to emit IDENT (not a phrase keyword) for words\n * that start multi-word phrases, deferring to the PhraseMatcher.\n *\n * Example: \"to\" is in phraseStartWords because \"to the power of\" is a phrase.\n * When the lexer sees \"to\", it emits IDENT and lets the phrase matcher\n * combine \"to the power of\" into a single CARET token.\n *\n * This prevents plugins from accidentally overriding phrase-start words.\n */\n phraseStartWords: Set<string>;\n\n /** Case-sensitive unit names for UNIT fallback after keyword lookup fails. */\n unitNames: ReadonlySet<string>;\n}\n\n// ── TokenClassRegistry ───────────────────────────────────────────────────────\n\n/**\n * Central registry for keyword→token-type mappings.\n *\n * Providers register TokenClasses; locales provide keyword maps;\n * units provide a name set. `build()` merges all sources into an\n * optimized TokenLookup consumed by the Lexer.\n *\n * Merge order (later overrides earlier):\n * 1. Locale keywords (priority 0)\n * 2. Provider keywords (sorted by priority ascending, higher priority wins)\n *\n * Unit names are stored separately (checked AFTER keyword lookup fails).\n * Phrases are stored in a trie for O(phrase-length) matching.\n */\nexport class TokenClassRegistry {\n private classes: TokenClass[] = [];\n private localeKeywordMap: Record<string, string> | null = null;\n private localePhraseMap: Record<string, string> | null = null;\n private unitNames: ReadonlySet<string> | null = null;\n\n /**\n * Register a provider's TokenClass. Must be called BEFORE build().\n * Can be called multiple times to add more entries.\n *\n * Built-in token types CANNOT be overridden, throws a EngineError\n * if the TokenClass attempts to register a keyword that conflicts\n * with an already-registered token type.\n */\n register(tokenClass: TokenClass): void {\n this.classes.push(tokenClass);\n }\n\n /**\n * Unregister all TokenClasses for a given token type.\n * Useful for plugin unload. Requires rebuild() to take effect.\n */\n unregister(tokenType: string): void {\n this.classes = this.classes.filter(c => c.tokenType !== tokenType);\n }\n\n /**\n * Set the locale's keyword→type map and optional phrase map.\n * Called on locale change. Priority 0 (cannot override providers with higher priority).\n */\n setLocale(keywordMap: Record<string, string>, phraseMap?: Record<string, string>): void {\n this.localeKeywordMap = keywordMap;\n this.localePhraseMap = phraseMap ?? null;\n }\n\n /**\n * Set the unit name set. Called when unit list changes.\n * Units are stored separately (checked AFTER keyword lookup fails).\n *\n * Takes a ReadonlySet because the caller's set is derived from the\n * conversion tables and must not be mutated; this class only ever reads it.\n */\n setUnits(unitNames: ReadonlySet<string>): void {\n this.unitNames = unitNames;\n }\n\n /**\n * Build the optimized TokenLookup from all registered sources.\n *\n * Merge order (later overrides earlier):\n * 1. Locale keywords (priority 0)\n * 2. Provider classes (sorted by priority ascending)\n *\n * Returns a frozen TokenLookup that the Lexer consumes.\n * Call build() again after register()/setLocale()/setUnits() changes.\n */\n build(): TokenLookup {\n const keywordToType = new Map<string, string>();\n\n // Layer 1: Locale keywords (priority 0, lowest)\n if (this.localeKeywordMap) {\n for (const [keyword, tokenType] of Object.entries(this.localeKeywordMap)) {\n keywordToType.set(keyword.toLowerCase(), tokenType);\n }\n }\n\n // Layer 2: Provider keywords (sorted by priority ascending, higher wins)\n const sorted = [...this.classes].sort((a, b) => (a.priority ?? 0) - (b.priority ?? 0));\n for (const tc of sorted) {\n for (const keyword of Object.keys(tc.keywords)) {\n keywordToType.set(keyword.toLowerCase(), tc.tokenType);\n }\n }\n\n // Build phrase trie from locale + provider phrases\n const phraseTrie = this.buildPhraseTrie();\n\n // Build phraseStartWords set (first word of every phrase)\n const phraseStartWords = this.buildPhraseStartWords();\n\n return {\n keywordToType,\n phraseTrie,\n phraseStartWords,\n unitNames: this.unitNames ?? new Set(),\n };\n }\n\n // ── Private helpers ─────────────────────────────────────────────────────\n\n private buildPhraseTrie(): PhraseNode | null {\n const root: PhraseNode = { children: new Map() };\n\n // Layer 1: Locale phrases\n if (this.localePhraseMap) {\n for (const [phrase, tokenType] of Object.entries(this.localePhraseMap)) {\n this.insertPhrase(root, phrase.toLowerCase(), tokenType);\n }\n }\n\n // Layer 2: Provider phrases\n for (const tc of this.classes) {\n if (!tc.phrases) continue;\n for (const phrase of Object.keys(tc.phrases)) {\n this.insertPhrase(root, phrase.toLowerCase(), tc.tokenType);\n }\n }\n\n return root.children.size > 0 ? root : null;\n }\n\n private insertPhrase(root: PhraseNode, phrase: string, tokenType: string): void {\n const words = phrase.split(' ');\n let node = root;\n for (const word of words) {\n if (!node.children.has(word)) {\n node.children.set(word, { children: new Map() });\n }\n node = node.children.get(word)!;\n }\n // Only set type if not already set, first-registered (locale) wins\n if (!node.type) {\n node.type = tokenType;\n }\n }\n\n private buildPhraseStartWords(): Set<string> {\n const startWords = new Set<string>();\n\n // Locale phrase first words\n if (this.localePhraseMap) {\n for (const phrase of Object.keys(this.localePhraseMap)) {\n const first = phrase.split(' ')[0].toLowerCase();\n startWords.add(first);\n }\n }\n\n // Provider phrase first words\n for (const tc of this.classes) {\n if (!tc.phrases) continue;\n for (const phrase of Object.keys(tc.phrases)) {\n const first = phrase.split(' ')[0].toLowerCase();\n startWords.add(first);\n }\n }\n\n return startWords;\n }\n}","/**\n * tokenRegistration.ts, Bootstrap for building TokenLookup from locale, units, and phrases.\n *\n * This module centralizes the assembly of the TokenLookup consumed by ExpressionLexer.\n * It merges:\n * 1. Locale keywords (from ILocale.keywordMap)\n * 2. Built-in phrase patterns (to the power of, increase by, etc.)\n * 3. Known unit names (from units.ts)\n *\n * The resulting TokenLookup is frozen and passed to ExpressionLexer.configuredLookup\n * at construction time, enabling data-driven keyword/unit/phrase resolution.\n */\nimport { TokenClassRegistry } from '@solve-js/lexer/TokenClassRegistry';\nimport type { TokenLookup } from '@solve-js/lexer/TokenClassRegistry';\nimport { getLocale, type ILocale } from '@solve-js/constants/locales';\nimport { knownUnits } from '@solve-js/lexer/units';\n\n// ── Built-in phrase map ───────────────────────────────────────────────────\n// These are the multi-word expressions handled as compound tokens.\n// Matched by the PhraseMatcher (trie-based) in ExpressionLexer.tryMatchPhrase().\nconst BUILTIN_PHRASES: Record<string, string> = {\n 'to the power of': 'CARET',\n 'power of': 'CARET',\n 'increase by': 'INCREASE_BY',\n 'decrease by': 'DECREASE_BY',\n 'times by': 'TIMES_BY',\n 'multiply by': 'MULTIPLY_BY',\n 'multiplied by': 'MULTIPLY_BY',\n 'divide by': 'DIVIDE_BY',\n};\n\n/**\n * Build a TokenLookup from locale keywords, known units, and built-in phrases.\n *\n * Merge order (later overrides earlier):\n * 1. Locale keywords (priority 0, lowest, can be overridden by providers)\n * 2. Built-in phrases (via locale phraseMap)\n * 3. Known units (checked AFTER keyword lookup fails, via unitNames set)\n *\n * The resulting TokenLookup replaces the internal keyword map, unit set,\n * phrase trie, and phraseStartWords in ExpressionLexer when set via\n * ExpressionLexer.configuredLookup.\n *\n * @param localeCode - The locale code (e.g., \"en\", \"de\"). Defaults to \"en\".\n * @returns A frozen TokenLookup ready for consumption by the lexer.\n */\nexport function buildTokenLookup(localeCode = 'en'): TokenLookup {\n const locale: ILocale = getLocale(localeCode);\n const registry = new TokenClassRegistry();\n\n // Layer 1: Locale keywords (priority 0, lowest)\n registry.setLocale(locale.keywordMap, BUILTIN_PHRASES);\n\n // Layer 2: Known units (checked after keyword lookup)\n registry.setUnits(knownUnits);\n\n // Build and return the lookup\n return registry.build();\n}\n"]}
|
package/dist/chunk-SBUFNJVE.js
DELETED
|
@@ -1,258 +0,0 @@
|
|
|
1
|
-
import { UNIT_TABLE, EXTENDED_UNITS } from './chunk-V4XG5QF6.js';
|
|
2
|
-
|
|
3
|
-
// src/lexer/units.ts
|
|
4
|
-
var EXCLUDED_UNIT_SPELLINGS = /* @__PURE__ */ new Map([
|
|
5
|
-
["in", "the IN keyword owns this word (the conversion operator). ConvertParselet and friends special-case the IN token type directly and trust its text as a unit name, so inches still convert"],
|
|
6
|
-
["dec", "already a converter name, as in `255 as dec`"],
|
|
7
|
-
["M", "the millions magnitude suffix, as in `2.5M`. Nautical miles are still spelled `nmi` and `NM`"],
|
|
8
|
-
// Claimed by a normalizer rule rather than by the keyword table, which is why
|
|
9
|
-
// scanning the locale keywords alone does not find it. Admitting `pm`
|
|
10
|
-
// (picometre) broke every clock time in the suite: `4pm` lexed as 4
|
|
11
|
-
// picometres. There is deliberately no entry for `am`: the table's SI
|
|
12
|
-
// prefixes stop at femto, so attometres do not exist and an exclusion would
|
|
13
|
-
// be dead weight. `UnitVocabularyCollisions.spec.ts` asserts that.
|
|
14
|
-
["pm", "the meridiem marker, as in `4pm`. Picometres lose, and `picometre` still works"],
|
|
15
|
-
["are", "the English verb, against a 100-square-metre unit almost nobody writes"],
|
|
16
|
-
["ares", "the English verb in plural, same reasoning as `are` above"],
|
|
17
|
-
["turn", "ordinary English, against a full-rotation angle unit also spelled in gradians"],
|
|
18
|
-
["turns", "ordinary English in plural, same reasoning as `turn` above"],
|
|
19
|
-
["grade", "ordinary English. The angle unit is also spelled `gon` and `grad`"],
|
|
20
|
-
["grades", "ordinary English in plural, same reasoning as `grade` above"],
|
|
21
|
-
["point", "ordinary English. The typographic point is also reachable as `pica`"],
|
|
22
|
-
["points", "ordinary English in plural, same reasoning as `point` above"],
|
|
23
|
-
["moment", "ordinary English, against an obscure medieval time unit of 90 seconds"],
|
|
24
|
-
["moments", "ordinary English in plural, same reasoning as `moment` above"],
|
|
25
|
-
["shake", "ordinary English, against an obscure physics unit of ten nanoseconds"],
|
|
26
|
-
["shakes", "ordinary English in plural, same reasoning as `shake` above"]
|
|
27
|
-
]);
|
|
28
|
-
function isTokenizableSpelling(spelling) {
|
|
29
|
-
return /^[A-Za-z0-9_]+$/.test(spelling);
|
|
30
|
-
}
|
|
31
|
-
var GRANDFATHERED_SINGLE_CHARACTER_UNITS = /* @__PURE__ */ new Set([
|
|
32
|
-
"m",
|
|
33
|
-
"g",
|
|
34
|
-
"t",
|
|
35
|
-
"s",
|
|
36
|
-
"h",
|
|
37
|
-
"d",
|
|
38
|
-
"l",
|
|
39
|
-
"b",
|
|
40
|
-
"B",
|
|
41
|
-
"C",
|
|
42
|
-
"F",
|
|
43
|
-
"K",
|
|
44
|
-
"W"
|
|
45
|
-
]);
|
|
46
|
-
function isAdmissible(spelling) {
|
|
47
|
-
if (!isTokenizableSpelling(spelling)) return false;
|
|
48
|
-
if (EXCLUDED_UNIT_SPELLINGS.has(spelling)) return false;
|
|
49
|
-
if (spelling.length === 1) return GRANDFATHERED_SINGLE_CHARACTER_UNITS.has(spelling);
|
|
50
|
-
return true;
|
|
51
|
-
}
|
|
52
|
-
var CURRENCY_CODES = [
|
|
53
|
-
"USD",
|
|
54
|
-
"EUR",
|
|
55
|
-
"GBP",
|
|
56
|
-
"JPY",
|
|
57
|
-
"AUD",
|
|
58
|
-
"CAD",
|
|
59
|
-
"CHF",
|
|
60
|
-
"CNY",
|
|
61
|
-
"SEK",
|
|
62
|
-
"NOK",
|
|
63
|
-
"DKK",
|
|
64
|
-
"NZD",
|
|
65
|
-
"KRW",
|
|
66
|
-
"SGD",
|
|
67
|
-
"HKD",
|
|
68
|
-
"TWD",
|
|
69
|
-
"INR",
|
|
70
|
-
"BRL",
|
|
71
|
-
"ZAR",
|
|
72
|
-
"MXN",
|
|
73
|
-
"RUB",
|
|
74
|
-
"TRY",
|
|
75
|
-
"SAR",
|
|
76
|
-
"AED",
|
|
77
|
-
"ILS",
|
|
78
|
-
"PLN",
|
|
79
|
-
"CZK",
|
|
80
|
-
"HUF",
|
|
81
|
-
"THB",
|
|
82
|
-
"IDR",
|
|
83
|
-
"MYR",
|
|
84
|
-
"PHP",
|
|
85
|
-
"CLP",
|
|
86
|
-
"COP",
|
|
87
|
-
"ARS",
|
|
88
|
-
"NGN",
|
|
89
|
-
"EGP",
|
|
90
|
-
"PKR",
|
|
91
|
-
"BDT",
|
|
92
|
-
"VND",
|
|
93
|
-
"KES",
|
|
94
|
-
"XOF",
|
|
95
|
-
"XAF",
|
|
96
|
-
"MAD",
|
|
97
|
-
"QAR",
|
|
98
|
-
"KWD",
|
|
99
|
-
"OMR",
|
|
100
|
-
"BHD",
|
|
101
|
-
"JOD",
|
|
102
|
-
"LKR",
|
|
103
|
-
"MMK",
|
|
104
|
-
"UZS",
|
|
105
|
-
"KZT",
|
|
106
|
-
"RON",
|
|
107
|
-
"BGN",
|
|
108
|
-
"HRK",
|
|
109
|
-
"ISK",
|
|
110
|
-
"UAH",
|
|
111
|
-
"GEL",
|
|
112
|
-
"AZN",
|
|
113
|
-
"BTN",
|
|
114
|
-
"BND",
|
|
115
|
-
"BOB",
|
|
116
|
-
"BWP",
|
|
117
|
-
"BYN",
|
|
118
|
-
"BZD",
|
|
119
|
-
"CDF",
|
|
120
|
-
"CRC",
|
|
121
|
-
"CUP",
|
|
122
|
-
"DOP",
|
|
123
|
-
"DZD",
|
|
124
|
-
"ERN",
|
|
125
|
-
"ETB",
|
|
126
|
-
"FJD",
|
|
127
|
-
"FKP",
|
|
128
|
-
"GMD",
|
|
129
|
-
"GNF",
|
|
130
|
-
"GYD",
|
|
131
|
-
"HNL",
|
|
132
|
-
"HTG",
|
|
133
|
-
"JMD",
|
|
134
|
-
"KGZ",
|
|
135
|
-
"KHR",
|
|
136
|
-
"KMF",
|
|
137
|
-
"KYD",
|
|
138
|
-
"LAK",
|
|
139
|
-
"LBP",
|
|
140
|
-
"LRD",
|
|
141
|
-
"LSL",
|
|
142
|
-
"LYD",
|
|
143
|
-
"MDL",
|
|
144
|
-
"MGA",
|
|
145
|
-
"MKD",
|
|
146
|
-
"MNT",
|
|
147
|
-
"MOP",
|
|
148
|
-
"MRU",
|
|
149
|
-
"MUR",
|
|
150
|
-
"MVR",
|
|
151
|
-
"MWK",
|
|
152
|
-
"MZN",
|
|
153
|
-
"NAD",
|
|
154
|
-
"NIO",
|
|
155
|
-
"NPR",
|
|
156
|
-
"PGK",
|
|
157
|
-
"PYG",
|
|
158
|
-
"RSD",
|
|
159
|
-
"RWF",
|
|
160
|
-
"SBD",
|
|
161
|
-
"SCR",
|
|
162
|
-
"SDG",
|
|
163
|
-
"SHP",
|
|
164
|
-
"SLE",
|
|
165
|
-
"SOS",
|
|
166
|
-
"SRD",
|
|
167
|
-
"SSP",
|
|
168
|
-
"STN",
|
|
169
|
-
"SVC",
|
|
170
|
-
"SYP",
|
|
171
|
-
"SZL",
|
|
172
|
-
"TJS",
|
|
173
|
-
"TMT",
|
|
174
|
-
"TND",
|
|
175
|
-
"TOP",
|
|
176
|
-
"TTD",
|
|
177
|
-
"TZS",
|
|
178
|
-
"UGX",
|
|
179
|
-
"UYU",
|
|
180
|
-
"VEB",
|
|
181
|
-
"VUV",
|
|
182
|
-
"WST",
|
|
183
|
-
"XCD",
|
|
184
|
-
"XDR",
|
|
185
|
-
"XPF",
|
|
186
|
-
"YER",
|
|
187
|
-
"ZMW",
|
|
188
|
-
"ZWL",
|
|
189
|
-
"BTC",
|
|
190
|
-
"ETH",
|
|
191
|
-
"SOL",
|
|
192
|
-
"XRP",
|
|
193
|
-
"ADA",
|
|
194
|
-
"DOGE",
|
|
195
|
-
"DOT"
|
|
196
|
-
];
|
|
197
|
-
var CURRENCY_WORD_FORMS = [
|
|
198
|
-
"dollar",
|
|
199
|
-
"dollars",
|
|
200
|
-
"euro",
|
|
201
|
-
"euros",
|
|
202
|
-
"yen",
|
|
203
|
-
"ruble",
|
|
204
|
-
"rubles",
|
|
205
|
-
"rouble",
|
|
206
|
-
"roubles",
|
|
207
|
-
"won",
|
|
208
|
-
"rupee",
|
|
209
|
-
"rupees",
|
|
210
|
-
"yuan",
|
|
211
|
-
"renminbi",
|
|
212
|
-
"franc",
|
|
213
|
-
"francs",
|
|
214
|
-
"rand",
|
|
215
|
-
"krona",
|
|
216
|
-
"kronor",
|
|
217
|
-
"krone",
|
|
218
|
-
"kroner",
|
|
219
|
-
"real",
|
|
220
|
-
"reais",
|
|
221
|
-
"peso",
|
|
222
|
-
"pesos",
|
|
223
|
-
"shekel",
|
|
224
|
-
"shekels",
|
|
225
|
-
"lira",
|
|
226
|
-
"hryvnia",
|
|
227
|
-
"hryvnias",
|
|
228
|
-
"zloty",
|
|
229
|
-
"zlotys",
|
|
230
|
-
"forint",
|
|
231
|
-
"koruna",
|
|
232
|
-
"dirham",
|
|
233
|
-
"dirhams",
|
|
234
|
-
"riyal",
|
|
235
|
-
"riyals",
|
|
236
|
-
"rial",
|
|
237
|
-
"rials",
|
|
238
|
-
"ringgit",
|
|
239
|
-
"rupiah",
|
|
240
|
-
"baht",
|
|
241
|
-
"dong",
|
|
242
|
-
"naira"
|
|
243
|
-
];
|
|
244
|
-
var WORKDAY_UNITS = ["workday", "workdays"];
|
|
245
|
-
var knownUnits = /* @__PURE__ */ new Set([
|
|
246
|
-
...Object.keys(UNIT_TABLE).filter(isAdmissible),
|
|
247
|
-
...Object.keys(EXTENDED_UNITS),
|
|
248
|
-
...WORKDAY_UNITS,
|
|
249
|
-
...CURRENCY_CODES,
|
|
250
|
-
...CURRENCY_WORD_FORMS
|
|
251
|
-
]);
|
|
252
|
-
function isKnownUnit(text) {
|
|
253
|
-
return knownUnits.has(text);
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
export { isKnownUnit, knownUnits };
|
|
257
|
-
//# sourceMappingURL=chunk-SBUFNJVE.js.map
|
|
258
|
-
//# sourceMappingURL=chunk-SBUFNJVE.js.map
|