@introspection-ai/recipes 0.25.1 → 0.27.1
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/dist/api/mcp.d.ts +3 -3
- package/dist/api/mcp.d.ts.map +1 -1
- package/dist/api/mcp.js +1 -1
- package/dist/api/mcp.js.map +1 -1
- package/dist/{child-agent-completions.d.ts → child/agent-completions.d.ts} +2 -2
- package/dist/child/agent-completions.d.ts.map +1 -0
- package/dist/{child-agent-completions.js → child/agent-completions.js} +1 -1
- package/dist/child/agent-completions.js.map +1 -0
- package/dist/{child-agent-store.d.ts → child/agent-store.d.ts} +1 -1
- package/dist/child/agent-store.d.ts.map +1 -0
- package/dist/{child-agent-store.js → child/agent-store.js} +1 -1
- package/dist/child/agent-store.js.map +1 -0
- package/dist/{child-agent.d.ts → child/agent.d.ts} +2 -2
- package/dist/child/agent.d.ts.map +1 -0
- package/dist/{child-agent.js → child/agent.js} +5 -5
- package/dist/child/agent.js.map +1 -0
- package/dist/{child-session.d.ts → child/session.d.ts} +4 -4
- package/dist/child/session.d.ts.map +1 -0
- package/dist/{child-session.js → child/session.js} +2 -2
- package/dist/child/session.js.map +1 -0
- package/dist/connector-tools.d.ts +1 -1
- package/dist/connector-tools.js +2 -2
- package/dist/inspect.d.ts +1 -1
- package/dist/inspect.js +1 -1
- package/dist/{mcp-catalog.d.ts → mcp/catalog.d.ts} +3 -3
- package/dist/mcp/catalog.d.ts.map +1 -0
- package/dist/{mcp-catalog.js → mcp/catalog.js} +2 -2
- package/dist/mcp/catalog.js.map +1 -0
- package/dist/{mcp-command-context.d.ts → mcp/cli/command-context.d.ts} +1 -1
- package/dist/mcp/cli/command-context.d.ts.map +1 -0
- package/dist/{mcp-command-context.js → mcp/cli/command-context.js} +1 -1
- package/dist/mcp/cli/command-context.js.map +1 -0
- package/dist/{mcp-cli-core.d.ts → mcp/cli/core.d.ts} +14 -8
- package/dist/mcp/cli/core.d.ts.map +1 -0
- package/dist/{mcp-cli-core.js → mcp/cli/core.js} +105 -146
- package/dist/mcp/cli/core.js.map +1 -0
- package/dist/mcp/cli/help.d.ts +6 -0
- package/dist/mcp/cli/help.d.ts.map +1 -0
- package/dist/mcp/cli/help.js +116 -0
- package/dist/mcp/cli/help.js.map +1 -0
- package/dist/mcp/cli/index.d.ts +3 -0
- package/dist/mcp/cli/index.d.ts.map +1 -0
- package/dist/{mcp-cli.js → mcp/cli/index.js} +4 -4
- package/dist/mcp/cli/index.js.map +1 -0
- package/dist/{mcp-cli-policy.d.ts → mcp/cli/policy.d.ts} +2 -2
- package/dist/mcp/cli/policy.d.ts.map +1 -0
- package/dist/{mcp-cli-policy.js → mcp/cli/policy.js} +2 -2
- package/dist/mcp/cli/policy.js.map +1 -0
- package/dist/mcp/cli/run-worker.d.ts +2 -0
- package/dist/mcp/cli/run-worker.d.ts.map +1 -0
- package/dist/mcp/cli/run-worker.js +54 -0
- package/dist/mcp/cli/run-worker.js.map +1 -0
- package/dist/mcp/client-entry.d.ts +3 -0
- package/dist/mcp/client-entry.d.ts.map +1 -0
- package/dist/{mcp-client.js → mcp/client-entry.js} +3 -3
- package/dist/mcp/client-entry.js.map +1 -0
- package/dist/{mcp-contract.d.ts → mcp/contract.d.ts} +2 -2
- package/dist/mcp/contract.d.ts.map +1 -0
- package/dist/{mcp-contract.js → mcp/contract.js} +1 -1
- package/dist/mcp/contract.js.map +1 -0
- package/dist/{mcp-daemon-client.d.ts → mcp/daemon/client.d.ts} +3 -2
- package/dist/mcp/daemon/client.d.ts.map +1 -0
- package/dist/{mcp-daemon-client.js → mcp/daemon/client.js} +12 -8
- package/dist/mcp/daemon/client.js.map +1 -0
- package/dist/mcp/daemon/index.d.ts +3 -0
- package/dist/mcp/daemon/index.d.ts.map +1 -0
- package/dist/mcp/daemon/index.js +453 -0
- package/dist/{mcp-daemon.js.map → mcp/daemon/index.js.map} +1 -1
- package/dist/{mcp-daemon-protocol.d.ts → mcp/daemon/protocol.d.ts} +2 -2
- package/dist/mcp/daemon/protocol.d.ts.map +1 -0
- package/dist/{mcp-daemon-protocol.js → mcp/daemon/protocol.js} +1 -1
- package/dist/mcp/daemon/protocol.js.map +1 -0
- package/dist/{mcp.d.ts → mcp/index.d.ts} +5 -5
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/{mcp.js → mcp/index.js} +16 -10
- package/dist/mcp/index.js.map +1 -0
- package/dist/{mcp-policy.d.ts → mcp/policy.d.ts} +3 -3
- package/dist/mcp/policy.d.ts.map +1 -0
- package/dist/{mcp-policy.js → mcp/policy.js} +1 -1
- package/dist/mcp/policy.js.map +1 -0
- package/dist/{mcp-tools.d.ts → mcp/tools.d.ts} +4 -4
- package/dist/mcp/tools.d.ts.map +1 -0
- package/dist/{mcp-tools.js → mcp/tools.js} +4 -4
- package/dist/mcp/tools.js.map +1 -0
- package/dist/{mcp-trace-context.d.ts → mcp/trace-context.d.ts} +2 -2
- package/dist/mcp/trace-context.d.ts.map +1 -0
- package/dist/{mcp-trace-context.js → mcp/trace-context.js} +1 -1
- package/dist/mcp/trace-context.js.map +1 -0
- package/dist/mcp-chunks/{auth-command-4WFRNU2I.js → auth-command-GQFV6QYP.js} +24 -27
- package/dist/mcp-chunks/call-arguments-VT7JLNJY.js +16 -0
- package/dist/mcp-chunks/{call-command-JBIKXOGC.js → call-command-LMAREWKD.js} +45 -45
- package/dist/mcp-chunks/{chunk-3JGS7LQB.js → chunk-2HOMVWSA.js} +2 -2
- package/dist/mcp-chunks/{chunk-G6OMDUNG.js → chunk-2P2HVZ3G.js} +1 -1
- package/dist/mcp-chunks/{chunk-ED2WN5BI.js → chunk-34QXE62Y.js} +175 -147
- package/dist/mcp-chunks/{chunk-Y3EDWN2P.js → chunk-5B7GRMUK.js} +1 -1
- package/dist/mcp-chunks/chunk-5BMCVE2J.js +516 -0
- package/dist/mcp-chunks/{chunk-V5AYEKSL.js → chunk-6QZQZXDJ.js} +52 -81
- package/dist/mcp-chunks/{chunk-3R2WK3NB.js → chunk-6RG6AD5X.js} +6 -6
- package/dist/mcp-chunks/{chunk-SNKXMWDB.js → chunk-77BZYP72.js} +1 -1
- package/dist/mcp-chunks/chunk-7PFJCLXL.js +123 -0
- package/dist/mcp-chunks/chunk-7WL4TMON.js +31 -0
- package/dist/mcp-chunks/{chunk-ELA77TDC.js → chunk-C2VLY7ED.js} +4 -4
- package/dist/mcp-chunks/{chunk-FAJPJTOC.js → chunk-CLR6DJV3.js} +1 -1
- package/dist/mcp-chunks/{chunk-ZOAQDFAO.js → chunk-D6B2M5V7.js} +1 -1
- package/dist/mcp-chunks/{chunk-WTMJMM3B.js → chunk-D6SVCPN6.js} +3 -30
- package/dist/mcp-chunks/chunk-FBVRU4Y3.js +1195 -0
- package/dist/mcp-chunks/{chunk-EMSNQHZZ.js → chunk-FONFU4G5.js} +1 -1
- package/dist/mcp-chunks/{chunk-BWW4XRUC.js → chunk-H4KL74PV.js} +303 -161
- package/dist/mcp-chunks/{chunk-ITR7FQM3.js → chunk-H7ARMBV7.js} +4 -9
- package/dist/mcp-chunks/{chunk-EPT4MYOF.js → chunk-HZ2SX5U6.js} +39 -34
- package/dist/mcp-chunks/{chunk-36VIJRYY.js → chunk-I6UMKX5E.js} +4 -4
- package/dist/mcp-chunks/{chunk-ASG4OY3M.js → chunk-IF6LRV3J.js} +21 -28
- package/dist/mcp-chunks/{chunk-KW3ANJ36.js → chunk-JVYCENPP.js} +4 -4
- package/dist/mcp-chunks/{chunk-AIKLVBYU.js → chunk-KOWNVUL2.js} +34 -7
- package/dist/mcp-chunks/{chunk-B2LNXGAP.js → chunk-KQCLM7R7.js} +4 -4
- package/dist/mcp-chunks/{chunk-OP3IW2V6.js → chunk-L6OOGZVA.js} +2 -2
- package/dist/mcp-chunks/{chunk-MOEZ43ZL.js → chunk-LCBDVFVA.js} +1 -1
- package/dist/mcp-chunks/{chunk-ITCCROID.js → chunk-LIEFPSSB.js} +5 -5
- package/dist/mcp-chunks/{chunk-GUXMP7QB.js → chunk-LQIE4PKL.js} +2 -2
- package/dist/mcp-chunks/{chunk-WYLHHXI6.js → chunk-LXHPDKEF.js} +26 -11
- package/dist/mcp-chunks/{chunk-6YZW3XAE.js → chunk-MJFZM5EV.js} +5 -5
- package/dist/mcp-chunks/{chunk-TPHPAEDH.js → chunk-NQW3ES2G.js} +2 -8
- package/dist/mcp-chunks/{chunk-IPNSPKQK.js → chunk-O2VOMKAS.js} +15 -17
- package/dist/mcp-chunks/{chunk-QZUC2T72.js → chunk-O4JIUOWF.js} +2 -2
- package/dist/mcp-chunks/{chunk-C2KNLFZR.js → chunk-P3UVILEW.js} +2 -2
- package/dist/mcp-chunks/{chunk-7WOKCV6Q.js → chunk-P463YBJM.js} +1 -1
- package/dist/mcp-chunks/{chunk-GQ6NSIDS.js → chunk-PJCMJ65D.js} +1175 -718
- package/dist/mcp-chunks/{chunk-CZKDJZER.js → chunk-QALB3DRW.js} +1 -1
- package/dist/mcp-chunks/{chunk-JG4TRUPF.js → chunk-QJNF3A3F.js} +1 -1
- package/dist/mcp-chunks/{chunk-HLRCUHNO.js → chunk-RIHPVCGI.js} +1 -1
- package/dist/mcp-chunks/{chunk-RD7NHCRK.js → chunk-RZIJUJGL.js} +60 -1074
- package/dist/mcp-chunks/{chunk-4ZNBWL65.js → chunk-S2YF442K.js} +2 -2
- package/dist/mcp-chunks/chunk-S5F3HEZZ.js +37060 -0
- package/dist/mcp-chunks/{chunk-TF2YTYE4.js → chunk-S6GJ42I2.js} +1 -1
- package/dist/mcp-chunks/chunk-T4MQCFIK.js +982 -0
- package/dist/mcp-chunks/{chunk-SCOMDV54.js → chunk-TUQGOYK6.js} +1 -1
- package/dist/mcp-chunks/{chunk-YIRGLKDA.js → chunk-TYYSBILI.js} +46 -27
- package/dist/mcp-chunks/{chunk-FS5JIKT6.js → chunk-UHO6KIUJ.js} +6 -6
- package/dist/mcp-chunks/{chunk-RSTKSBVF.js → chunk-UIPG6W7N.js} +2 -2
- package/dist/mcp-chunks/{chunk-IME7DGLJ.js → chunk-UKM35J67.js} +2 -2
- package/dist/mcp-chunks/{chunk-FX5NYWBH.js → chunk-UYJZJXC2.js} +3 -3
- package/dist/mcp-chunks/{chunk-HCOKLSOB.js → chunk-VJIAHZZG.js} +4 -4
- package/dist/mcp-chunks/{chunk-IYWYVHHD.js → chunk-WHJUDBPR.js} +1 -1
- package/dist/mcp-chunks/{chunk-53NRFMB3.js → chunk-XNHGMWN2.js} +46 -25
- package/dist/mcp-chunks/{cli-XU26MUCN.js → cli-JI7MEAAX.js} +111 -79
- package/dist/mcp-chunks/client-QU7ABSNB.js +30 -0
- package/dist/mcp-chunks/{config-command-UQMMIK2U.js → config-command-GRZLKD3R.js} +36 -29
- package/dist/mcp-chunks/daemon-command-3266CYHO.js +30 -0
- package/dist/mcp-chunks/{dist-DM2RXZMU.js → dist-USMCQ22V.js} +105 -47
- package/dist/mcp-chunks/{emit-ts-command-KAOL6DAN.js → emit-ts-command-7VLESP7H.js} +20 -19
- package/dist/mcp-chunks/{generate-cli-runner-AK6XNRTK.js → generate-cli-runner-SSW2B72K.js} +54 -51
- package/dist/mcp-chunks/generated-daemon-runtime-7CFVWLC7.js +30 -0
- package/dist/mcp-chunks/{inspect-cli-command-6FVJO7H2.js → inspect-cli-command-NCGCMOIS.js} +9 -10
- package/dist/mcp-chunks/{launch-EIT73HX4.js → launch-NBONSPNK.js} +1 -1
- package/dist/mcp-chunks/{lifecycle-QH4TUI3K.js → lifecycle-CXAKUCN4.js} +1 -1
- package/dist/mcp-chunks/{list-command-UOB2XZK7.js → list-command-5T4UF4PF.js} +61 -75
- package/dist/mcp-chunks/{output-utils-6YXH23T7.js → output-utils-YFTWQZ5V.js} +3 -3
- package/dist/mcp-chunks/{prompt-CH6TK0bC-ZB6RFAXR.js → prompt-CH6TK0bC-6DI4RA4E.js} +1 -1
- package/dist/mcp-chunks/{record-command-FO5TTERC.js → record-command-TE5O7WBL.js} +5 -5
- package/dist/mcp-chunks/{replay-command-SCBPCGQ7.js → replay-command-QCUL5ASR.js} +6 -6
- package/dist/mcp-chunks/{resource-command-S2J7XEMV.js → resource-command-XMGF7EAK.js} +9 -10
- package/dist/mcp-chunks/{result-utils-OME6HGS6.js → result-utils-HKB42M7Y.js} +3 -4
- package/dist/mcp-chunks/runtime-3X2XVS6X.js +37 -0
- package/dist/mcp-chunks/runtime-wrapper-MI3HF45J.js +10 -0
- package/dist/mcp-chunks/{serve-command-DDBZZSG6.js → serve-command-5HV3ZE25.js} +30 -34
- package/dist/mcp-chunks/{timeouts-HNGNKDQN.js → timeouts-YBFBTLV2.js} +8 -5
- package/dist/mcp-chunks/{vault-command-TJZYS3YI.js → vault-command-FC2PD5U6.js} +4 -6
- package/dist/mcp-chunks/webapi-IFUPO72B.js +2481 -0
- package/dist/mcp-daemon.js +35 -33
- package/dist/mcp-run-worker.js +28 -32
- package/dist/pi-extension.d.ts +1 -1
- package/dist/pi-extension.js +8 -8
- package/dist/pi-extension.js.map +1 -1
- package/dist/{recipe-agent.d.ts → recipe/agent.d.ts} +3 -3
- package/dist/recipe/agent.d.ts.map +1 -0
- package/dist/{recipe-agent.js → recipe/agent.js} +5 -5
- package/dist/recipe/agent.js.map +1 -0
- package/dist/{recipe-extensions.d.ts → recipe/extensions.d.ts} +1 -1
- package/dist/recipe/extensions.d.ts.map +1 -0
- package/dist/{recipe-extensions.js → recipe/extensions.js} +1 -1
- package/dist/recipe/extensions.js.map +1 -0
- package/dist/{recipe-mcp-config.d.ts → recipe/mcp-config.d.ts} +2 -2
- package/dist/recipe/mcp-config.d.ts.map +1 -0
- package/dist/{recipe-mcp-config.js → recipe/mcp-config.js} +1 -1
- package/dist/recipe/mcp-config.js.map +1 -0
- package/dist/{recipe-model.d.ts → recipe/model.d.ts} +1 -1
- package/dist/recipe/model.d.ts.map +1 -0
- package/dist/{recipe-model.js → recipe/model.js} +1 -1
- package/dist/recipe/model.js.map +1 -0
- package/dist/{recipe-package.d.ts → recipe/package.d.ts} +1 -1
- package/dist/recipe/package.d.ts.map +1 -0
- package/dist/{recipe-package.js → recipe/package.js} +1 -1
- package/dist/recipe/package.js.map +1 -0
- package/dist/recipe/resolve.d.ts +6 -6
- package/dist/recipe/resolve.d.ts.map +1 -1
- package/dist/recipe/resolve.js +4 -4
- package/dist/recipe/resolve.js.map +1 -1
- package/dist/{recipe-session.d.ts → recipe/session.d.ts} +1 -1
- package/dist/recipe/session.d.ts.map +1 -0
- package/dist/{recipe-session.js → recipe/session.js} +1 -1
- package/dist/recipe/session.js.map +1 -0
- package/dist/{recipe-skills.d.ts → recipe/skills.d.ts} +1 -1
- package/dist/recipe/skills.d.ts.map +1 -0
- package/dist/{recipe-skills.js → recipe/skills.js} +2 -2
- package/dist/recipe/skills.js.map +1 -0
- package/dist/run-controller.js +2 -2
- package/dist/session.d.ts +1 -1
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +5 -5
- package/dist/session.js.map +1 -1
- package/docs/channels.md +1 -1
- package/docs/pi-extension.md +1 -1
- package/docs/recipe-format.md +8 -4
- package/docs/recipe-templates.md +46 -0
- package/docs/slack.md +1 -1
- package/package.json +14 -14
- package/dist/child-agent-completions.d.ts.map +0 -1
- package/dist/child-agent-completions.js.map +0 -1
- package/dist/child-agent-store.d.ts.map +0 -1
- package/dist/child-agent-store.js.map +0 -1
- package/dist/child-agent.d.ts.map +0 -1
- package/dist/child-agent.js.map +0 -1
- package/dist/child-session.d.ts.map +0 -1
- package/dist/child-session.js.map +0 -1
- package/dist/mcp-catalog.d.ts.map +0 -1
- package/dist/mcp-catalog.js.map +0 -1
- package/dist/mcp-chunks/call-arguments-4DWPBLQP.js +0 -15
- package/dist/mcp-chunks/chunk-3Z7MFS6K.js +0 -86
- package/dist/mcp-chunks/chunk-AD3FQ73K.js +0 -39
- package/dist/mcp-chunks/chunk-DTZHEVKC.js +0 -12
- package/dist/mcp-chunks/chunk-H3JCYHGS.js +0 -1018
- package/dist/mcp-chunks/chunk-HN7WPMCA.js +0 -18904
- package/dist/mcp-chunks/chunk-I5GI2A2D.js +0 -92
- package/dist/mcp-chunks/chunk-IRTJXFWA.js +0 -28
- package/dist/mcp-chunks/chunk-NTHUNCXJ.js +0 -526
- package/dist/mcp-chunks/chunk-OD3MSMXY.js +0 -15
- package/dist/mcp-chunks/chunk-PZ323CXI.js +0 -17394
- package/dist/mcp-chunks/client-OT34CKRH.js +0 -21
- package/dist/mcp-chunks/daemon-command-YCIOZGPZ.js +0 -35
- package/dist/mcp-chunks/runtime-QIPMLIJI.js +0 -39
- package/dist/mcp-chunks/runtime-wrapper-X4YFKMJI.js +0 -16
- package/dist/mcp-chunks/webapi-4GWO2UBA.js +0 -3508
- package/dist/mcp-cli-core.d.ts.map +0 -1
- package/dist/mcp-cli-core.js.map +0 -1
- package/dist/mcp-cli-help.d.ts +0 -2
- package/dist/mcp-cli-help.d.ts.map +0 -1
- package/dist/mcp-cli-help.js +0 -36
- package/dist/mcp-cli-help.js.map +0 -1
- package/dist/mcp-cli-policy.d.ts.map +0 -1
- package/dist/mcp-cli-policy.js.map +0 -1
- package/dist/mcp-cli.d.ts +0 -3
- package/dist/mcp-cli.d.ts.map +0 -1
- package/dist/mcp-cli.js.map +0 -1
- package/dist/mcp-client.d.ts +0 -3
- package/dist/mcp-client.d.ts.map +0 -1
- package/dist/mcp-client.js.map +0 -1
- package/dist/mcp-command-context.d.ts.map +0 -1
- package/dist/mcp-command-context.js.map +0 -1
- package/dist/mcp-contract.d.ts.map +0 -1
- package/dist/mcp-contract.js.map +0 -1
- package/dist/mcp-daemon-client.d.ts.map +0 -1
- package/dist/mcp-daemon-client.js.map +0 -1
- package/dist/mcp-daemon-protocol.d.ts.map +0 -1
- package/dist/mcp-daemon-protocol.js.map +0 -1
- package/dist/mcp-daemon.d.ts +0 -3
- package/dist/mcp-daemon.d.ts.map +0 -1
- package/dist/mcp-policy.d.ts.map +0 -1
- package/dist/mcp-policy.js.map +0 -1
- package/dist/mcp-run-worker.d.ts +0 -2
- package/dist/mcp-run-worker.d.ts.map +0 -1
- package/dist/mcp-run-worker.js.map +0 -1
- package/dist/mcp-tools.d.ts.map +0 -1
- package/dist/mcp-tools.js.map +0 -1
- package/dist/mcp-trace-context.d.ts.map +0 -1
- package/dist/mcp-trace-context.js.map +0 -1
- package/dist/mcp.d.ts.map +0 -1
- package/dist/mcp.js.map +0 -1
- package/dist/recipe-agent.d.ts.map +0 -1
- package/dist/recipe-agent.js.map +0 -1
- package/dist/recipe-extensions.d.ts.map +0 -1
- package/dist/recipe-extensions.js.map +0 -1
- package/dist/recipe-mcp-config.d.ts.map +0 -1
- package/dist/recipe-mcp-config.js.map +0 -1
- package/dist/recipe-model.d.ts.map +0 -1
- package/dist/recipe-model.js.map +0 -1
- package/dist/recipe-package.d.ts.map +0 -1
- package/dist/recipe-package.js.map +0 -1
- package/dist/recipe-session.d.ts.map +0 -1
- package/dist/recipe-session.js.map +0 -1
- package/dist/recipe-skills.d.ts.map +0 -1
- package/dist/recipe-skills.js.map +0 -1
|
@@ -0,0 +1,982 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
2
|
+
|
|
3
|
+
// node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/scanner.js
|
|
4
|
+
function createScanner(text, ignoreTrivia = false) {
|
|
5
|
+
const len = text.length;
|
|
6
|
+
let pos = 0, value = "", tokenOffset = 0, token = 16, lineNumber = 0, lineStartOffset = 0, tokenLineStartOffset = 0, prevTokenLineStartOffset = 0, scanError = 0;
|
|
7
|
+
function scanHexDigits(count, exact) {
|
|
8
|
+
let digits = 0;
|
|
9
|
+
let value2 = 0;
|
|
10
|
+
while (digits < count || !exact) {
|
|
11
|
+
let ch = text.charCodeAt(pos);
|
|
12
|
+
if (ch >= 48 && ch <= 57) {
|
|
13
|
+
value2 = value2 * 16 + ch - 48;
|
|
14
|
+
} else if (ch >= 65 && ch <= 70) {
|
|
15
|
+
value2 = value2 * 16 + ch - 65 + 10;
|
|
16
|
+
} else if (ch >= 97 && ch <= 102) {
|
|
17
|
+
value2 = value2 * 16 + ch - 97 + 10;
|
|
18
|
+
} else {
|
|
19
|
+
break;
|
|
20
|
+
}
|
|
21
|
+
pos++;
|
|
22
|
+
digits++;
|
|
23
|
+
}
|
|
24
|
+
if (digits < count) {
|
|
25
|
+
value2 = -1;
|
|
26
|
+
}
|
|
27
|
+
return value2;
|
|
28
|
+
}
|
|
29
|
+
function setPosition(newPosition) {
|
|
30
|
+
pos = newPosition;
|
|
31
|
+
value = "";
|
|
32
|
+
tokenOffset = 0;
|
|
33
|
+
token = 16;
|
|
34
|
+
scanError = 0;
|
|
35
|
+
}
|
|
36
|
+
function scanNumber() {
|
|
37
|
+
let start = pos;
|
|
38
|
+
if (text.charCodeAt(pos) === 48) {
|
|
39
|
+
pos++;
|
|
40
|
+
} else {
|
|
41
|
+
pos++;
|
|
42
|
+
while (pos < text.length && isDigit(text.charCodeAt(pos))) {
|
|
43
|
+
pos++;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
if (pos < text.length && text.charCodeAt(pos) === 46) {
|
|
47
|
+
pos++;
|
|
48
|
+
if (pos < text.length && isDigit(text.charCodeAt(pos))) {
|
|
49
|
+
pos++;
|
|
50
|
+
while (pos < text.length && isDigit(text.charCodeAt(pos))) {
|
|
51
|
+
pos++;
|
|
52
|
+
}
|
|
53
|
+
} else {
|
|
54
|
+
scanError = 3;
|
|
55
|
+
return text.substring(start, pos);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
let end = pos;
|
|
59
|
+
if (pos < text.length && (text.charCodeAt(pos) === 69 || text.charCodeAt(pos) === 101)) {
|
|
60
|
+
pos++;
|
|
61
|
+
if (pos < text.length && text.charCodeAt(pos) === 43 || text.charCodeAt(pos) === 45) {
|
|
62
|
+
pos++;
|
|
63
|
+
}
|
|
64
|
+
if (pos < text.length && isDigit(text.charCodeAt(pos))) {
|
|
65
|
+
pos++;
|
|
66
|
+
while (pos < text.length && isDigit(text.charCodeAt(pos))) {
|
|
67
|
+
pos++;
|
|
68
|
+
}
|
|
69
|
+
end = pos;
|
|
70
|
+
} else {
|
|
71
|
+
scanError = 3;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return text.substring(start, end);
|
|
75
|
+
}
|
|
76
|
+
function scanString() {
|
|
77
|
+
let result = "", start = pos;
|
|
78
|
+
while (true) {
|
|
79
|
+
if (pos >= len) {
|
|
80
|
+
result += text.substring(start, pos);
|
|
81
|
+
scanError = 2;
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
84
|
+
const ch = text.charCodeAt(pos);
|
|
85
|
+
if (ch === 34) {
|
|
86
|
+
result += text.substring(start, pos);
|
|
87
|
+
pos++;
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
if (ch === 92) {
|
|
91
|
+
result += text.substring(start, pos);
|
|
92
|
+
pos++;
|
|
93
|
+
if (pos >= len) {
|
|
94
|
+
scanError = 2;
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
const ch2 = text.charCodeAt(pos++);
|
|
98
|
+
switch (ch2) {
|
|
99
|
+
case 34:
|
|
100
|
+
result += '"';
|
|
101
|
+
break;
|
|
102
|
+
case 92:
|
|
103
|
+
result += "\\";
|
|
104
|
+
break;
|
|
105
|
+
case 47:
|
|
106
|
+
result += "/";
|
|
107
|
+
break;
|
|
108
|
+
case 98:
|
|
109
|
+
result += "\b";
|
|
110
|
+
break;
|
|
111
|
+
case 102:
|
|
112
|
+
result += "\f";
|
|
113
|
+
break;
|
|
114
|
+
case 110:
|
|
115
|
+
result += "\n";
|
|
116
|
+
break;
|
|
117
|
+
case 114:
|
|
118
|
+
result += "\r";
|
|
119
|
+
break;
|
|
120
|
+
case 116:
|
|
121
|
+
result += " ";
|
|
122
|
+
break;
|
|
123
|
+
case 117:
|
|
124
|
+
const ch3 = scanHexDigits(4, true);
|
|
125
|
+
if (ch3 >= 0) {
|
|
126
|
+
result += String.fromCharCode(ch3);
|
|
127
|
+
} else {
|
|
128
|
+
scanError = 4;
|
|
129
|
+
}
|
|
130
|
+
break;
|
|
131
|
+
default:
|
|
132
|
+
scanError = 5;
|
|
133
|
+
}
|
|
134
|
+
start = pos;
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
137
|
+
if (ch >= 0 && ch <= 31) {
|
|
138
|
+
if (isLineBreak(ch)) {
|
|
139
|
+
result += text.substring(start, pos);
|
|
140
|
+
scanError = 2;
|
|
141
|
+
break;
|
|
142
|
+
} else {
|
|
143
|
+
scanError = 6;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
pos++;
|
|
147
|
+
}
|
|
148
|
+
return result;
|
|
149
|
+
}
|
|
150
|
+
function scanNext() {
|
|
151
|
+
value = "";
|
|
152
|
+
scanError = 0;
|
|
153
|
+
tokenOffset = pos;
|
|
154
|
+
lineStartOffset = lineNumber;
|
|
155
|
+
prevTokenLineStartOffset = tokenLineStartOffset;
|
|
156
|
+
if (pos >= len) {
|
|
157
|
+
tokenOffset = len;
|
|
158
|
+
return token = 17;
|
|
159
|
+
}
|
|
160
|
+
let code = text.charCodeAt(pos);
|
|
161
|
+
if (isWhiteSpace(code)) {
|
|
162
|
+
do {
|
|
163
|
+
pos++;
|
|
164
|
+
value += String.fromCharCode(code);
|
|
165
|
+
code = text.charCodeAt(pos);
|
|
166
|
+
} while (isWhiteSpace(code));
|
|
167
|
+
return token = 15;
|
|
168
|
+
}
|
|
169
|
+
if (isLineBreak(code)) {
|
|
170
|
+
pos++;
|
|
171
|
+
value += String.fromCharCode(code);
|
|
172
|
+
if (code === 13 && text.charCodeAt(pos) === 10) {
|
|
173
|
+
pos++;
|
|
174
|
+
value += "\n";
|
|
175
|
+
}
|
|
176
|
+
lineNumber++;
|
|
177
|
+
tokenLineStartOffset = pos;
|
|
178
|
+
return token = 14;
|
|
179
|
+
}
|
|
180
|
+
switch (code) {
|
|
181
|
+
// tokens: []{}:,
|
|
182
|
+
case 123:
|
|
183
|
+
pos++;
|
|
184
|
+
return token = 1;
|
|
185
|
+
case 125:
|
|
186
|
+
pos++;
|
|
187
|
+
return token = 2;
|
|
188
|
+
case 91:
|
|
189
|
+
pos++;
|
|
190
|
+
return token = 3;
|
|
191
|
+
case 93:
|
|
192
|
+
pos++;
|
|
193
|
+
return token = 4;
|
|
194
|
+
case 58:
|
|
195
|
+
pos++;
|
|
196
|
+
return token = 6;
|
|
197
|
+
case 44:
|
|
198
|
+
pos++;
|
|
199
|
+
return token = 5;
|
|
200
|
+
// strings
|
|
201
|
+
case 34:
|
|
202
|
+
pos++;
|
|
203
|
+
value = scanString();
|
|
204
|
+
return token = 10;
|
|
205
|
+
// comments
|
|
206
|
+
case 47:
|
|
207
|
+
const start = pos - 1;
|
|
208
|
+
if (text.charCodeAt(pos + 1) === 47) {
|
|
209
|
+
pos += 2;
|
|
210
|
+
while (pos < len) {
|
|
211
|
+
if (isLineBreak(text.charCodeAt(pos))) {
|
|
212
|
+
break;
|
|
213
|
+
}
|
|
214
|
+
pos++;
|
|
215
|
+
}
|
|
216
|
+
value = text.substring(start, pos);
|
|
217
|
+
return token = 12;
|
|
218
|
+
}
|
|
219
|
+
if (text.charCodeAt(pos + 1) === 42) {
|
|
220
|
+
pos += 2;
|
|
221
|
+
const safeLength = len - 1;
|
|
222
|
+
let commentClosed = false;
|
|
223
|
+
while (pos < safeLength) {
|
|
224
|
+
const ch = text.charCodeAt(pos);
|
|
225
|
+
if (ch === 42 && text.charCodeAt(pos + 1) === 47) {
|
|
226
|
+
pos += 2;
|
|
227
|
+
commentClosed = true;
|
|
228
|
+
break;
|
|
229
|
+
}
|
|
230
|
+
pos++;
|
|
231
|
+
if (isLineBreak(ch)) {
|
|
232
|
+
if (ch === 13 && text.charCodeAt(pos) === 10) {
|
|
233
|
+
pos++;
|
|
234
|
+
}
|
|
235
|
+
lineNumber++;
|
|
236
|
+
tokenLineStartOffset = pos;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
if (!commentClosed) {
|
|
240
|
+
pos++;
|
|
241
|
+
scanError = 1;
|
|
242
|
+
}
|
|
243
|
+
value = text.substring(start, pos);
|
|
244
|
+
return token = 13;
|
|
245
|
+
}
|
|
246
|
+
value += String.fromCharCode(code);
|
|
247
|
+
pos++;
|
|
248
|
+
return token = 16;
|
|
249
|
+
// numbers
|
|
250
|
+
case 45:
|
|
251
|
+
value += String.fromCharCode(code);
|
|
252
|
+
pos++;
|
|
253
|
+
if (pos === len || !isDigit(text.charCodeAt(pos))) {
|
|
254
|
+
return token = 16;
|
|
255
|
+
}
|
|
256
|
+
// found a minus, followed by a number so
|
|
257
|
+
// we fall through to proceed with scanning
|
|
258
|
+
// numbers
|
|
259
|
+
case 48:
|
|
260
|
+
case 49:
|
|
261
|
+
case 50:
|
|
262
|
+
case 51:
|
|
263
|
+
case 52:
|
|
264
|
+
case 53:
|
|
265
|
+
case 54:
|
|
266
|
+
case 55:
|
|
267
|
+
case 56:
|
|
268
|
+
case 57:
|
|
269
|
+
value += scanNumber();
|
|
270
|
+
return token = 11;
|
|
271
|
+
// literals and unknown symbols
|
|
272
|
+
default:
|
|
273
|
+
while (pos < len && isUnknownContentCharacter(code)) {
|
|
274
|
+
pos++;
|
|
275
|
+
code = text.charCodeAt(pos);
|
|
276
|
+
}
|
|
277
|
+
if (tokenOffset !== pos) {
|
|
278
|
+
value = text.substring(tokenOffset, pos);
|
|
279
|
+
switch (value) {
|
|
280
|
+
case "true":
|
|
281
|
+
return token = 8;
|
|
282
|
+
case "false":
|
|
283
|
+
return token = 9;
|
|
284
|
+
case "null":
|
|
285
|
+
return token = 7;
|
|
286
|
+
}
|
|
287
|
+
return token = 16;
|
|
288
|
+
}
|
|
289
|
+
value += String.fromCharCode(code);
|
|
290
|
+
pos++;
|
|
291
|
+
return token = 16;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
function isUnknownContentCharacter(code) {
|
|
295
|
+
if (isWhiteSpace(code) || isLineBreak(code)) {
|
|
296
|
+
return false;
|
|
297
|
+
}
|
|
298
|
+
switch (code) {
|
|
299
|
+
case 125:
|
|
300
|
+
case 93:
|
|
301
|
+
case 123:
|
|
302
|
+
case 91:
|
|
303
|
+
case 34:
|
|
304
|
+
case 58:
|
|
305
|
+
case 44:
|
|
306
|
+
case 47:
|
|
307
|
+
return false;
|
|
308
|
+
}
|
|
309
|
+
return true;
|
|
310
|
+
}
|
|
311
|
+
function scanNextNonTrivia() {
|
|
312
|
+
let result;
|
|
313
|
+
do {
|
|
314
|
+
result = scanNext();
|
|
315
|
+
} while (result >= 12 && result <= 15);
|
|
316
|
+
return result;
|
|
317
|
+
}
|
|
318
|
+
return {
|
|
319
|
+
setPosition,
|
|
320
|
+
getPosition: () => pos,
|
|
321
|
+
scan: ignoreTrivia ? scanNextNonTrivia : scanNext,
|
|
322
|
+
getToken: () => token,
|
|
323
|
+
getTokenValue: () => value,
|
|
324
|
+
getTokenOffset: () => tokenOffset,
|
|
325
|
+
getTokenLength: () => pos - tokenOffset,
|
|
326
|
+
getTokenStartLine: () => lineStartOffset,
|
|
327
|
+
getTokenStartCharacter: () => tokenOffset - prevTokenLineStartOffset,
|
|
328
|
+
getTokenError: () => scanError
|
|
329
|
+
};
|
|
330
|
+
}
|
|
331
|
+
function isWhiteSpace(ch) {
|
|
332
|
+
return ch === 32 || ch === 9;
|
|
333
|
+
}
|
|
334
|
+
function isLineBreak(ch) {
|
|
335
|
+
return ch === 10 || ch === 13;
|
|
336
|
+
}
|
|
337
|
+
function isDigit(ch) {
|
|
338
|
+
return ch >= 48 && ch <= 57;
|
|
339
|
+
}
|
|
340
|
+
var CharacterCodes;
|
|
341
|
+
(function(CharacterCodes2) {
|
|
342
|
+
CharacterCodes2[CharacterCodes2["lineFeed"] = 10] = "lineFeed";
|
|
343
|
+
CharacterCodes2[CharacterCodes2["carriageReturn"] = 13] = "carriageReturn";
|
|
344
|
+
CharacterCodes2[CharacterCodes2["space"] = 32] = "space";
|
|
345
|
+
CharacterCodes2[CharacterCodes2["_0"] = 48] = "_0";
|
|
346
|
+
CharacterCodes2[CharacterCodes2["_1"] = 49] = "_1";
|
|
347
|
+
CharacterCodes2[CharacterCodes2["_2"] = 50] = "_2";
|
|
348
|
+
CharacterCodes2[CharacterCodes2["_3"] = 51] = "_3";
|
|
349
|
+
CharacterCodes2[CharacterCodes2["_4"] = 52] = "_4";
|
|
350
|
+
CharacterCodes2[CharacterCodes2["_5"] = 53] = "_5";
|
|
351
|
+
CharacterCodes2[CharacterCodes2["_6"] = 54] = "_6";
|
|
352
|
+
CharacterCodes2[CharacterCodes2["_7"] = 55] = "_7";
|
|
353
|
+
CharacterCodes2[CharacterCodes2["_8"] = 56] = "_8";
|
|
354
|
+
CharacterCodes2[CharacterCodes2["_9"] = 57] = "_9";
|
|
355
|
+
CharacterCodes2[CharacterCodes2["a"] = 97] = "a";
|
|
356
|
+
CharacterCodes2[CharacterCodes2["b"] = 98] = "b";
|
|
357
|
+
CharacterCodes2[CharacterCodes2["c"] = 99] = "c";
|
|
358
|
+
CharacterCodes2[CharacterCodes2["d"] = 100] = "d";
|
|
359
|
+
CharacterCodes2[CharacterCodes2["e"] = 101] = "e";
|
|
360
|
+
CharacterCodes2[CharacterCodes2["f"] = 102] = "f";
|
|
361
|
+
CharacterCodes2[CharacterCodes2["g"] = 103] = "g";
|
|
362
|
+
CharacterCodes2[CharacterCodes2["h"] = 104] = "h";
|
|
363
|
+
CharacterCodes2[CharacterCodes2["i"] = 105] = "i";
|
|
364
|
+
CharacterCodes2[CharacterCodes2["j"] = 106] = "j";
|
|
365
|
+
CharacterCodes2[CharacterCodes2["k"] = 107] = "k";
|
|
366
|
+
CharacterCodes2[CharacterCodes2["l"] = 108] = "l";
|
|
367
|
+
CharacterCodes2[CharacterCodes2["m"] = 109] = "m";
|
|
368
|
+
CharacterCodes2[CharacterCodes2["n"] = 110] = "n";
|
|
369
|
+
CharacterCodes2[CharacterCodes2["o"] = 111] = "o";
|
|
370
|
+
CharacterCodes2[CharacterCodes2["p"] = 112] = "p";
|
|
371
|
+
CharacterCodes2[CharacterCodes2["q"] = 113] = "q";
|
|
372
|
+
CharacterCodes2[CharacterCodes2["r"] = 114] = "r";
|
|
373
|
+
CharacterCodes2[CharacterCodes2["s"] = 115] = "s";
|
|
374
|
+
CharacterCodes2[CharacterCodes2["t"] = 116] = "t";
|
|
375
|
+
CharacterCodes2[CharacterCodes2["u"] = 117] = "u";
|
|
376
|
+
CharacterCodes2[CharacterCodes2["v"] = 118] = "v";
|
|
377
|
+
CharacterCodes2[CharacterCodes2["w"] = 119] = "w";
|
|
378
|
+
CharacterCodes2[CharacterCodes2["x"] = 120] = "x";
|
|
379
|
+
CharacterCodes2[CharacterCodes2["y"] = 121] = "y";
|
|
380
|
+
CharacterCodes2[CharacterCodes2["z"] = 122] = "z";
|
|
381
|
+
CharacterCodes2[CharacterCodes2["A"] = 65] = "A";
|
|
382
|
+
CharacterCodes2[CharacterCodes2["B"] = 66] = "B";
|
|
383
|
+
CharacterCodes2[CharacterCodes2["C"] = 67] = "C";
|
|
384
|
+
CharacterCodes2[CharacterCodes2["D"] = 68] = "D";
|
|
385
|
+
CharacterCodes2[CharacterCodes2["E"] = 69] = "E";
|
|
386
|
+
CharacterCodes2[CharacterCodes2["F"] = 70] = "F";
|
|
387
|
+
CharacterCodes2[CharacterCodes2["G"] = 71] = "G";
|
|
388
|
+
CharacterCodes2[CharacterCodes2["H"] = 72] = "H";
|
|
389
|
+
CharacterCodes2[CharacterCodes2["I"] = 73] = "I";
|
|
390
|
+
CharacterCodes2[CharacterCodes2["J"] = 74] = "J";
|
|
391
|
+
CharacterCodes2[CharacterCodes2["K"] = 75] = "K";
|
|
392
|
+
CharacterCodes2[CharacterCodes2["L"] = 76] = "L";
|
|
393
|
+
CharacterCodes2[CharacterCodes2["M"] = 77] = "M";
|
|
394
|
+
CharacterCodes2[CharacterCodes2["N"] = 78] = "N";
|
|
395
|
+
CharacterCodes2[CharacterCodes2["O"] = 79] = "O";
|
|
396
|
+
CharacterCodes2[CharacterCodes2["P"] = 80] = "P";
|
|
397
|
+
CharacterCodes2[CharacterCodes2["Q"] = 81] = "Q";
|
|
398
|
+
CharacterCodes2[CharacterCodes2["R"] = 82] = "R";
|
|
399
|
+
CharacterCodes2[CharacterCodes2["S"] = 83] = "S";
|
|
400
|
+
CharacterCodes2[CharacterCodes2["T"] = 84] = "T";
|
|
401
|
+
CharacterCodes2[CharacterCodes2["U"] = 85] = "U";
|
|
402
|
+
CharacterCodes2[CharacterCodes2["V"] = 86] = "V";
|
|
403
|
+
CharacterCodes2[CharacterCodes2["W"] = 87] = "W";
|
|
404
|
+
CharacterCodes2[CharacterCodes2["X"] = 88] = "X";
|
|
405
|
+
CharacterCodes2[CharacterCodes2["Y"] = 89] = "Y";
|
|
406
|
+
CharacterCodes2[CharacterCodes2["Z"] = 90] = "Z";
|
|
407
|
+
CharacterCodes2[CharacterCodes2["asterisk"] = 42] = "asterisk";
|
|
408
|
+
CharacterCodes2[CharacterCodes2["backslash"] = 92] = "backslash";
|
|
409
|
+
CharacterCodes2[CharacterCodes2["closeBrace"] = 125] = "closeBrace";
|
|
410
|
+
CharacterCodes2[CharacterCodes2["closeBracket"] = 93] = "closeBracket";
|
|
411
|
+
CharacterCodes2[CharacterCodes2["colon"] = 58] = "colon";
|
|
412
|
+
CharacterCodes2[CharacterCodes2["comma"] = 44] = "comma";
|
|
413
|
+
CharacterCodes2[CharacterCodes2["dot"] = 46] = "dot";
|
|
414
|
+
CharacterCodes2[CharacterCodes2["doubleQuote"] = 34] = "doubleQuote";
|
|
415
|
+
CharacterCodes2[CharacterCodes2["minus"] = 45] = "minus";
|
|
416
|
+
CharacterCodes2[CharacterCodes2["openBrace"] = 123] = "openBrace";
|
|
417
|
+
CharacterCodes2[CharacterCodes2["openBracket"] = 91] = "openBracket";
|
|
418
|
+
CharacterCodes2[CharacterCodes2["plus"] = 43] = "plus";
|
|
419
|
+
CharacterCodes2[CharacterCodes2["slash"] = 47] = "slash";
|
|
420
|
+
CharacterCodes2[CharacterCodes2["formFeed"] = 12] = "formFeed";
|
|
421
|
+
CharacterCodes2[CharacterCodes2["tab"] = 9] = "tab";
|
|
422
|
+
})(CharacterCodes || (CharacterCodes = {}));
|
|
423
|
+
|
|
424
|
+
// node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/string-intern.js
|
|
425
|
+
var cachedSpaces = new Array(20).fill(0).map((_, index) => {
|
|
426
|
+
return " ".repeat(index);
|
|
427
|
+
});
|
|
428
|
+
var maxCachedValues = 200;
|
|
429
|
+
var cachedBreakLinesWithSpaces = {
|
|
430
|
+
" ": {
|
|
431
|
+
"\n": new Array(maxCachedValues).fill(0).map((_, index) => {
|
|
432
|
+
return "\n" + " ".repeat(index);
|
|
433
|
+
}),
|
|
434
|
+
"\r": new Array(maxCachedValues).fill(0).map((_, index) => {
|
|
435
|
+
return "\r" + " ".repeat(index);
|
|
436
|
+
}),
|
|
437
|
+
"\r\n": new Array(maxCachedValues).fill(0).map((_, index) => {
|
|
438
|
+
return "\r\n" + " ".repeat(index);
|
|
439
|
+
})
|
|
440
|
+
},
|
|
441
|
+
" ": {
|
|
442
|
+
"\n": new Array(maxCachedValues).fill(0).map((_, index) => {
|
|
443
|
+
return "\n" + " ".repeat(index);
|
|
444
|
+
}),
|
|
445
|
+
"\r": new Array(maxCachedValues).fill(0).map((_, index) => {
|
|
446
|
+
return "\r" + " ".repeat(index);
|
|
447
|
+
}),
|
|
448
|
+
"\r\n": new Array(maxCachedValues).fill(0).map((_, index) => {
|
|
449
|
+
return "\r\n" + " ".repeat(index);
|
|
450
|
+
})
|
|
451
|
+
}
|
|
452
|
+
};
|
|
453
|
+
|
|
454
|
+
// node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/parser.js
|
|
455
|
+
var ParseOptions;
|
|
456
|
+
(function(ParseOptions2) {
|
|
457
|
+
ParseOptions2.DEFAULT = {
|
|
458
|
+
allowTrailingComma: false
|
|
459
|
+
};
|
|
460
|
+
})(ParseOptions || (ParseOptions = {}));
|
|
461
|
+
function parse(text, errors = [], options = ParseOptions.DEFAULT) {
|
|
462
|
+
let currentProperty = null;
|
|
463
|
+
let currentParent = [];
|
|
464
|
+
const previousParents = [];
|
|
465
|
+
function onValue(value) {
|
|
466
|
+
if (Array.isArray(currentParent)) {
|
|
467
|
+
currentParent.push(value);
|
|
468
|
+
} else if (currentProperty !== null) {
|
|
469
|
+
currentParent[currentProperty] = value;
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
const visitor = {
|
|
473
|
+
onObjectBegin: () => {
|
|
474
|
+
const object = {};
|
|
475
|
+
onValue(object);
|
|
476
|
+
previousParents.push(currentParent);
|
|
477
|
+
currentParent = object;
|
|
478
|
+
currentProperty = null;
|
|
479
|
+
},
|
|
480
|
+
onObjectProperty: (name) => {
|
|
481
|
+
currentProperty = name;
|
|
482
|
+
},
|
|
483
|
+
onObjectEnd: () => {
|
|
484
|
+
currentParent = previousParents.pop();
|
|
485
|
+
},
|
|
486
|
+
onArrayBegin: () => {
|
|
487
|
+
const array = [];
|
|
488
|
+
onValue(array);
|
|
489
|
+
previousParents.push(currentParent);
|
|
490
|
+
currentParent = array;
|
|
491
|
+
currentProperty = null;
|
|
492
|
+
},
|
|
493
|
+
onArrayEnd: () => {
|
|
494
|
+
currentParent = previousParents.pop();
|
|
495
|
+
},
|
|
496
|
+
onLiteralValue: onValue,
|
|
497
|
+
onError: (error, offset, length) => {
|
|
498
|
+
errors.push({ error, offset, length });
|
|
499
|
+
}
|
|
500
|
+
};
|
|
501
|
+
visit(text, visitor, options);
|
|
502
|
+
return currentParent[0];
|
|
503
|
+
}
|
|
504
|
+
function parseTree(text, errors = [], options = ParseOptions.DEFAULT) {
|
|
505
|
+
let currentParent = { type: "array", offset: -1, length: -1, children: [], parent: void 0 };
|
|
506
|
+
function ensurePropertyComplete(endOffset) {
|
|
507
|
+
if (currentParent.type === "property") {
|
|
508
|
+
currentParent.length = endOffset - currentParent.offset;
|
|
509
|
+
currentParent = currentParent.parent;
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
function onValue(valueNode) {
|
|
513
|
+
currentParent.children.push(valueNode);
|
|
514
|
+
return valueNode;
|
|
515
|
+
}
|
|
516
|
+
const visitor = {
|
|
517
|
+
onObjectBegin: (offset) => {
|
|
518
|
+
currentParent = onValue({ type: "object", offset, length: -1, parent: currentParent, children: [] });
|
|
519
|
+
},
|
|
520
|
+
onObjectProperty: (name, offset, length) => {
|
|
521
|
+
currentParent = onValue({ type: "property", offset, length: -1, parent: currentParent, children: [] });
|
|
522
|
+
currentParent.children.push({ type: "string", value: name, offset, length, parent: currentParent });
|
|
523
|
+
},
|
|
524
|
+
onObjectEnd: (offset, length) => {
|
|
525
|
+
ensurePropertyComplete(offset + length);
|
|
526
|
+
currentParent.length = offset + length - currentParent.offset;
|
|
527
|
+
currentParent = currentParent.parent;
|
|
528
|
+
ensurePropertyComplete(offset + length);
|
|
529
|
+
},
|
|
530
|
+
onArrayBegin: (offset, length) => {
|
|
531
|
+
currentParent = onValue({ type: "array", offset, length: -1, parent: currentParent, children: [] });
|
|
532
|
+
},
|
|
533
|
+
onArrayEnd: (offset, length) => {
|
|
534
|
+
currentParent.length = offset + length - currentParent.offset;
|
|
535
|
+
currentParent = currentParent.parent;
|
|
536
|
+
ensurePropertyComplete(offset + length);
|
|
537
|
+
},
|
|
538
|
+
onLiteralValue: (value, offset, length) => {
|
|
539
|
+
onValue({ type: getNodeType(value), offset, length, parent: currentParent, value });
|
|
540
|
+
ensurePropertyComplete(offset + length);
|
|
541
|
+
},
|
|
542
|
+
onSeparator: (sep, offset, length) => {
|
|
543
|
+
if (currentParent.type === "property") {
|
|
544
|
+
if (sep === ":") {
|
|
545
|
+
currentParent.colonOffset = offset;
|
|
546
|
+
} else if (sep === ",") {
|
|
547
|
+
ensurePropertyComplete(offset);
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
},
|
|
551
|
+
onError: (error, offset, length) => {
|
|
552
|
+
errors.push({ error, offset, length });
|
|
553
|
+
}
|
|
554
|
+
};
|
|
555
|
+
visit(text, visitor, options);
|
|
556
|
+
const result = currentParent.children[0];
|
|
557
|
+
if (result) {
|
|
558
|
+
delete result.parent;
|
|
559
|
+
}
|
|
560
|
+
return result;
|
|
561
|
+
}
|
|
562
|
+
function visit(text, visitor, options = ParseOptions.DEFAULT) {
|
|
563
|
+
const _scanner = createScanner(text, false);
|
|
564
|
+
const _jsonPath = [];
|
|
565
|
+
let suppressedCallbacks = 0;
|
|
566
|
+
function toNoArgVisit(visitFunction) {
|
|
567
|
+
return visitFunction ? () => suppressedCallbacks === 0 && visitFunction(_scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter()) : () => true;
|
|
568
|
+
}
|
|
569
|
+
function toOneArgVisit(visitFunction) {
|
|
570
|
+
return visitFunction ? (arg) => suppressedCallbacks === 0 && visitFunction(arg, _scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter()) : () => true;
|
|
571
|
+
}
|
|
572
|
+
function toOneArgVisitWithPath(visitFunction) {
|
|
573
|
+
return visitFunction ? (arg) => suppressedCallbacks === 0 && visitFunction(arg, _scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter(), () => _jsonPath.slice()) : () => true;
|
|
574
|
+
}
|
|
575
|
+
function toBeginVisit(visitFunction) {
|
|
576
|
+
return visitFunction ? () => {
|
|
577
|
+
if (suppressedCallbacks > 0) {
|
|
578
|
+
suppressedCallbacks++;
|
|
579
|
+
} else {
|
|
580
|
+
let cbReturn = visitFunction(_scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter(), () => _jsonPath.slice());
|
|
581
|
+
if (cbReturn === false) {
|
|
582
|
+
suppressedCallbacks = 1;
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
} : () => true;
|
|
586
|
+
}
|
|
587
|
+
function toEndVisit(visitFunction) {
|
|
588
|
+
return visitFunction ? () => {
|
|
589
|
+
if (suppressedCallbacks > 0) {
|
|
590
|
+
suppressedCallbacks--;
|
|
591
|
+
}
|
|
592
|
+
if (suppressedCallbacks === 0) {
|
|
593
|
+
visitFunction(_scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter());
|
|
594
|
+
}
|
|
595
|
+
} : () => true;
|
|
596
|
+
}
|
|
597
|
+
const onObjectBegin = toBeginVisit(visitor.onObjectBegin), onObjectProperty = toOneArgVisitWithPath(visitor.onObjectProperty), onObjectEnd = toEndVisit(visitor.onObjectEnd), onArrayBegin = toBeginVisit(visitor.onArrayBegin), onArrayEnd = toEndVisit(visitor.onArrayEnd), onLiteralValue = toOneArgVisitWithPath(visitor.onLiteralValue), onSeparator = toOneArgVisit(visitor.onSeparator), onComment = toNoArgVisit(visitor.onComment), onError = toOneArgVisit(visitor.onError);
|
|
598
|
+
const disallowComments = options && options.disallowComments;
|
|
599
|
+
const allowTrailingComma = options && options.allowTrailingComma;
|
|
600
|
+
function scanNext() {
|
|
601
|
+
while (true) {
|
|
602
|
+
const token = _scanner.scan();
|
|
603
|
+
switch (_scanner.getTokenError()) {
|
|
604
|
+
case 4:
|
|
605
|
+
handleError(
|
|
606
|
+
14
|
|
607
|
+
/* ParseErrorCode.InvalidUnicode */
|
|
608
|
+
);
|
|
609
|
+
break;
|
|
610
|
+
case 5:
|
|
611
|
+
handleError(
|
|
612
|
+
15
|
|
613
|
+
/* ParseErrorCode.InvalidEscapeCharacter */
|
|
614
|
+
);
|
|
615
|
+
break;
|
|
616
|
+
case 3:
|
|
617
|
+
handleError(
|
|
618
|
+
13
|
|
619
|
+
/* ParseErrorCode.UnexpectedEndOfNumber */
|
|
620
|
+
);
|
|
621
|
+
break;
|
|
622
|
+
case 1:
|
|
623
|
+
if (!disallowComments) {
|
|
624
|
+
handleError(
|
|
625
|
+
11
|
|
626
|
+
/* ParseErrorCode.UnexpectedEndOfComment */
|
|
627
|
+
);
|
|
628
|
+
}
|
|
629
|
+
break;
|
|
630
|
+
case 2:
|
|
631
|
+
handleError(
|
|
632
|
+
12
|
|
633
|
+
/* ParseErrorCode.UnexpectedEndOfString */
|
|
634
|
+
);
|
|
635
|
+
break;
|
|
636
|
+
case 6:
|
|
637
|
+
handleError(
|
|
638
|
+
16
|
|
639
|
+
/* ParseErrorCode.InvalidCharacter */
|
|
640
|
+
);
|
|
641
|
+
break;
|
|
642
|
+
}
|
|
643
|
+
switch (token) {
|
|
644
|
+
case 12:
|
|
645
|
+
case 13:
|
|
646
|
+
if (disallowComments) {
|
|
647
|
+
handleError(
|
|
648
|
+
10
|
|
649
|
+
/* ParseErrorCode.InvalidCommentToken */
|
|
650
|
+
);
|
|
651
|
+
} else {
|
|
652
|
+
onComment();
|
|
653
|
+
}
|
|
654
|
+
break;
|
|
655
|
+
case 16:
|
|
656
|
+
handleError(
|
|
657
|
+
1
|
|
658
|
+
/* ParseErrorCode.InvalidSymbol */
|
|
659
|
+
);
|
|
660
|
+
break;
|
|
661
|
+
case 15:
|
|
662
|
+
case 14:
|
|
663
|
+
break;
|
|
664
|
+
default:
|
|
665
|
+
return token;
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
function handleError(error, skipUntilAfter = [], skipUntil = []) {
|
|
670
|
+
onError(error);
|
|
671
|
+
if (skipUntilAfter.length + skipUntil.length > 0) {
|
|
672
|
+
let token = _scanner.getToken();
|
|
673
|
+
while (token !== 17) {
|
|
674
|
+
if (skipUntilAfter.indexOf(token) !== -1) {
|
|
675
|
+
scanNext();
|
|
676
|
+
break;
|
|
677
|
+
} else if (skipUntil.indexOf(token) !== -1) {
|
|
678
|
+
break;
|
|
679
|
+
}
|
|
680
|
+
token = scanNext();
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
function parseString(isValue) {
|
|
685
|
+
const value = _scanner.getTokenValue();
|
|
686
|
+
if (isValue) {
|
|
687
|
+
onLiteralValue(value);
|
|
688
|
+
} else {
|
|
689
|
+
onObjectProperty(value);
|
|
690
|
+
_jsonPath.push(value);
|
|
691
|
+
}
|
|
692
|
+
scanNext();
|
|
693
|
+
return true;
|
|
694
|
+
}
|
|
695
|
+
function parseLiteral() {
|
|
696
|
+
switch (_scanner.getToken()) {
|
|
697
|
+
case 11:
|
|
698
|
+
const tokenValue = _scanner.getTokenValue();
|
|
699
|
+
let value = Number(tokenValue);
|
|
700
|
+
if (isNaN(value)) {
|
|
701
|
+
handleError(
|
|
702
|
+
2
|
|
703
|
+
/* ParseErrorCode.InvalidNumberFormat */
|
|
704
|
+
);
|
|
705
|
+
value = 0;
|
|
706
|
+
}
|
|
707
|
+
onLiteralValue(value);
|
|
708
|
+
break;
|
|
709
|
+
case 7:
|
|
710
|
+
onLiteralValue(null);
|
|
711
|
+
break;
|
|
712
|
+
case 8:
|
|
713
|
+
onLiteralValue(true);
|
|
714
|
+
break;
|
|
715
|
+
case 9:
|
|
716
|
+
onLiteralValue(false);
|
|
717
|
+
break;
|
|
718
|
+
default:
|
|
719
|
+
return false;
|
|
720
|
+
}
|
|
721
|
+
scanNext();
|
|
722
|
+
return true;
|
|
723
|
+
}
|
|
724
|
+
function parseProperty() {
|
|
725
|
+
if (_scanner.getToken() !== 10) {
|
|
726
|
+
handleError(3, [], [
|
|
727
|
+
2,
|
|
728
|
+
5
|
|
729
|
+
/* SyntaxKind.CommaToken */
|
|
730
|
+
]);
|
|
731
|
+
return false;
|
|
732
|
+
}
|
|
733
|
+
parseString(false);
|
|
734
|
+
if (_scanner.getToken() === 6) {
|
|
735
|
+
onSeparator(":");
|
|
736
|
+
scanNext();
|
|
737
|
+
if (!parseValue()) {
|
|
738
|
+
handleError(4, [], [
|
|
739
|
+
2,
|
|
740
|
+
5
|
|
741
|
+
/* SyntaxKind.CommaToken */
|
|
742
|
+
]);
|
|
743
|
+
}
|
|
744
|
+
} else {
|
|
745
|
+
handleError(5, [], [
|
|
746
|
+
2,
|
|
747
|
+
5
|
|
748
|
+
/* SyntaxKind.CommaToken */
|
|
749
|
+
]);
|
|
750
|
+
}
|
|
751
|
+
_jsonPath.pop();
|
|
752
|
+
return true;
|
|
753
|
+
}
|
|
754
|
+
function parseObject() {
|
|
755
|
+
onObjectBegin();
|
|
756
|
+
scanNext();
|
|
757
|
+
let needsComma = false;
|
|
758
|
+
while (_scanner.getToken() !== 2 && _scanner.getToken() !== 17) {
|
|
759
|
+
if (_scanner.getToken() === 5) {
|
|
760
|
+
if (!needsComma) {
|
|
761
|
+
handleError(4, [], []);
|
|
762
|
+
}
|
|
763
|
+
onSeparator(",");
|
|
764
|
+
scanNext();
|
|
765
|
+
if (_scanner.getToken() === 2 && allowTrailingComma) {
|
|
766
|
+
break;
|
|
767
|
+
}
|
|
768
|
+
} else if (needsComma) {
|
|
769
|
+
handleError(6, [], []);
|
|
770
|
+
}
|
|
771
|
+
if (!parseProperty()) {
|
|
772
|
+
handleError(4, [], [
|
|
773
|
+
2,
|
|
774
|
+
5
|
|
775
|
+
/* SyntaxKind.CommaToken */
|
|
776
|
+
]);
|
|
777
|
+
}
|
|
778
|
+
needsComma = true;
|
|
779
|
+
}
|
|
780
|
+
onObjectEnd();
|
|
781
|
+
if (_scanner.getToken() !== 2) {
|
|
782
|
+
handleError(7, [
|
|
783
|
+
2
|
|
784
|
+
/* SyntaxKind.CloseBraceToken */
|
|
785
|
+
], []);
|
|
786
|
+
} else {
|
|
787
|
+
scanNext();
|
|
788
|
+
}
|
|
789
|
+
return true;
|
|
790
|
+
}
|
|
791
|
+
function parseArray() {
|
|
792
|
+
onArrayBegin();
|
|
793
|
+
scanNext();
|
|
794
|
+
let isFirstElement = true;
|
|
795
|
+
let needsComma = false;
|
|
796
|
+
while (_scanner.getToken() !== 4 && _scanner.getToken() !== 17) {
|
|
797
|
+
if (_scanner.getToken() === 5) {
|
|
798
|
+
if (!needsComma) {
|
|
799
|
+
handleError(4, [], []);
|
|
800
|
+
}
|
|
801
|
+
onSeparator(",");
|
|
802
|
+
scanNext();
|
|
803
|
+
if (_scanner.getToken() === 4 && allowTrailingComma) {
|
|
804
|
+
break;
|
|
805
|
+
}
|
|
806
|
+
} else if (needsComma) {
|
|
807
|
+
handleError(6, [], []);
|
|
808
|
+
}
|
|
809
|
+
if (isFirstElement) {
|
|
810
|
+
_jsonPath.push(0);
|
|
811
|
+
isFirstElement = false;
|
|
812
|
+
} else {
|
|
813
|
+
_jsonPath[_jsonPath.length - 1]++;
|
|
814
|
+
}
|
|
815
|
+
if (!parseValue()) {
|
|
816
|
+
handleError(4, [], [
|
|
817
|
+
4,
|
|
818
|
+
5
|
|
819
|
+
/* SyntaxKind.CommaToken */
|
|
820
|
+
]);
|
|
821
|
+
}
|
|
822
|
+
needsComma = true;
|
|
823
|
+
}
|
|
824
|
+
onArrayEnd();
|
|
825
|
+
if (!isFirstElement) {
|
|
826
|
+
_jsonPath.pop();
|
|
827
|
+
}
|
|
828
|
+
if (_scanner.getToken() !== 4) {
|
|
829
|
+
handleError(8, [
|
|
830
|
+
4
|
|
831
|
+
/* SyntaxKind.CloseBracketToken */
|
|
832
|
+
], []);
|
|
833
|
+
} else {
|
|
834
|
+
scanNext();
|
|
835
|
+
}
|
|
836
|
+
return true;
|
|
837
|
+
}
|
|
838
|
+
function parseValue() {
|
|
839
|
+
switch (_scanner.getToken()) {
|
|
840
|
+
case 3:
|
|
841
|
+
return parseArray();
|
|
842
|
+
case 1:
|
|
843
|
+
return parseObject();
|
|
844
|
+
case 10:
|
|
845
|
+
return parseString(true);
|
|
846
|
+
default:
|
|
847
|
+
return parseLiteral();
|
|
848
|
+
}
|
|
849
|
+
}
|
|
850
|
+
scanNext();
|
|
851
|
+
if (_scanner.getToken() === 17) {
|
|
852
|
+
if (options.allowEmptyContent) {
|
|
853
|
+
return true;
|
|
854
|
+
}
|
|
855
|
+
handleError(4, [], []);
|
|
856
|
+
return false;
|
|
857
|
+
}
|
|
858
|
+
if (!parseValue()) {
|
|
859
|
+
handleError(4, [], []);
|
|
860
|
+
return false;
|
|
861
|
+
}
|
|
862
|
+
if (_scanner.getToken() !== 17) {
|
|
863
|
+
handleError(9, [], []);
|
|
864
|
+
}
|
|
865
|
+
return true;
|
|
866
|
+
}
|
|
867
|
+
function getNodeType(value) {
|
|
868
|
+
switch (typeof value) {
|
|
869
|
+
case "boolean":
|
|
870
|
+
return "boolean";
|
|
871
|
+
case "number":
|
|
872
|
+
return "number";
|
|
873
|
+
case "string":
|
|
874
|
+
return "string";
|
|
875
|
+
case "object": {
|
|
876
|
+
if (!value) {
|
|
877
|
+
return "null";
|
|
878
|
+
} else if (Array.isArray(value)) {
|
|
879
|
+
return "array";
|
|
880
|
+
}
|
|
881
|
+
return "object";
|
|
882
|
+
}
|
|
883
|
+
default:
|
|
884
|
+
return "null";
|
|
885
|
+
}
|
|
886
|
+
}
|
|
887
|
+
|
|
888
|
+
// node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/main.js
|
|
889
|
+
var ScanError;
|
|
890
|
+
(function(ScanError2) {
|
|
891
|
+
ScanError2[ScanError2["None"] = 0] = "None";
|
|
892
|
+
ScanError2[ScanError2["UnexpectedEndOfComment"] = 1] = "UnexpectedEndOfComment";
|
|
893
|
+
ScanError2[ScanError2["UnexpectedEndOfString"] = 2] = "UnexpectedEndOfString";
|
|
894
|
+
ScanError2[ScanError2["UnexpectedEndOfNumber"] = 3] = "UnexpectedEndOfNumber";
|
|
895
|
+
ScanError2[ScanError2["InvalidUnicode"] = 4] = "InvalidUnicode";
|
|
896
|
+
ScanError2[ScanError2["InvalidEscapeCharacter"] = 5] = "InvalidEscapeCharacter";
|
|
897
|
+
ScanError2[ScanError2["InvalidCharacter"] = 6] = "InvalidCharacter";
|
|
898
|
+
})(ScanError || (ScanError = {}));
|
|
899
|
+
var SyntaxKind;
|
|
900
|
+
(function(SyntaxKind2) {
|
|
901
|
+
SyntaxKind2[SyntaxKind2["OpenBraceToken"] = 1] = "OpenBraceToken";
|
|
902
|
+
SyntaxKind2[SyntaxKind2["CloseBraceToken"] = 2] = "CloseBraceToken";
|
|
903
|
+
SyntaxKind2[SyntaxKind2["OpenBracketToken"] = 3] = "OpenBracketToken";
|
|
904
|
+
SyntaxKind2[SyntaxKind2["CloseBracketToken"] = 4] = "CloseBracketToken";
|
|
905
|
+
SyntaxKind2[SyntaxKind2["CommaToken"] = 5] = "CommaToken";
|
|
906
|
+
SyntaxKind2[SyntaxKind2["ColonToken"] = 6] = "ColonToken";
|
|
907
|
+
SyntaxKind2[SyntaxKind2["NullKeyword"] = 7] = "NullKeyword";
|
|
908
|
+
SyntaxKind2[SyntaxKind2["TrueKeyword"] = 8] = "TrueKeyword";
|
|
909
|
+
SyntaxKind2[SyntaxKind2["FalseKeyword"] = 9] = "FalseKeyword";
|
|
910
|
+
SyntaxKind2[SyntaxKind2["StringLiteral"] = 10] = "StringLiteral";
|
|
911
|
+
SyntaxKind2[SyntaxKind2["NumericLiteral"] = 11] = "NumericLiteral";
|
|
912
|
+
SyntaxKind2[SyntaxKind2["LineCommentTrivia"] = 12] = "LineCommentTrivia";
|
|
913
|
+
SyntaxKind2[SyntaxKind2["BlockCommentTrivia"] = 13] = "BlockCommentTrivia";
|
|
914
|
+
SyntaxKind2[SyntaxKind2["LineBreakTrivia"] = 14] = "LineBreakTrivia";
|
|
915
|
+
SyntaxKind2[SyntaxKind2["Trivia"] = 15] = "Trivia";
|
|
916
|
+
SyntaxKind2[SyntaxKind2["Unknown"] = 16] = "Unknown";
|
|
917
|
+
SyntaxKind2[SyntaxKind2["EOF"] = 17] = "EOF";
|
|
918
|
+
})(SyntaxKind || (SyntaxKind = {}));
|
|
919
|
+
var parse2 = parse;
|
|
920
|
+
var parseTree2 = parseTree;
|
|
921
|
+
var ParseErrorCode;
|
|
922
|
+
(function(ParseErrorCode2) {
|
|
923
|
+
ParseErrorCode2[ParseErrorCode2["InvalidSymbol"] = 1] = "InvalidSymbol";
|
|
924
|
+
ParseErrorCode2[ParseErrorCode2["InvalidNumberFormat"] = 2] = "InvalidNumberFormat";
|
|
925
|
+
ParseErrorCode2[ParseErrorCode2["PropertyNameExpected"] = 3] = "PropertyNameExpected";
|
|
926
|
+
ParseErrorCode2[ParseErrorCode2["ValueExpected"] = 4] = "ValueExpected";
|
|
927
|
+
ParseErrorCode2[ParseErrorCode2["ColonExpected"] = 5] = "ColonExpected";
|
|
928
|
+
ParseErrorCode2[ParseErrorCode2["CommaExpected"] = 6] = "CommaExpected";
|
|
929
|
+
ParseErrorCode2[ParseErrorCode2["CloseBraceExpected"] = 7] = "CloseBraceExpected";
|
|
930
|
+
ParseErrorCode2[ParseErrorCode2["CloseBracketExpected"] = 8] = "CloseBracketExpected";
|
|
931
|
+
ParseErrorCode2[ParseErrorCode2["EndOfFileExpected"] = 9] = "EndOfFileExpected";
|
|
932
|
+
ParseErrorCode2[ParseErrorCode2["InvalidCommentToken"] = 10] = "InvalidCommentToken";
|
|
933
|
+
ParseErrorCode2[ParseErrorCode2["UnexpectedEndOfComment"] = 11] = "UnexpectedEndOfComment";
|
|
934
|
+
ParseErrorCode2[ParseErrorCode2["UnexpectedEndOfString"] = 12] = "UnexpectedEndOfString";
|
|
935
|
+
ParseErrorCode2[ParseErrorCode2["UnexpectedEndOfNumber"] = 13] = "UnexpectedEndOfNumber";
|
|
936
|
+
ParseErrorCode2[ParseErrorCode2["InvalidUnicode"] = 14] = "InvalidUnicode";
|
|
937
|
+
ParseErrorCode2[ParseErrorCode2["InvalidEscapeCharacter"] = 15] = "InvalidEscapeCharacter";
|
|
938
|
+
ParseErrorCode2[ParseErrorCode2["InvalidCharacter"] = 16] = "InvalidCharacter";
|
|
939
|
+
})(ParseErrorCode || (ParseErrorCode = {}));
|
|
940
|
+
function printParseErrorCode(code) {
|
|
941
|
+
switch (code) {
|
|
942
|
+
case 1:
|
|
943
|
+
return "InvalidSymbol";
|
|
944
|
+
case 2:
|
|
945
|
+
return "InvalidNumberFormat";
|
|
946
|
+
case 3:
|
|
947
|
+
return "PropertyNameExpected";
|
|
948
|
+
case 4:
|
|
949
|
+
return "ValueExpected";
|
|
950
|
+
case 5:
|
|
951
|
+
return "ColonExpected";
|
|
952
|
+
case 6:
|
|
953
|
+
return "CommaExpected";
|
|
954
|
+
case 7:
|
|
955
|
+
return "CloseBraceExpected";
|
|
956
|
+
case 8:
|
|
957
|
+
return "CloseBracketExpected";
|
|
958
|
+
case 9:
|
|
959
|
+
return "EndOfFileExpected";
|
|
960
|
+
case 10:
|
|
961
|
+
return "InvalidCommentToken";
|
|
962
|
+
case 11:
|
|
963
|
+
return "UnexpectedEndOfComment";
|
|
964
|
+
case 12:
|
|
965
|
+
return "UnexpectedEndOfString";
|
|
966
|
+
case 13:
|
|
967
|
+
return "UnexpectedEndOfNumber";
|
|
968
|
+
case 14:
|
|
969
|
+
return "InvalidUnicode";
|
|
970
|
+
case 15:
|
|
971
|
+
return "InvalidEscapeCharacter";
|
|
972
|
+
case 16:
|
|
973
|
+
return "InvalidCharacter";
|
|
974
|
+
}
|
|
975
|
+
return "<unknown ParseErrorCode>";
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
export {
|
|
979
|
+
parse2 as parse,
|
|
980
|
+
parseTree2 as parseTree,
|
|
981
|
+
printParseErrorCode
|
|
982
|
+
};
|