@aster-cloud/aster-lang-ts 0.0.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/README.md +144 -0
- package/dist/peg/headers-parser.js +1887 -0
- package/dist/scripts/aster.d.ts +3 -0
- package/dist/scripts/aster.d.ts.map +1 -0
- package/dist/scripts/aster.js +304 -0
- package/dist/scripts/aster.js.map +1 -0
- package/dist/scripts/build-example-packages.d.ts +3 -0
- package/dist/scripts/build-example-packages.d.ts.map +1 -0
- package/dist/scripts/build-example-packages.js +78 -0
- package/dist/scripts/build-example-packages.js.map +1 -0
- package/dist/scripts/build-peg.d.ts +3 -0
- package/dist/scripts/build-peg.d.ts.map +1 -0
- package/dist/scripts/build-peg.js +13 -0
- package/dist/scripts/build-peg.js.map +1 -0
- package/dist/scripts/cleanup-examples.d.ts +3 -0
- package/dist/scripts/cleanup-examples.d.ts.map +1 -0
- package/dist/scripts/cleanup-examples.js +40 -0
- package/dist/scripts/cleanup-examples.js.map +1 -0
- package/dist/scripts/clear-method-cache.d.ts +3 -0
- package/dist/scripts/clear-method-cache.d.ts.map +1 -0
- package/dist/scripts/clear-method-cache.js +20 -0
- package/dist/scripts/clear-method-cache.js.map +1 -0
- package/dist/scripts/cli.d.ts +3 -0
- package/dist/scripts/cli.d.ts.map +1 -0
- package/dist/scripts/cli.js +51 -0
- package/dist/scripts/cli.js.map +1 -0
- package/dist/scripts/determinism.d.ts +3 -0
- package/dist/scripts/determinism.d.ts.map +1 -0
- package/dist/scripts/determinism.js +124 -0
- package/dist/scripts/determinism.js.map +1 -0
- package/dist/scripts/emit-classfiles-core.d.ts +3 -0
- package/dist/scripts/emit-classfiles-core.d.ts.map +1 -0
- package/dist/scripts/emit-classfiles-core.js +86 -0
- package/dist/scripts/emit-classfiles-core.js.map +1 -0
- package/dist/scripts/emit-classfiles.d.ts +3 -0
- package/dist/scripts/emit-classfiles.d.ts.map +1 -0
- package/dist/scripts/emit-classfiles.js +401 -0
- package/dist/scripts/emit-classfiles.js.map +1 -0
- package/dist/scripts/emit-core.d.ts +3 -0
- package/dist/scripts/emit-core.d.ts.map +1 -0
- package/dist/scripts/emit-core.js +52 -0
- package/dist/scripts/emit-core.js.map +1 -0
- package/dist/scripts/emit-hints.d.ts +3 -0
- package/dist/scripts/emit-hints.d.ts.map +1 -0
- package/dist/scripts/emit-hints.js +75 -0
- package/dist/scripts/emit-hints.js.map +1 -0
- package/dist/scripts/format-examples.d.ts +3 -0
- package/dist/scripts/format-examples.d.ts.map +1 -0
- package/dist/scripts/format-examples.js +55 -0
- package/dist/scripts/format-examples.js.map +1 -0
- package/dist/scripts/generate_error_code_docs.d.ts +8 -0
- package/dist/scripts/generate_error_code_docs.d.ts.map +1 -0
- package/dist/scripts/generate_error_code_docs.js +128 -0
- package/dist/scripts/generate_error_code_docs.js.map +1 -0
- package/dist/scripts/generate_error_codes.d.ts +3 -0
- package/dist/scripts/generate_error_codes.d.ts.map +1 -0
- package/dist/scripts/generate_error_codes.js +224 -0
- package/dist/scripts/generate_error_codes.js.map +1 -0
- package/dist/scripts/golden.d.ts +3 -0
- package/dist/scripts/golden.d.ts.map +1 -0
- package/dist/scripts/golden.js +405 -0
- package/dist/scripts/golden.js.map +1 -0
- package/dist/scripts/health-check.d.ts +3 -0
- package/dist/scripts/health-check.d.ts.map +1 -0
- package/dist/scripts/health-check.js +42 -0
- package/dist/scripts/health-check.js.map +1 -0
- package/dist/scripts/inspect-method-cache.d.ts +3 -0
- package/dist/scripts/inspect-method-cache.d.ts.map +1 -0
- package/dist/scripts/inspect-method-cache.js +24 -0
- package/dist/scripts/inspect-method-cache.js.map +1 -0
- package/dist/scripts/lsp-build-index.d.ts +3 -0
- package/dist/scripts/lsp-build-index.d.ts.map +1 -0
- package/dist/scripts/lsp-build-index.js +60 -0
- package/dist/scripts/lsp-build-index.js.map +1 -0
- package/dist/scripts/lsp-capmanifest-codeaction-smoke.d.ts +3 -0
- package/dist/scripts/lsp-capmanifest-codeaction-smoke.d.ts.map +1 -0
- package/dist/scripts/lsp-capmanifest-codeaction-smoke.js +161 -0
- package/dist/scripts/lsp-capmanifest-codeaction-smoke.js.map +1 -0
- package/dist/scripts/lsp-client-helper.d.ts +30 -0
- package/dist/scripts/lsp-client-helper.d.ts.map +1 -0
- package/dist/scripts/lsp-client-helper.js +192 -0
- package/dist/scripts/lsp-client-helper.js.map +1 -0
- package/dist/scripts/lsp-client-helper.test.d.ts +7 -0
- package/dist/scripts/lsp-client-helper.test.d.ts.map +1 -0
- package/dist/scripts/lsp-client-helper.test.js +45 -0
- package/dist/scripts/lsp-client-helper.test.js.map +1 -0
- package/dist/scripts/lsp-codeaction-smoke.d.ts +3 -0
- package/dist/scripts/lsp-codeaction-smoke.d.ts.map +1 -0
- package/dist/scripts/lsp-codeaction-smoke.js +98 -0
- package/dist/scripts/lsp-codeaction-smoke.js.map +1 -0
- package/dist/scripts/lsp-harness.d.ts +3 -0
- package/dist/scripts/lsp-harness.d.ts.map +1 -0
- package/dist/scripts/lsp-harness.js +33 -0
- package/dist/scripts/lsp-harness.js.map +1 -0
- package/dist/scripts/lsp-health-smoke.d.ts +3 -0
- package/dist/scripts/lsp-health-smoke.d.ts.map +1 -0
- package/dist/scripts/lsp-health-smoke.js +98 -0
- package/dist/scripts/lsp-health-smoke.js.map +1 -0
- package/dist/scripts/lsp-health.d.ts +3 -0
- package/dist/scripts/lsp-health.d.ts.map +1 -0
- package/dist/scripts/lsp-health.js +22 -0
- package/dist/scripts/lsp-health.js.map +1 -0
- package/dist/scripts/lsp-highlight-smoke.d.ts +3 -0
- package/dist/scripts/lsp-highlight-smoke.d.ts.map +1 -0
- package/dist/scripts/lsp-highlight-smoke.js +124 -0
- package/dist/scripts/lsp-highlight-smoke.js.map +1 -0
- package/dist/scripts/lsp-missing-header-codeaction-smoke.d.ts +3 -0
- package/dist/scripts/lsp-missing-header-codeaction-smoke.d.ts.map +1 -0
- package/dist/scripts/lsp-missing-header-codeaction-smoke.js +78 -0
- package/dist/scripts/lsp-missing-header-codeaction-smoke.js.map +1 -0
- package/dist/scripts/lsp-multi-rename.test.d.ts +3 -0
- package/dist/scripts/lsp-multi-rename.test.d.ts.map +1 -0
- package/dist/scripts/lsp-multi-rename.test.js +81 -0
- package/dist/scripts/lsp-multi-rename.test.js.map +1 -0
- package/dist/scripts/lsp-punct-codeaction-smoke.d.ts +3 -0
- package/dist/scripts/lsp-punct-codeaction-smoke.d.ts.map +1 -0
- package/dist/scripts/lsp-punct-codeaction-smoke.js +71 -0
- package/dist/scripts/lsp-punct-codeaction-smoke.js.map +1 -0
- package/dist/scripts/lsp-signaturehelp-smoke.d.ts +3 -0
- package/dist/scripts/lsp-signaturehelp-smoke.d.ts.map +1 -0
- package/dist/scripts/lsp-signaturehelp-smoke.js +129 -0
- package/dist/scripts/lsp-signaturehelp-smoke.js.map +1 -0
- package/dist/scripts/lsp-smoke.d.ts +3 -0
- package/dist/scripts/lsp-smoke.d.ts.map +1 -0
- package/dist/scripts/lsp-smoke.js +54 -0
- package/dist/scripts/lsp-smoke.js.map +1 -0
- package/dist/scripts/lsp-streaming-progress-smoke.d.ts +3 -0
- package/dist/scripts/lsp-streaming-progress-smoke.d.ts.map +1 -0
- package/dist/scripts/lsp-streaming-progress-smoke.js +116 -0
- package/dist/scripts/lsp-streaming-progress-smoke.js.map +1 -0
- package/dist/scripts/lsp-workspace-diagnostics-smoke.d.ts +3 -0
- package/dist/scripts/lsp-workspace-diagnostics-smoke.d.ts.map +1 -0
- package/dist/scripts/lsp-workspace-diagnostics-smoke.js +81 -0
- package/dist/scripts/lsp-workspace-diagnostics-smoke.js.map +1 -0
- package/dist/scripts/perf-assert-report.d.ts +8 -0
- package/dist/scripts/perf-assert-report.d.ts.map +1 -0
- package/dist/scripts/perf-assert-report.js +44 -0
- package/dist/scripts/perf-assert-report.js.map +1 -0
- package/dist/scripts/perf-assert.d.ts +3 -0
- package/dist/scripts/perf-assert.d.ts.map +1 -0
- package/dist/scripts/perf-assert.js +29 -0
- package/dist/scripts/perf-assert.js.map +1 -0
- package/dist/scripts/perf-benchmark.d.ts +9 -0
- package/dist/scripts/perf-benchmark.d.ts.map +1 -0
- package/dist/scripts/perf-benchmark.js +272 -0
- package/dist/scripts/perf-benchmark.js.map +1 -0
- package/dist/scripts/perf-diagnostics.d.ts +7 -0
- package/dist/scripts/perf-diagnostics.d.ts.map +1 -0
- package/dist/scripts/perf-diagnostics.js +87 -0
- package/dist/scripts/perf-diagnostics.js.map +1 -0
- package/dist/scripts/perf-lsp-e2e-v2.d.ts +15 -0
- package/dist/scripts/perf-lsp-e2e-v2.d.ts.map +1 -0
- package/dist/scripts/perf-lsp-e2e-v2.js +323 -0
- package/dist/scripts/perf-lsp-e2e-v2.js.map +1 -0
- package/dist/scripts/perf-lsp-e2e.d.ts +3 -0
- package/dist/scripts/perf-lsp-e2e.d.ts.map +1 -0
- package/dist/scripts/perf-lsp-e2e.js +331 -0
- package/dist/scripts/perf-lsp-e2e.js.map +1 -0
- package/dist/scripts/perf-lsp-internal.d.ts +11 -0
- package/dist/scripts/perf-lsp-internal.d.ts.map +1 -0
- package/dist/scripts/perf-lsp-internal.js +163 -0
- package/dist/scripts/perf-lsp-internal.js.map +1 -0
- package/dist/scripts/perf-lsp-ipc.d.ts +11 -0
- package/dist/scripts/perf-lsp-ipc.d.ts.map +1 -0
- package/dist/scripts/perf-lsp-ipc.js +127 -0
- package/dist/scripts/perf-lsp-ipc.js.map +1 -0
- package/dist/scripts/perf-lsp.d.ts +3 -0
- package/dist/scripts/perf-lsp.d.ts.map +1 -0
- package/dist/scripts/perf-lsp.js +87 -0
- package/dist/scripts/perf-lsp.js.map +1 -0
- package/dist/scripts/perf-utils.d.ts +29 -0
- package/dist/scripts/perf-utils.d.ts.map +1 -0
- package/dist/scripts/perf-utils.js +40 -0
- package/dist/scripts/perf-utils.js.map +1 -0
- package/dist/scripts/profile-medium-project.d.ts +7 -0
- package/dist/scripts/profile-medium-project.d.ts.map +1 -0
- package/dist/scripts/profile-medium-project.js +152 -0
- package/dist/scripts/profile-medium-project.js.map +1 -0
- package/dist/scripts/repl.d.ts +3 -0
- package/dist/scripts/repl.d.ts.map +1 -0
- package/dist/scripts/repl.js +88 -0
- package/dist/scripts/repl.js.map +1 -0
- package/dist/scripts/scaffold.d.ts +3 -0
- package/dist/scripts/scaffold.d.ts.map +1 -0
- package/dist/scripts/scaffold.js +73 -0
- package/dist/scripts/scaffold.js.map +1 -0
- package/dist/scripts/seed-method-cache.d.ts +3 -0
- package/dist/scripts/seed-method-cache.d.ts.map +1 -0
- package/dist/scripts/seed-method-cache.js +37 -0
- package/dist/scripts/seed-method-cache.js.map +1 -0
- package/dist/scripts/test-comments-golden.d.ts +3 -0
- package/dist/scripts/test-comments-golden.d.ts.map +1 -0
- package/dist/scripts/test-comments-golden.js +36 -0
- package/dist/scripts/test-comments-golden.js.map +1 -0
- package/dist/scripts/test-lossless-golden.d.ts +3 -0
- package/dist/scripts/test-lossless-golden.d.ts.map +1 -0
- package/dist/scripts/test-lossless-golden.js +42 -0
- package/dist/scripts/test-lossless-golden.js.map +1 -0
- package/dist/scripts/test-lossless.d.ts +3 -0
- package/dist/scripts/test-lossless.d.ts.map +1 -0
- package/dist/scripts/test-lossless.js +26 -0
- package/dist/scripts/test-lossless.js.map +1 -0
- package/dist/scripts/test-lsp-index.d.ts +3 -0
- package/dist/scripts/test-lsp-index.d.ts.map +1 -0
- package/dist/scripts/test-lsp-index.js +37 -0
- package/dist/scripts/test-lsp-index.js.map +1 -0
- package/dist/scripts/test-medium-diagnostics.d.ts +7 -0
- package/dist/scripts/test-medium-diagnostics.d.ts.map +1 -0
- package/dist/scripts/test-medium-diagnostics.js +129 -0
- package/dist/scripts/test-medium-diagnostics.js.map +1 -0
- package/dist/scripts/typecheck-cli.d.ts +3 -0
- package/dist/scripts/typecheck-cli.d.ts.map +1 -0
- package/dist/scripts/typecheck-cli.js +104 -0
- package/dist/scripts/typecheck-cli.js.map +1 -0
- package/dist/scripts/update-eff-violation-expected.d.ts +3 -0
- package/dist/scripts/update-eff-violation-expected.d.ts.map +1 -0
- package/dist/scripts/update-eff-violation-expected.js +57 -0
- package/dist/scripts/update-eff-violation-expected.js.map +1 -0
- package/dist/scripts/update-golden-ast.d.ts +3 -0
- package/dist/scripts/update-golden-ast.d.ts.map +1 -0
- package/dist/scripts/update-golden-ast.js +61 -0
- package/dist/scripts/update-golden-ast.js.map +1 -0
- package/dist/scripts/validate_error_codes.d.ts +12 -0
- package/dist/scripts/validate_error_codes.d.ts.map +1 -0
- package/dist/scripts/validate_error_codes.js +114 -0
- package/dist/scripts/validate_error_codes.js.map +1 -0
- package/dist/scripts/verify-capabilities.d.ts +3 -0
- package/dist/scripts/verify-capabilities.d.ts.map +1 -0
- package/dist/scripts/verify-capabilities.js +23 -0
- package/dist/scripts/verify-capabilities.js.map +1 -0
- package/dist/scripts/verify-classes.d.ts +3 -0
- package/dist/scripts/verify-classes.d.ts.map +1 -0
- package/dist/scripts/verify-classes.js +32 -0
- package/dist/scripts/verify-classes.js.map +1 -0
- package/dist/scripts/verify-examples.d.ts +3 -0
- package/dist/scripts/verify-examples.d.ts.map +1 -0
- package/dist/scripts/verify-examples.js +79 -0
- package/dist/scripts/verify-examples.js.map +1 -0
- package/dist/scripts/verify-fuzz.d.ts +3 -0
- package/dist/scripts/verify-fuzz.d.ts.map +1 -0
- package/dist/scripts/verify-fuzz.js +88 -0
- package/dist/scripts/verify-fuzz.js.map +1 -0
- package/dist/scripts/verify-jar-checksum.d.ts +3 -0
- package/dist/scripts/verify-jar-checksum.d.ts.map +1 -0
- package/dist/scripts/verify-jar-checksum.js +63 -0
- package/dist/scripts/verify-jar-checksum.js.map +1 -0
- package/dist/scripts/verify-nullstrict.d.ts +3 -0
- package/dist/scripts/verify-nullstrict.d.ts.map +1 -0
- package/dist/scripts/verify-nullstrict.js +20 -0
- package/dist/scripts/verify-nullstrict.js.map +1 -0
- package/dist/src/ai/generation-cache.d.ts +36 -0
- package/dist/src/ai/generation-cache.d.ts.map +1 -0
- package/dist/src/ai/generation-cache.js +91 -0
- package/dist/src/ai/generation-cache.js.map +1 -0
- package/dist/src/ai/generator.d.ts +105 -0
- package/dist/src/ai/generator.d.ts.map +1 -0
- package/dist/src/ai/generator.js +103 -0
- package/dist/src/ai/generator.js.map +1 -0
- package/dist/src/ai/llm-provider.d.ts +31 -0
- package/dist/src/ai/llm-provider.d.ts.map +1 -0
- package/dist/src/ai/llm-provider.js +17 -0
- package/dist/src/ai/llm-provider.js.map +1 -0
- package/dist/src/ai/prompt-manager.d.ts +48 -0
- package/dist/src/ai/prompt-manager.d.ts.map +1 -0
- package/dist/src/ai/prompt-manager.js +70 -0
- package/dist/src/ai/prompt-manager.js.map +1 -0
- package/dist/src/ai/provenance.d.ts +70 -0
- package/dist/src/ai/provenance.d.ts.map +1 -0
- package/dist/src/ai/provenance.js +95 -0
- package/dist/src/ai/provenance.js.map +1 -0
- package/dist/src/ai/providers/anthropic.d.ts +14 -0
- package/dist/src/ai/providers/anthropic.d.ts.map +1 -0
- package/dist/src/ai/providers/anthropic.js +56 -0
- package/dist/src/ai/providers/anthropic.js.map +1 -0
- package/dist/src/ai/providers/openai.d.ts +15 -0
- package/dist/src/ai/providers/openai.d.ts.map +1 -0
- package/dist/src/ai/providers/openai.js +58 -0
- package/dist/src/ai/providers/openai.js.map +1 -0
- package/dist/src/ai/validator.d.ts +68 -0
- package/dist/src/ai/validator.d.ts.map +1 -0
- package/dist/src/ai/validator.js +108 -0
- package/dist/src/ai/validator.js.map +1 -0
- package/dist/src/ast/ast.d.ts +49 -0
- package/dist/src/ast/ast.d.ts.map +1 -0
- package/dist/src/ast/ast.js +191 -0
- package/dist/src/ast/ast.js.map +1 -0
- package/dist/src/ast/ast_visitor.d.ts +66 -0
- package/dist/src/ast/ast_visitor.d.ts.map +1 -0
- package/dist/src/ast/ast_visitor.js +176 -0
- package/dist/src/ast/ast_visitor.js.map +1 -0
- package/dist/src/ast/index.d.ts +13 -0
- package/dist/src/ast/index.d.ts.map +1 -0
- package/dist/src/ast/index.js +12 -0
- package/dist/src/ast/index.js.map +1 -0
- package/dist/src/cli/commands/ai-generate.d.ts +39 -0
- package/dist/src/cli/commands/ai-generate.d.ts.map +1 -0
- package/dist/src/cli/commands/ai-generate.js +146 -0
- package/dist/src/cli/commands/ai-generate.js.map +1 -0
- package/dist/src/cli/commands/install.d.ts +7 -0
- package/dist/src/cli/commands/install.d.ts.map +1 -0
- package/dist/src/cli/commands/install.js +146 -0
- package/dist/src/cli/commands/install.js.map +1 -0
- package/dist/src/cli/commands/list.d.ts +6 -0
- package/dist/src/cli/commands/list.d.ts.map +1 -0
- package/dist/src/cli/commands/list.js +158 -0
- package/dist/src/cli/commands/list.js.map +1 -0
- package/dist/src/cli/commands/search.d.ts +2 -0
- package/dist/src/cli/commands/search.d.ts.map +1 -0
- package/dist/src/cli/commands/search.js +174 -0
- package/dist/src/cli/commands/search.js.map +1 -0
- package/dist/src/cli/commands/update.d.ts +2 -0
- package/dist/src/cli/commands/update.d.ts.map +1 -0
- package/dist/src/cli/commands/update.js +244 -0
- package/dist/src/cli/commands/update.js.map +1 -0
- package/dist/src/cli/policy-converter.d.ts +10 -0
- package/dist/src/cli/policy-converter.d.ts.map +1 -0
- package/dist/src/cli/policy-converter.js +188 -0
- package/dist/src/cli/policy-converter.js.map +1 -0
- package/dist/src/cli/utils/error-handler.d.ts +4 -0
- package/dist/src/cli/utils/error-handler.d.ts.map +1 -0
- package/dist/src/cli/utils/error-handler.js +91 -0
- package/dist/src/cli/utils/error-handler.js.map +1 -0
- package/dist/src/cli/utils/logger.d.ts +8 -0
- package/dist/src/cli/utils/logger.d.ts.map +1 -0
- package/dist/src/cli/utils/logger.js +20 -0
- package/dist/src/cli/utils/logger.js.map +1 -0
- package/dist/src/config/config-service.d.ts +79 -0
- package/dist/src/config/config-service.d.ts.map +1 -0
- package/dist/src/config/config-service.js +112 -0
- package/dist/src/config/config-service.js.map +1 -0
- package/dist/src/config/effect_config.d.ts +111 -0
- package/dist/src/config/effect_config.d.ts.map +1 -0
- package/dist/src/config/effect_config.js +248 -0
- package/dist/src/config/effect_config.js.map +1 -0
- package/dist/src/config/effects.d.ts +33 -0
- package/dist/src/config/effects.d.ts.map +1 -0
- package/dist/src/config/effects.js +34 -0
- package/dist/src/config/effects.js.map +1 -0
- package/dist/src/config/lexicons/de-DE.d.ts +12 -0
- package/dist/src/config/lexicons/de-DE.d.ts.map +1 -0
- package/dist/src/config/lexicons/de-DE.js +129 -0
- package/dist/src/config/lexicons/de-DE.js.map +1 -0
- package/dist/src/config/lexicons/en-US.d.ts +15 -0
- package/dist/src/config/lexicons/en-US.d.ts.map +1 -0
- package/dist/src/config/lexicons/en-US.js +136 -0
- package/dist/src/config/lexicons/en-US.js.map +1 -0
- package/dist/src/config/lexicons/identifiers/domains/finance.loan.zh-CN.d.ts +13 -0
- package/dist/src/config/lexicons/identifiers/domains/finance.loan.zh-CN.d.ts.map +1 -0
- package/dist/src/config/lexicons/identifiers/domains/finance.loan.zh-CN.js +307 -0
- package/dist/src/config/lexicons/identifiers/domains/finance.loan.zh-CN.js.map +1 -0
- package/dist/src/config/lexicons/identifiers/domains/insurance.auto.zh-CN.d.ts +25 -0
- package/dist/src/config/lexicons/identifiers/domains/insurance.auto.zh-CN.d.ts.map +1 -0
- package/dist/src/config/lexicons/identifiers/domains/insurance.auto.zh-CN.js +355 -0
- package/dist/src/config/lexicons/identifiers/domains/insurance.auto.zh-CN.js.map +1 -0
- package/dist/src/config/lexicons/identifiers/examples/canonicalizer-integration.d.ts +47 -0
- package/dist/src/config/lexicons/identifiers/examples/canonicalizer-integration.d.ts.map +1 -0
- package/dist/src/config/lexicons/identifiers/examples/canonicalizer-integration.js +142 -0
- package/dist/src/config/lexicons/identifiers/examples/canonicalizer-integration.js.map +1 -0
- package/dist/src/config/lexicons/identifiers/index.d.ts +34 -0
- package/dist/src/config/lexicons/identifiers/index.d.ts.map +1 -0
- package/dist/src/config/lexicons/identifiers/index.js +37 -0
- package/dist/src/config/lexicons/identifiers/index.js.map +1 -0
- package/dist/src/config/lexicons/identifiers/registry.d.ts +112 -0
- package/dist/src/config/lexicons/identifiers/registry.d.ts.map +1 -0
- package/dist/src/config/lexicons/identifiers/registry.js +188 -0
- package/dist/src/config/lexicons/identifiers/registry.js.map +1 -0
- package/dist/src/config/lexicons/identifiers/types.d.ts +129 -0
- package/dist/src/config/lexicons/identifiers/types.d.ts.map +1 -0
- package/dist/src/config/lexicons/identifiers/types.js +146 -0
- package/dist/src/config/lexicons/identifiers/types.js.map +1 -0
- package/dist/src/config/lexicons/index.d.ts +33 -0
- package/dist/src/config/lexicons/index.d.ts.map +1 -0
- package/dist/src/config/lexicons/index.js +50 -0
- package/dist/src/config/lexicons/index.js.map +1 -0
- package/dist/src/config/lexicons/registry.d.ts +41 -0
- package/dist/src/config/lexicons/registry.d.ts.map +1 -0
- package/dist/src/config/lexicons/registry.js +205 -0
- package/dist/src/config/lexicons/registry.js.map +1 -0
- package/dist/src/config/lexicons/template.d.ts +67 -0
- package/dist/src/config/lexicons/template.d.ts.map +1 -0
- package/dist/src/config/lexicons/template.js +442 -0
- package/dist/src/config/lexicons/template.js.map +1 -0
- package/dist/src/config/lexicons/types.d.ts +169 -0
- package/dist/src/config/lexicons/types.d.ts.map +1 -0
- package/dist/src/config/lexicons/types.js +62 -0
- package/dist/src/config/lexicons/types.js.map +1 -0
- package/dist/src/config/lexicons/zh-CN.d.ts +21 -0
- package/dist/src/config/lexicons/zh-CN.d.ts.map +1 -0
- package/dist/src/config/lexicons/zh-CN.js +139 -0
- package/dist/src/config/lexicons/zh-CN.js.map +1 -0
- package/dist/src/config/runtime.d.ts +2 -0
- package/dist/src/config/runtime.d.ts.map +1 -0
- package/dist/src/config/runtime.js +13 -0
- package/dist/src/config/runtime.js.map +1 -0
- package/dist/src/config/semantic.d.ts +262 -0
- package/dist/src/config/semantic.d.ts.map +1 -0
- package/dist/src/config/semantic.js +394 -0
- package/dist/src/config/semantic.js.map +1 -0
- package/dist/src/config/token-kind.d.ts +177 -0
- package/dist/src/config/token-kind.d.ts.map +1 -0
- package/dist/src/config/token-kind.js +298 -0
- package/dist/src/config/token-kind.js.map +1 -0
- package/dist/src/core/core_ir.d.ts +50 -0
- package/dist/src/core/core_ir.d.ts.map +1 -0
- package/dist/src/core/core_ir.js +139 -0
- package/dist/src/core/core_ir.js.map +1 -0
- package/dist/src/core/core_ir_json.d.ts +62 -0
- package/dist/src/core/core_ir_json.d.ts.map +1 -0
- package/dist/src/core/core_ir_json.js +81 -0
- package/dist/src/core/core_ir_json.js.map +1 -0
- package/dist/src/core/index.d.ts +18 -0
- package/dist/src/core/index.d.ts.map +1 -0
- package/dist/src/core/index.js +16 -0
- package/dist/src/core/index.js.map +1 -0
- package/dist/src/core/pretty_core.d.ts +3 -0
- package/dist/src/core/pretty_core.d.ts.map +1 -0
- package/dist/src/core/pretty_core.js +177 -0
- package/dist/src/core/pretty_core.js.map +1 -0
- package/dist/src/core/visitor.d.ts +51 -0
- package/dist/src/core/visitor.d.ts.map +1 -0
- package/dist/src/core/visitor.js +117 -0
- package/dist/src/core/visitor.js.map +1 -0
- package/dist/src/cst/cst.d.ts +32 -0
- package/dist/src/cst/cst.d.ts.map +1 -0
- package/dist/src/cst/cst.js +2 -0
- package/dist/src/cst/cst.js.map +1 -0
- package/dist/src/cst/cst_builder.d.ts +5 -0
- package/dist/src/cst/cst_builder.d.ts.map +1 -0
- package/dist/src/cst/cst_builder.js +101 -0
- package/dist/src/cst/cst_builder.js.map +1 -0
- package/dist/src/cst/cst_printer.d.ts +8 -0
- package/dist/src/cst/cst_printer.d.ts.map +1 -0
- package/dist/src/cst/cst_printer.js +47 -0
- package/dist/src/cst/cst_printer.js.map +1 -0
- package/dist/src/cst/index.d.ts +14 -0
- package/dist/src/cst/index.d.ts.map +1 -0
- package/dist/src/cst/index.js +13 -0
- package/dist/src/cst/index.js.map +1 -0
- package/dist/src/diagnostics/diagnostics.d.ts +138 -0
- package/dist/src/diagnostics/diagnostics.d.ts.map +1 -0
- package/dist/src/diagnostics/diagnostics.js +249 -0
- package/dist/src/diagnostics/diagnostics.js.map +1 -0
- package/dist/src/diagnostics/error_codes.d.ts +88 -0
- package/dist/src/diagnostics/error_codes.d.ts.map +1 -0
- package/dist/src/diagnostics/error_codes.js +551 -0
- package/dist/src/diagnostics/error_codes.js.map +1 -0
- package/dist/src/diagnostics/index.d.ts +14 -0
- package/dist/src/diagnostics/index.d.ts.map +1 -0
- package/dist/src/diagnostics/index.js +14 -0
- package/dist/src/diagnostics/index.js.map +1 -0
- package/dist/src/effects/capabilities.d.ts +18 -0
- package/dist/src/effects/capabilities.d.ts.map +1 -0
- package/dist/src/effects/capabilities.js +101 -0
- package/dist/src/effects/capabilities.js.map +1 -0
- package/dist/src/effects/effect_inference.d.ts +17 -0
- package/dist/src/effects/effect_inference.d.ts.map +1 -0
- package/dist/src/effects/effect_inference.js +557 -0
- package/dist/src/effects/effect_inference.js.map +1 -0
- package/dist/src/effects/effect_signature.d.ts +13 -0
- package/dist/src/effects/effect_signature.d.ts.map +1 -0
- package/dist/src/effects/effect_signature.js +2 -0
- package/dist/src/effects/effect_signature.js.map +1 -0
- package/dist/src/effects/index.d.ts +14 -0
- package/dist/src/effects/index.d.ts.map +1 -0
- package/dist/src/effects/index.js +13 -0
- package/dist/src/effects/index.js.map +1 -0
- package/dist/src/formatter.d.ts +7 -0
- package/dist/src/formatter.d.ts.map +1 -0
- package/dist/src/formatter.js +383 -0
- package/dist/src/formatter.js.map +1 -0
- package/dist/src/frontend/canonicalizer.d.ts +55 -0
- package/dist/src/frontend/canonicalizer.d.ts.map +1 -0
- package/dist/src/frontend/canonicalizer.js +348 -0
- package/dist/src/frontend/canonicalizer.js.map +1 -0
- package/dist/src/frontend/index.d.ts +17 -0
- package/dist/src/frontend/index.d.ts.map +1 -0
- package/dist/src/frontend/index.js +16 -0
- package/dist/src/frontend/index.js.map +1 -0
- package/dist/src/frontend/keyword-translator.d.ts +134 -0
- package/dist/src/frontend/keyword-translator.d.ts.map +1 -0
- package/dist/src/frontend/keyword-translator.js +188 -0
- package/dist/src/frontend/keyword-translator.js.map +1 -0
- package/dist/src/frontend/lexer.d.ts +59 -0
- package/dist/src/frontend/lexer.d.ts.map +1 -0
- package/dist/src/frontend/lexer.js +536 -0
- package/dist/src/frontend/lexer.js.map +1 -0
- package/dist/src/frontend/tokens.d.ts +12 -0
- package/dist/src/frontend/tokens.d.ts.map +1 -0
- package/dist/src/frontend/tokens.js +12 -0
- package/dist/src/frontend/tokens.js.map +1 -0
- package/dist/src/index.d.ts +36 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +37 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/jvm/emitter.d.ts +3 -0
- package/dist/src/jvm/emitter.d.ts.map +1 -0
- package/dist/src/jvm/emitter.js +609 -0
- package/dist/src/jvm/emitter.js.map +1 -0
- package/dist/src/lower_to_core.d.ts +53 -0
- package/dist/src/lower_to_core.d.ts.map +1 -0
- package/dist/src/lower_to_core.js +528 -0
- package/dist/src/lower_to_core.js.map +1 -0
- package/dist/src/lsp/analysis.d.ts +50 -0
- package/dist/src/lsp/analysis.d.ts.map +1 -0
- package/dist/src/lsp/analysis.js +399 -0
- package/dist/src/lsp/analysis.js.map +1 -0
- package/dist/src/lsp/codeaction.d.ts +21 -0
- package/dist/src/lsp/codeaction.d.ts.map +1 -0
- package/dist/src/lsp/codeaction.js +531 -0
- package/dist/src/lsp/codeaction.js.map +1 -0
- package/dist/src/lsp/completion.d.ts +81 -0
- package/dist/src/lsp/completion.d.ts.map +1 -0
- package/dist/src/lsp/completion.js +345 -0
- package/dist/src/lsp/completion.js.map +1 -0
- package/dist/src/lsp/config.d.ts +34 -0
- package/dist/src/lsp/config.d.ts.map +1 -0
- package/dist/src/lsp/config.js +23 -0
- package/dist/src/lsp/config.js.map +1 -0
- package/dist/src/lsp/diagnostics.d.ts +87 -0
- package/dist/src/lsp/diagnostics.d.ts.map +1 -0
- package/dist/src/lsp/diagnostics.js +474 -0
- package/dist/src/lsp/diagnostics.js.map +1 -0
- package/dist/src/lsp/formatting.d.ts +16 -0
- package/dist/src/lsp/formatting.d.ts.map +1 -0
- package/dist/src/lsp/formatting.js +75 -0
- package/dist/src/lsp/formatting.js.map +1 -0
- package/dist/src/lsp/health.d.ts +74 -0
- package/dist/src/lsp/health.d.ts.map +1 -0
- package/dist/src/lsp/health.js +106 -0
- package/dist/src/lsp/health.js.map +1 -0
- package/dist/src/lsp/index.d.ts +14 -0
- package/dist/src/lsp/index.d.ts.map +1 -0
- package/dist/src/lsp/index.js +17 -0
- package/dist/src/lsp/index.js.map +1 -0
- package/dist/src/lsp/module_cache.d.ts +39 -0
- package/dist/src/lsp/module_cache.d.ts.map +1 -0
- package/dist/src/lsp/module_cache.js +308 -0
- package/dist/src/lsp/module_cache.js.map +1 -0
- package/dist/src/lsp/navigation/definition.d.ts +20 -0
- package/dist/src/lsp/navigation/definition.d.ts.map +1 -0
- package/dist/src/lsp/navigation/definition.js +96 -0
- package/dist/src/lsp/navigation/definition.js.map +1 -0
- package/dist/src/lsp/navigation/document-symbol.d.ts +20 -0
- package/dist/src/lsp/navigation/document-symbol.d.ts.map +1 -0
- package/dist/src/lsp/navigation/document-symbol.js +196 -0
- package/dist/src/lsp/navigation/document-symbol.js.map +1 -0
- package/dist/src/lsp/navigation/hover.d.ts +20 -0
- package/dist/src/lsp/navigation/hover.d.ts.map +1 -0
- package/dist/src/lsp/navigation/hover.js +147 -0
- package/dist/src/lsp/navigation/hover.js.map +1 -0
- package/dist/src/lsp/navigation/references.d.ts +17 -0
- package/dist/src/lsp/navigation/references.d.ts.map +1 -0
- package/dist/src/lsp/navigation/references.js +104 -0
- package/dist/src/lsp/navigation/references.js.map +1 -0
- package/dist/src/lsp/navigation/rename.d.ts +22 -0
- package/dist/src/lsp/navigation/rename.d.ts.map +1 -0
- package/dist/src/lsp/navigation/rename.js +161 -0
- package/dist/src/lsp/navigation/rename.js.map +1 -0
- package/dist/src/lsp/navigation/shared.d.ts +175 -0
- package/dist/src/lsp/navigation/shared.d.ts.map +1 -0
- package/dist/src/lsp/navigation/shared.js +470 -0
- package/dist/src/lsp/navigation/shared.js.map +1 -0
- package/dist/src/lsp/navigation.d.ts +23 -0
- package/dist/src/lsp/navigation.d.ts.map +1 -0
- package/dist/src/lsp/navigation.js +28 -0
- package/dist/src/lsp/navigation.js.map +1 -0
- package/dist/src/lsp/pii_diagnostics.d.ts +15 -0
- package/dist/src/lsp/pii_diagnostics.d.ts.map +1 -0
- package/dist/src/lsp/pii_diagnostics.js +624 -0
- package/dist/src/lsp/pii_diagnostics.js.map +1 -0
- package/dist/src/lsp/server.d.ts +3 -0
- package/dist/src/lsp/server.d.ts.map +1 -0
- package/dist/src/lsp/server.js +406 -0
- package/dist/src/lsp/server.js.map +1 -0
- package/dist/src/lsp/shared-state.d.ts +15 -0
- package/dist/src/lsp/shared-state.d.ts.map +1 -0
- package/dist/src/lsp/shared-state.js +21 -0
- package/dist/src/lsp/shared-state.js.map +1 -0
- package/dist/src/lsp/symbols.d.ts +35 -0
- package/dist/src/lsp/symbols.d.ts.map +1 -0
- package/dist/src/lsp/symbols.js +124 -0
- package/dist/src/lsp/symbols.js.map +1 -0
- package/dist/src/lsp/task-queue.d.ts +172 -0
- package/dist/src/lsp/task-queue.d.ts.map +1 -0
- package/dist/src/lsp/task-queue.js +310 -0
- package/dist/src/lsp/task-queue.js.map +1 -0
- package/dist/src/lsp/token-index.d.ts +45 -0
- package/dist/src/lsp/token-index.d.ts.map +1 -0
- package/dist/src/lsp/token-index.js +114 -0
- package/dist/src/lsp/token-index.js.map +1 -0
- package/dist/src/lsp/tokens.d.ts +33 -0
- package/dist/src/lsp/tokens.d.ts.map +1 -0
- package/dist/src/lsp/tokens.js +259 -0
- package/dist/src/lsp/tokens.js.map +1 -0
- package/dist/src/lsp/type-guards.d.ts +80 -0
- package/dist/src/lsp/type-guards.d.ts.map +1 -0
- package/dist/src/lsp/type-guards.js +132 -0
- package/dist/src/lsp/type-guards.js.map +1 -0
- package/dist/src/lsp/utils.d.ts +4 -0
- package/dist/src/lsp/utils.d.ts.map +1 -0
- package/dist/src/lsp/utils.js +52 -0
- package/dist/src/lsp/utils.js.map +1 -0
- package/dist/src/lsp/workspace/document-indexer.d.ts +14 -0
- package/dist/src/lsp/workspace/document-indexer.d.ts.map +1 -0
- package/dist/src/lsp/workspace/document-indexer.js +88 -0
- package/dist/src/lsp/workspace/document-indexer.js.map +1 -0
- package/dist/src/lsp/workspace/file-watcher.d.ts +137 -0
- package/dist/src/lsp/workspace/file-watcher.d.ts.map +1 -0
- package/dist/src/lsp/workspace/file-watcher.js +307 -0
- package/dist/src/lsp/workspace/file-watcher.js.map +1 -0
- package/dist/src/lsp/workspace/index-manager.d.ts +48 -0
- package/dist/src/lsp/workspace/index-manager.d.ts.map +1 -0
- package/dist/src/lsp/workspace/index-manager.js +131 -0
- package/dist/src/lsp/workspace/index-manager.js.map +1 -0
- package/dist/src/lsp/workspace/symbol-finder.d.ts +13 -0
- package/dist/src/lsp/workspace/symbol-finder.d.ts.map +1 -0
- package/dist/src/lsp/workspace/symbol-finder.js +69 -0
- package/dist/src/lsp/workspace/symbol-finder.js.map +1 -0
- package/dist/src/lsp/workspace/types.d.ts +77 -0
- package/dist/src/lsp/workspace/types.d.ts.map +1 -0
- package/dist/src/lsp/workspace/types.js +6 -0
- package/dist/src/lsp/workspace/types.js.map +1 -0
- package/dist/src/lsp/workspace/workspace-scanner.d.ts +11 -0
- package/dist/src/lsp/workspace/workspace-scanner.d.ts.map +1 -0
- package/dist/src/lsp/workspace/workspace-scanner.js +115 -0
- package/dist/src/lsp/workspace/workspace-scanner.js.map +1 -0
- package/dist/src/manifest.d.ts +48 -0
- package/dist/src/manifest.d.ts.map +1 -0
- package/dist/src/manifest.js +10 -0
- package/dist/src/manifest.js.map +1 -0
- package/dist/src/package/config.d.ts +28 -0
- package/dist/src/package/config.d.ts.map +1 -0
- package/dist/src/package/config.js +59 -0
- package/dist/src/package/config.js.map +1 -0
- package/dist/src/package/dependency-graph.d.ts +42 -0
- package/dist/src/package/dependency-graph.d.ts.map +1 -0
- package/dist/src/package/dependency-graph.js +144 -0
- package/dist/src/package/dependency-graph.js.map +1 -0
- package/dist/src/package/lockfile.d.ts +20 -0
- package/dist/src/package/lockfile.d.ts.map +1 -0
- package/dist/src/package/lockfile.js +146 -0
- package/dist/src/package/lockfile.js.map +1 -0
- package/dist/src/package/manifest-parser.d.ts +22 -0
- package/dist/src/package/manifest-parser.d.ts.map +1 -0
- package/dist/src/package/manifest-parser.js +275 -0
- package/dist/src/package/manifest-parser.js.map +1 -0
- package/dist/src/package/package-cache.d.ts +56 -0
- package/dist/src/package/package-cache.d.ts.map +1 -0
- package/dist/src/package/package-cache.js +166 -0
- package/dist/src/package/package-cache.js.map +1 -0
- package/dist/src/package/package-installer.d.ts +67 -0
- package/dist/src/package/package-installer.d.ts.map +1 -0
- package/dist/src/package/package-installer.js +310 -0
- package/dist/src/package/package-installer.js.map +1 -0
- package/dist/src/package/package-registry.d.ts +70 -0
- package/dist/src/package/package-registry.d.ts.map +1 -0
- package/dist/src/package/package-registry.js +480 -0
- package/dist/src/package/package-registry.js.map +1 -0
- package/dist/src/package/resolver.d.ts +50 -0
- package/dist/src/package/resolver.d.ts.map +1 -0
- package/dist/src/package/resolver.js +236 -0
- package/dist/src/package/resolver.js.map +1 -0
- package/dist/src/package/version-utils.d.ts +53 -0
- package/dist/src/package/version-utils.d.ts.map +1 -0
- package/dist/src/package/version-utils.js +61 -0
- package/dist/src/package/version-utils.js.map +1 -0
- package/dist/src/parser/constraint-parser.d.ts +42 -0
- package/dist/src/parser/constraint-parser.d.ts.map +1 -0
- package/dist/src/parser/constraint-parser.js +192 -0
- package/dist/src/parser/constraint-parser.js.map +1 -0
- package/dist/src/parser/context.d.ts +56 -0
- package/dist/src/parser/context.d.ts.map +1 -0
- package/dist/src/parser/context.js +177 -0
- package/dist/src/parser/context.js.map +1 -0
- package/dist/src/parser/decl-parser.d.ts +52 -0
- package/dist/src/parser/decl-parser.d.ts.map +1 -0
- package/dist/src/parser/decl-parser.js +461 -0
- package/dist/src/parser/decl-parser.js.map +1 -0
- package/dist/src/parser/expr-stmt-parser.d.ts +51 -0
- package/dist/src/parser/expr-stmt-parser.d.ts.map +1 -0
- package/dist/src/parser/expr-stmt-parser.js +1317 -0
- package/dist/src/parser/expr-stmt-parser.js.map +1 -0
- package/dist/src/parser/field-variant-parser.d.ts +47 -0
- package/dist/src/parser/field-variant-parser.d.ts.map +1 -0
- package/dist/src/parser/field-variant-parser.js +142 -0
- package/dist/src/parser/field-variant-parser.js.map +1 -0
- package/dist/src/parser/import-parser.d.ts +40 -0
- package/dist/src/parser/import-parser.d.ts.map +1 -0
- package/dist/src/parser/import-parser.js +91 -0
- package/dist/src/parser/import-parser.js.map +1 -0
- package/dist/src/parser/parser-tools.d.ts +52 -0
- package/dist/src/parser/parser-tools.d.ts.map +1 -0
- package/dist/src/parser/parser-tools.js +50 -0
- package/dist/src/parser/parser-tools.js.map +1 -0
- package/dist/src/parser/span-utils.d.ts +16 -0
- package/dist/src/parser/span-utils.d.ts.map +1 -0
- package/dist/src/parser/span-utils.js +90 -0
- package/dist/src/parser/span-utils.js.map +1 -0
- package/dist/src/parser/type-inference.d.ts +90 -0
- package/dist/src/parser/type-inference.d.ts.map +1 -0
- package/dist/src/parser/type-inference.js +287 -0
- package/dist/src/parser/type-inference.js.map +1 -0
- package/dist/src/parser/type-parser.d.ts +24 -0
- package/dist/src/parser/type-parser.d.ts.map +1 -0
- package/dist/src/parser/type-parser.js +338 -0
- package/dist/src/parser/type-parser.js.map +1 -0
- package/dist/src/parser.d.ts +12 -0
- package/dist/src/parser.d.ts.map +1 -0
- package/dist/src/parser.js +25 -0
- package/dist/src/parser.js.map +1 -0
- package/dist/src/typecheck/async.d.ts +57 -0
- package/dist/src/typecheck/async.d.ts.map +1 -0
- package/dist/src/typecheck/async.js +369 -0
- package/dist/src/typecheck/async.js.map +1 -0
- package/dist/src/typecheck/capabilities.d.ts +20 -0
- package/dist/src/typecheck/capabilities.d.ts.map +1 -0
- package/dist/src/typecheck/capabilities.js +86 -0
- package/dist/src/typecheck/capabilities.js.map +1 -0
- package/dist/src/typecheck/context.d.ts +31 -0
- package/dist/src/typecheck/context.d.ts.map +1 -0
- package/dist/src/typecheck/context.js +34 -0
- package/dist/src/typecheck/context.js.map +1 -0
- package/dist/src/typecheck/diagnostics.d.ts +15 -0
- package/dist/src/typecheck/diagnostics.d.ts.map +1 -0
- package/dist/src/typecheck/diagnostics.js +92 -0
- package/dist/src/typecheck/diagnostics.js.map +1 -0
- package/dist/src/typecheck/effects.d.ts +16 -0
- package/dist/src/typecheck/effects.d.ts.map +1 -0
- package/dist/src/typecheck/effects.js +122 -0
- package/dist/src/typecheck/effects.js.map +1 -0
- package/dist/src/typecheck/expression.d.ts +12 -0
- package/dist/src/typecheck/expression.d.ts.map +1 -0
- package/dist/src/typecheck/expression.js +306 -0
- package/dist/src/typecheck/expression.js.map +1 -0
- package/dist/src/typecheck/generics.d.ts +6 -0
- package/dist/src/typecheck/generics.d.ts.map +1 -0
- package/dist/src/typecheck/generics.js +131 -0
- package/dist/src/typecheck/generics.js.map +1 -0
- package/dist/src/typecheck/index.d.ts +6 -0
- package/dist/src/typecheck/index.d.ts.map +1 -0
- package/dist/src/typecheck/index.js +3 -0
- package/dist/src/typecheck/index.js.map +1 -0
- package/dist/src/typecheck/module.d.ts +9 -0
- package/dist/src/typecheck/module.d.ts.map +1 -0
- package/dist/src/typecheck/module.js +223 -0
- package/dist/src/typecheck/module.js.map +1 -0
- package/dist/src/typecheck/pattern.d.ts +6 -0
- package/dist/src/typecheck/pattern.d.ts.map +1 -0
- package/dist/src/typecheck/pattern.js +80 -0
- package/dist/src/typecheck/pattern.js.map +1 -0
- package/dist/src/typecheck/statement.d.ts +13 -0
- package/dist/src/typecheck/statement.d.ts.map +1 -0
- package/dist/src/typecheck/statement.js +176 -0
- package/dist/src/typecheck/statement.js.map +1 -0
- package/dist/src/typecheck/symbol_table.d.ts +63 -0
- package/dist/src/typecheck/symbol_table.d.ts.map +1 -0
- package/dist/src/typecheck/symbol_table.js +208 -0
- package/dist/src/typecheck/symbol_table.js.map +1 -0
- package/dist/src/typecheck/type_system.d.ts +30 -0
- package/dist/src/typecheck/type_system.d.ts.map +1 -0
- package/dist/src/typecheck/type_system.js +529 -0
- package/dist/src/typecheck/type_system.js.map +1 -0
- package/dist/src/typecheck/utils.d.ts +45 -0
- package/dist/src/typecheck/utils.d.ts.map +1 -0
- package/dist/src/typecheck/utils.js +110 -0
- package/dist/src/typecheck/utils.js.map +1 -0
- package/dist/src/typecheck/workflow.d.ts +8 -0
- package/dist/src/typecheck/workflow.d.ts.map +1 -0
- package/dist/src/typecheck/workflow.js +247 -0
- package/dist/src/typecheck/workflow.js.map +1 -0
- package/dist/src/typecheck-pii.d.ts +3 -0
- package/dist/src/typecheck-pii.d.ts.map +1 -0
- package/dist/src/typecheck-pii.js +534 -0
- package/dist/src/typecheck-pii.js.map +1 -0
- package/dist/src/typecheck.d.ts +7 -0
- package/dist/src/typecheck.d.ts.map +1 -0
- package/dist/src/typecheck.js +2 -0
- package/dist/src/typecheck.js.map +1 -0
- package/dist/src/types/base.d.ts +423 -0
- package/dist/src/types/base.d.ts.map +1 -0
- package/dist/src/types/base.js +18 -0
- package/dist/src/types/base.js.map +1 -0
- package/dist/src/types.d.ts +531 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/types.js +47 -0
- package/dist/src/types.js.map +1 -0
- package/dist/src/utils/logger.d.ts +28 -0
- package/dist/src/utils/logger.d.ts.map +1 -0
- package/dist/src/utils/logger.js +60 -0
- package/dist/src/utils/logger.js.map +1 -0
- package/dist/test/benchmark.d.ts +3 -0
- package/dist/test/benchmark.d.ts.map +1 -0
- package/dist/test/benchmark.js +106 -0
- package/dist/test/benchmark.js.map +1 -0
- package/dist/test/cli/commands/install.test.d.ts +2 -0
- package/dist/test/cli/commands/install.test.d.ts.map +1 -0
- package/dist/test/cli/commands/install.test.js +97 -0
- package/dist/test/cli/commands/install.test.js.map +1 -0
- package/dist/test/cli/commands/list.test.d.ts +2 -0
- package/dist/test/cli/commands/list.test.d.ts.map +1 -0
- package/dist/test/cli/commands/list.test.js +98 -0
- package/dist/test/cli/commands/list.test.js.map +1 -0
- package/dist/test/cli/commands/search.test.d.ts +2 -0
- package/dist/test/cli/commands/search.test.d.ts.map +1 -0
- package/dist/test/cli/commands/search.test.js +133 -0
- package/dist/test/cli/commands/search.test.js.map +1 -0
- package/dist/test/cli/commands/update.test.d.ts +2 -0
- package/dist/test/cli/commands/update.test.d.ts.map +1 -0
- package/dist/test/cli/commands/update.test.js +205 -0
- package/dist/test/cli/commands/update.test.js.map +1 -0
- package/dist/test/cli/integration.test.d.ts +2 -0
- package/dist/test/cli/integration.test.d.ts.map +1 -0
- package/dist/test/cli/integration.test.js +51 -0
- package/dist/test/cli/integration.test.js.map +1 -0
- package/dist/test/cli/registry-utils.d.ts +6 -0
- package/dist/test/cli/registry-utils.d.ts.map +1 -0
- package/dist/test/cli/registry-utils.js +35 -0
- package/dist/test/cli/registry-utils.js.map +1 -0
- package/dist/test/cli/utils/error-handler.test.d.ts +2 -0
- package/dist/test/cli/utils/error-handler.test.d.ts.map +1 -0
- package/dist/test/cli/utils/error-handler.test.js +108 -0
- package/dist/test/cli/utils/error-handler.test.js.map +1 -0
- package/dist/test/compiler/depends-on.test.d.ts +2 -0
- package/dist/test/compiler/depends-on.test.d.ts.map +1 -0
- package/dist/test/compiler/depends-on.test.js +184 -0
- package/dist/test/compiler/depends-on.test.js.map +1 -0
- package/dist/test/compiler/inventory-capability.test.d.ts +2 -0
- package/dist/test/compiler/inventory-capability.test.d.ts.map +1 -0
- package/dist/test/compiler/inventory-capability.test.js +22 -0
- package/dist/test/compiler/inventory-capability.test.js.map +1 -0
- package/dist/test/compiler/payment-capability.test.d.ts +2 -0
- package/dist/test/compiler/payment-capability.test.d.ts.map +1 -0
- package/dist/test/compiler/payment-capability.test.js +22 -0
- package/dist/test/compiler/payment-capability.test.js.map +1 -0
- package/dist/test/compiler/workflow-emitter-helpers.d.ts +3 -0
- package/dist/test/compiler/workflow-emitter-helpers.d.ts.map +1 -0
- package/dist/test/compiler/workflow-emitter-helpers.js +44 -0
- package/dist/test/compiler/workflow-emitter-helpers.js.map +1 -0
- package/dist/test/e2e/package-management.test.d.ts +2 -0
- package/dist/test/e2e/package-management.test.d.ts.map +1 -0
- package/dist/test/e2e/package-management.test.js +51 -0
- package/dist/test/e2e/package-management.test.js.map +1 -0
- package/dist/test/e2e/runner/golden-runner.d.ts +3 -0
- package/dist/test/e2e/runner/golden-runner.d.ts.map +1 -0
- package/dist/test/e2e/runner/golden-runner.js +212 -0
- package/dist/test/e2e/runner/golden-runner.js.map +1 -0
- package/dist/test/fuzz/formatter-fuzz.test.d.ts +3 -0
- package/dist/test/fuzz/formatter-fuzz.test.d.ts.map +1 -0
- package/dist/test/fuzz/formatter-fuzz.test.js +44 -0
- package/dist/test/fuzz/formatter-fuzz.test.js.map +1 -0
- package/dist/test/fuzz/fuzz.test.d.ts +3 -0
- package/dist/test/fuzz/fuzz.test.d.ts.map +1 -0
- package/dist/test/fuzz/fuzz.test.js +141 -0
- package/dist/test/fuzz/fuzz.test.js.map +1 -0
- package/dist/test/fuzz/lossless-fuzz.test.d.ts +3 -0
- package/dist/test/fuzz/lossless-fuzz.test.d.ts.map +1 -0
- package/dist/test/fuzz/lossless-fuzz.test.js +116 -0
- package/dist/test/fuzz/lossless-fuzz.test.js.map +1 -0
- package/dist/test/generators.d.ts +53 -0
- package/dist/test/generators.d.ts.map +1 -0
- package/dist/test/generators.js +253 -0
- package/dist/test/generators.js.map +1 -0
- package/dist/test/helpers/test-factories.d.ts +24 -0
- package/dist/test/helpers/test-factories.d.ts.map +1 -0
- package/dist/test/helpers/test-factories.js +30 -0
- package/dist/test/helpers/test-factories.js.map +1 -0
- package/dist/test/helpers/test-utils.d.ts +19 -0
- package/dist/test/helpers/test-utils.d.ts.map +1 -0
- package/dist/test/helpers/test-utils.js +30 -0
- package/dist/test/helpers/test-utils.js.map +1 -0
- package/dist/test/integration/capabilities/capabilities.test.d.ts +3 -0
- package/dist/test/integration/capabilities/capabilities.test.d.ts.map +1 -0
- package/dist/test/integration/capabilities/capabilities.test.js +63 -0
- package/dist/test/integration/capabilities/capabilities.test.js.map +1 -0
- package/dist/test/integration/capabilities/config-service.test.d.ts +11 -0
- package/dist/test/integration/capabilities/config-service.test.d.ts.map +1 -0
- package/dist/test/integration/capabilities/config-service.test.js +125 -0
- package/dist/test/integration/capabilities/config-service.test.js.map +1 -0
- package/dist/test/integration/capabilities/effect-config.test.d.ts +3 -0
- package/dist/test/integration/capabilities/effect-config.test.d.ts.map +1 -0
- package/dist/test/integration/capabilities/effect-config.test.js +196 -0
- package/dist/test/integration/capabilities/effect-config.test.js.map +1 -0
- package/dist/test/integration/compliance/compliance-smoke.test.d.ts +14 -0
- package/dist/test/integration/compliance/compliance-smoke.test.d.ts.map +1 -0
- package/dist/test/integration/compliance/compliance-smoke.test.js +222 -0
- package/dist/test/integration/compliance/compliance-smoke.test.js.map +1 -0
- package/dist/test/integration/lsp/lsp-client-helper.test.d.ts +7 -0
- package/dist/test/integration/lsp/lsp-client-helper.test.d.ts.map +1 -0
- package/dist/test/integration/lsp/lsp-client-helper.test.js +45 -0
- package/dist/test/integration/lsp/lsp-client-helper.test.js.map +1 -0
- package/dist/test/integration/lsp/lsp-completion.test.d.ts +7 -0
- package/dist/test/integration/lsp/lsp-completion.test.d.ts.map +1 -0
- package/dist/test/integration/lsp/lsp-completion.test.js +178 -0
- package/dist/test/integration/lsp/lsp-completion.test.js.map +1 -0
- package/dist/test/integration/lsp/lsp-diagnostics.test.d.ts +7 -0
- package/dist/test/integration/lsp/lsp-diagnostics.test.d.ts.map +1 -0
- package/dist/test/integration/lsp/lsp-diagnostics.test.js +105 -0
- package/dist/test/integration/lsp/lsp-diagnostics.test.js.map +1 -0
- package/dist/test/integration/lsp/lsp-file-watcher.test.d.ts +7 -0
- package/dist/test/integration/lsp/lsp-file-watcher.test.d.ts.map +1 -0
- package/dist/test/integration/lsp/lsp-file-watcher.test.js +401 -0
- package/dist/test/integration/lsp/lsp-file-watcher.test.js.map +1 -0
- package/dist/test/integration/lsp/lsp-health-metrics.test.d.ts +7 -0
- package/dist/test/integration/lsp/lsp-health-metrics.test.d.ts.map +1 -0
- package/dist/test/integration/lsp/lsp-health-metrics.test.js +285 -0
- package/dist/test/integration/lsp/lsp-health-metrics.test.js.map +1 -0
- package/dist/test/integration/lsp/lsp-modules.test.d.ts +7 -0
- package/dist/test/integration/lsp/lsp-modules.test.d.ts.map +1 -0
- package/dist/test/integration/lsp/lsp-modules.test.js +193 -0
- package/dist/test/integration/lsp/lsp-modules.test.js.map +1 -0
- package/dist/test/integration/lsp/lsp-multi-rename.test.d.ts +3 -0
- package/dist/test/integration/lsp/lsp-multi-rename.test.d.ts.map +1 -0
- package/dist/test/integration/lsp/lsp-multi-rename.test.js +81 -0
- package/dist/test/integration/lsp/lsp-multi-rename.test.js.map +1 -0
- package/dist/test/integration/lsp/lsp-navigation.test.d.ts +7 -0
- package/dist/test/integration/lsp/lsp-navigation.test.d.ts.map +1 -0
- package/dist/test/integration/lsp/lsp-navigation.test.js +332 -0
- package/dist/test/integration/lsp/lsp-navigation.test.js.map +1 -0
- package/dist/test/integration/lsp/lsp-process-lifecycle.test.d.ts +7 -0
- package/dist/test/integration/lsp/lsp-process-lifecycle.test.d.ts.map +1 -0
- package/dist/test/integration/lsp/lsp-process-lifecycle.test.js +257 -0
- package/dist/test/integration/lsp/lsp-process-lifecycle.test.js.map +1 -0
- package/dist/test/integration/lsp/lsp-task-queue.test.d.ts +7 -0
- package/dist/test/integration/lsp/lsp-task-queue.test.d.ts.map +1 -0
- package/dist/test/integration/lsp/lsp-task-queue.test.js +267 -0
- package/dist/test/integration/lsp/lsp-task-queue.test.js.map +1 -0
- package/dist/test/integration/pipeline/pipeline.test.d.ts +13 -0
- package/dist/test/integration/pipeline/pipeline.test.d.ts.map +1 -0
- package/dist/test/integration/pipeline/pipeline.test.js +310 -0
- package/dist/test/integration/pipeline/pipeline.test.js.map +1 -0
- package/dist/test/perf/perf-utils.test.d.ts +3 -0
- package/dist/test/perf/perf-utils.test.d.ts.map +1 -0
- package/dist/test/perf/perf-utils.test.js +144 -0
- package/dist/test/perf/perf-utils.test.js.map +1 -0
- package/dist/test/performance/package-installer.perf.test.d.ts +9 -0
- package/dist/test/performance/package-installer.perf.test.d.ts.map +1 -0
- package/dist/test/performance/package-installer.perf.test.js +80 -0
- package/dist/test/performance/package-installer.perf.test.js.map +1 -0
- package/dist/test/policy-converter/round-trip.test.d.ts +2 -0
- package/dist/test/policy-converter/round-trip.test.d.ts.map +1 -0
- package/dist/test/policy-converter/round-trip.test.js +83 -0
- package/dist/test/policy-converter/round-trip.test.js.map +1 -0
- package/dist/test/property/lsp-props.test.d.ts +3 -0
- package/dist/test/property/lsp-props.test.d.ts.map +1 -0
- package/dist/test/property/lsp-props.test.js +43 -0
- package/dist/test/property/lsp-props.test.js.map +1 -0
- package/dist/test/property/property.test.d.ts +3 -0
- package/dist/test/property/property.test.d.ts.map +1 -0
- package/dist/test/property/property.test.js +456 -0
- package/dist/test/property/property.test.js.map +1 -0
- package/dist/test/regression/type-checker-golden.test.d.ts +8 -0
- package/dist/test/regression/type-checker-golden.test.d.ts.map +1 -0
- package/dist/test/regression/type-checker-golden.test.js +172 -0
- package/dist/test/regression/type-checker-golden.test.js.map +1 -0
- package/dist/test/type-checker/cross-module-packages.test.d.ts +2 -0
- package/dist/test/type-checker/cross-module-packages.test.d.ts.map +1 -0
- package/dist/test/type-checker/cross-module-packages.test.js +51 -0
- package/dist/test/type-checker/cross-module-packages.test.js.map +1 -0
- package/dist/test/type-checker/pii-propagation.test.d.ts +2 -0
- package/dist/test/type-checker/pii-propagation.test.d.ts.map +1 -0
- package/dist/test/type-checker/pii-propagation.test.js +656 -0
- package/dist/test/type-checker/pii-propagation.test.js.map +1 -0
- package/dist/test/unit/async/async-discipline.test.d.ts +12 -0
- package/dist/test/unit/async/async-discipline.test.d.ts.map +1 -0
- package/dist/test/unit/async/async-discipline.test.js +492 -0
- package/dist/test/unit/async/async-discipline.test.js.map +1 -0
- package/dist/test/unit/async/async-schedule.test.d.ts +7 -0
- package/dist/test/unit/async/async-schedule.test.d.ts.map +1 -0
- package/dist/test/unit/async/async-schedule.test.js +154 -0
- package/dist/test/unit/async/async-schedule.test.js.map +1 -0
- package/dist/test/unit/canonicalizer/canonicalizer.test.d.ts +2 -0
- package/dist/test/unit/canonicalizer/canonicalizer.test.d.ts.map +1 -0
- package/dist/test/unit/canonicalizer/canonicalizer.test.js +195 -0
- package/dist/test/unit/canonicalizer/canonicalizer.test.js.map +1 -0
- package/dist/test/unit/config/config-service.test.d.ts +2 -0
- package/dist/test/unit/config/config-service.test.d.ts.map +1 -0
- package/dist/test/unit/config/config-service.test.js +235 -0
- package/dist/test/unit/config/config-service.test.js.map +1 -0
- package/dist/test/unit/config/effect-config-cache.test.d.ts +2 -0
- package/dist/test/unit/config/effect-config-cache.test.d.ts.map +1 -0
- package/dist/test/unit/config/effect-config-cache.test.js +135 -0
- package/dist/test/unit/config/effect-config-cache.test.js.map +1 -0
- package/dist/test/unit/config/lexicons/i18n.test.d.ts +15 -0
- package/dist/test/unit/config/lexicons/i18n.test.d.ts.map +1 -0
- package/dist/test/unit/config/lexicons/i18n.test.js +318 -0
- package/dist/test/unit/config/lexicons/i18n.test.js.map +1 -0
- package/dist/test/unit/config/lexicons/identifiers/identifier-mapping.test.d.ts +7 -0
- package/dist/test/unit/config/lexicons/identifiers/identifier-mapping.test.d.ts.map +1 -0
- package/dist/test/unit/config/lexicons/identifiers/identifier-mapping.test.js +180 -0
- package/dist/test/unit/config/lexicons/identifiers/identifier-mapping.test.js.map +1 -0
- package/dist/test/unit/config/lexicons/zh-CN.test.d.ts +7 -0
- package/dist/test/unit/config/lexicons/zh-CN.test.d.ts.map +1 -0
- package/dist/test/unit/config/lexicons/zh-CN.test.js +922 -0
- package/dist/test/unit/config/lexicons/zh-CN.test.js.map +1 -0
- package/dist/test/unit/core_ir_json/core_ir_json.test.d.ts +2 -0
- package/dist/test/unit/core_ir_json/core_ir_json.test.d.ts.map +1 -0
- package/dist/test/unit/core_ir_json/core_ir_json.test.js +218 -0
- package/dist/test/unit/core_ir_json/core_ir_json.test.js.map +1 -0
- package/dist/test/unit/dependency-graph.test.d.ts +5 -0
- package/dist/test/unit/dependency-graph.test.d.ts.map +1 -0
- package/dist/test/unit/dependency-graph.test.js +105 -0
- package/dist/test/unit/dependency-graph.test.js.map +1 -0
- package/dist/test/unit/effect/effect-inference.test.d.ts +2 -0
- package/dist/test/unit/effect/effect-inference.test.d.ts.map +1 -0
- package/dist/test/unit/effect/effect-inference.test.js +480 -0
- package/dist/test/unit/effect/effect-inference.test.js.map +1 -0
- package/dist/test/unit/emitter/emitter.test.d.ts +2 -0
- package/dist/test/unit/emitter/emitter.test.d.ts.map +1 -0
- package/dist/test/unit/emitter/emitter.test.js +825 -0
- package/dist/test/unit/emitter/emitter.test.js.map +1 -0
- package/dist/test/unit/generator.test.d.ts +2 -0
- package/dist/test/unit/generator.test.d.ts.map +1 -0
- package/dist/test/unit/generator.test.js +322 -0
- package/dist/test/unit/generator.test.js.map +1 -0
- package/dist/test/unit/keyword-translator.test.d.ts +10 -0
- package/dist/test/unit/keyword-translator.test.d.ts.map +1 -0
- package/dist/test/unit/keyword-translator.test.js +251 -0
- package/dist/test/unit/keyword-translator.test.js.map +1 -0
- package/dist/test/unit/lexer/lexer.test.d.ts +2 -0
- package/dist/test/unit/lexer/lexer.test.d.ts.map +1 -0
- package/dist/test/unit/lexer/lexer.test.js +136 -0
- package/dist/test/unit/lexer/lexer.test.js.map +1 -0
- package/dist/test/unit/lexer/newline-handling.test.d.ts +12 -0
- package/dist/test/unit/lexer/newline-handling.test.d.ts.map +1 -0
- package/dist/test/unit/lexer/newline-handling.test.js +379 -0
- package/dist/test/unit/lexer/newline-handling.test.js.map +1 -0
- package/dist/test/unit/llm-providers.test.d.ts +2 -0
- package/dist/test/unit/llm-providers.test.d.ts.map +1 -0
- package/dist/test/unit/llm-providers.test.js +341 -0
- package/dist/test/unit/llm-providers.test.js.map +1 -0
- package/dist/test/unit/lockfile.test.d.ts +5 -0
- package/dist/test/unit/lockfile.test.d.ts.map +1 -0
- package/dist/test/unit/lockfile.test.js +116 -0
- package/dist/test/unit/lockfile.test.js.map +1 -0
- package/dist/test/unit/lowering/lowering.test.d.ts +2 -0
- package/dist/test/unit/lowering/lowering.test.d.ts.map +1 -0
- package/dist/test/unit/lowering/lowering.test.js +625 -0
- package/dist/test/unit/lowering/lowering.test.js.map +1 -0
- package/dist/test/unit/lsp/analysis.test.d.ts +2 -0
- package/dist/test/unit/lsp/analysis.test.d.ts.map +1 -0
- package/dist/test/unit/lsp/analysis.test.js +401 -0
- package/dist/test/unit/lsp/analysis.test.js.map +1 -0
- package/dist/test/unit/lsp/codeaction.test.d.ts +2 -0
- package/dist/test/unit/lsp/codeaction.test.d.ts.map +1 -0
- package/dist/test/unit/lsp/codeaction.test.js +542 -0
- package/dist/test/unit/lsp/codeaction.test.js.map +1 -0
- package/dist/test/unit/lsp/pii-diagnostics.test.d.ts +2 -0
- package/dist/test/unit/lsp/pii-diagnostics.test.d.ts.map +1 -0
- package/dist/test/unit/lsp/pii-diagnostics.test.js +222 -0
- package/dist/test/unit/lsp/pii-diagnostics.test.js.map +1 -0
- package/dist/test/unit/lsp/symbols.test.d.ts +2 -0
- package/dist/test/unit/lsp/symbols.test.d.ts.map +1 -0
- package/dist/test/unit/lsp/symbols.test.js +160 -0
- package/dist/test/unit/lsp/symbols.test.js.map +1 -0
- package/dist/test/unit/lsp/utils.test.d.ts +2 -0
- package/dist/test/unit/lsp/utils.test.d.ts.map +1 -0
- package/dist/test/unit/lsp/utils.test.js +182 -0
- package/dist/test/unit/lsp/utils.test.js.map +1 -0
- package/dist/test/unit/manifest-parser.test.d.ts +12 -0
- package/dist/test/unit/manifest-parser.test.d.ts.map +1 -0
- package/dist/test/unit/manifest-parser.test.js +285 -0
- package/dist/test/unit/manifest-parser.test.js.map +1 -0
- package/dist/test/unit/manifest-schema.test.d.ts +11 -0
- package/dist/test/unit/manifest-schema.test.d.ts.map +1 -0
- package/dist/test/unit/manifest-schema.test.js +171 -0
- package/dist/test/unit/manifest-schema.test.js.map +1 -0
- package/dist/test/unit/module-cache-packages.test.d.ts +2 -0
- package/dist/test/unit/module-cache-packages.test.d.ts.map +1 -0
- package/dist/test/unit/module-cache-packages.test.js +114 -0
- package/dist/test/unit/module-cache-packages.test.js.map +1 -0
- package/dist/test/unit/package-cache.test.d.ts +7 -0
- package/dist/test/unit/package-cache.test.d.ts.map +1 -0
- package/dist/test/unit/package-cache.test.js +192 -0
- package/dist/test/unit/package-cache.test.js.map +1 -0
- package/dist/test/unit/package-installer.test.d.ts +2 -0
- package/dist/test/unit/package-installer.test.d.ts.map +1 -0
- package/dist/test/unit/package-installer.test.js +263 -0
- package/dist/test/unit/package-installer.test.js.map +1 -0
- package/dist/test/unit/package-registry.test.d.ts +7 -0
- package/dist/test/unit/package-registry.test.d.ts.map +1 -0
- package/dist/test/unit/package-registry.test.js +198 -0
- package/dist/test/unit/package-registry.test.js.map +1 -0
- package/dist/test/unit/parser/parser.test.d.ts +2 -0
- package/dist/test/unit/parser/parser.test.d.ts.map +1 -0
- package/dist/test/unit/parser/parser.test.js +1117 -0
- package/dist/test/unit/parser/parser.test.js.map +1 -0
- package/dist/test/unit/parser/type-inference.test.d.ts +5 -0
- package/dist/test/unit/parser/type-inference.test.d.ts.map +1 -0
- package/dist/test/unit/parser/type-inference.test.js +262 -0
- package/dist/test/unit/parser/type-inference.test.js.map +1 -0
- package/dist/test/unit/prompt-manager.test.d.ts +2 -0
- package/dist/test/unit/prompt-manager.test.d.ts.map +1 -0
- package/dist/test/unit/prompt-manager.test.js +137 -0
- package/dist/test/unit/prompt-manager.test.js.map +1 -0
- package/dist/test/unit/provenance-integration.test.d.ts +2 -0
- package/dist/test/unit/provenance-integration.test.d.ts.map +1 -0
- package/dist/test/unit/provenance-integration.test.js +181 -0
- package/dist/test/unit/provenance-integration.test.js.map +1 -0
- package/dist/test/unit/provenance.test.d.ts +2 -0
- package/dist/test/unit/provenance.test.d.ts.map +1 -0
- package/dist/test/unit/provenance.test.js +170 -0
- package/dist/test/unit/provenance.test.js.map +1 -0
- package/dist/test/unit/resolver.test.d.ts +5 -0
- package/dist/test/unit/resolver.test.d.ts.map +1 -0
- package/dist/test/unit/resolver.test.js +48 -0
- package/dist/test/unit/resolver.test.js.map +1 -0
- package/dist/test/unit/typecheck/async-discipline-extended.test.d.ts +2 -0
- package/dist/test/unit/typecheck/async-discipline-extended.test.d.ts.map +1 -0
- package/dist/test/unit/typecheck/async-discipline-extended.test.js +69 -0
- package/dist/test/unit/typecheck/async-discipline-extended.test.js.map +1 -0
- package/dist/test/unit/typecheck/effects-and-capabilities.test.d.ts +2 -0
- package/dist/test/unit/typecheck/effects-and-capabilities.test.d.ts.map +1 -0
- package/dist/test/unit/typecheck/effects-and-capabilities.test.js +191 -0
- package/dist/test/unit/typecheck/effects-and-capabilities.test.js.map +1 -0
- package/dist/test/unit/typecheck/regression-fixes.test.d.ts +11 -0
- package/dist/test/unit/typecheck/regression-fixes.test.d.ts.map +1 -0
- package/dist/test/unit/typecheck/regression-fixes.test.js +456 -0
- package/dist/test/unit/typecheck/regression-fixes.test.js.map +1 -0
- package/dist/test/unit/typecheck/should-enforce-pii.test.d.ts +2 -0
- package/dist/test/unit/typecheck/should-enforce-pii.test.d.ts.map +1 -0
- package/dist/test/unit/typecheck/should-enforce-pii.test.js +167 -0
- package/dist/test/unit/typecheck/should-enforce-pii.test.js.map +1 -0
- package/dist/test/unit/typecheck/symbol-table.test.d.ts +7 -0
- package/dist/test/unit/typecheck/symbol-table.test.d.ts.map +1 -0
- package/dist/test/unit/typecheck/symbol-table.test.js +145 -0
- package/dist/test/unit/typecheck/symbol-table.test.js.map +1 -0
- package/dist/test/unit/typecheck/type-inference.test.d.ts +2 -0
- package/dist/test/unit/typecheck/type-inference.test.d.ts.map +1 -0
- package/dist/test/unit/typecheck/type-inference.test.js +122 -0
- package/dist/test/unit/typecheck/type-inference.test.js.map +1 -0
- package/dist/test/unit/typecheck/type-system-extended.test.d.ts +8 -0
- package/dist/test/unit/typecheck/type-system-extended.test.d.ts.map +1 -0
- package/dist/test/unit/typecheck/type-system-extended.test.js +131 -0
- package/dist/test/unit/typecheck/type-system-extended.test.js.map +1 -0
- package/dist/test/unit/typecheck/type-system.test.d.ts +9 -0
- package/dist/test/unit/typecheck/type-system.test.d.ts.map +1 -0
- package/dist/test/unit/typecheck/type-system.test.js +617 -0
- package/dist/test/unit/typecheck/type-system.test.js.map +1 -0
- package/dist/test/unit/typecheck/typecheck-advanced.test.d.ts +2 -0
- package/dist/test/unit/typecheck/typecheck-advanced.test.d.ts.map +1 -0
- package/dist/test/unit/typecheck/typecheck-advanced.test.js +125 -0
- package/dist/test/unit/typecheck/typecheck-advanced.test.js.map +1 -0
- package/dist/test/unit/validator.test.d.ts +2 -0
- package/dist/test/unit/validator.test.d.ts.map +1 -0
- package/dist/test/unit/validator.test.js +154 -0
- package/dist/test/unit/validator.test.js.map +1 -0
- package/dist/test/unit/version-utils.test.d.ts +12 -0
- package/dist/test/unit/version-utils.test.d.ts.map +1 -0
- package/dist/test/unit/version-utils.test.js +112 -0
- package/dist/test/unit/version-utils.test.js.map +1 -0
- package/package.json +153 -0
|
@@ -0,0 +1,1317 @@
|
|
|
1
|
+
import { kwParts, tokLowerAt } from './context.js';
|
|
2
|
+
import { TokenKind, KW } from '../frontend/tokens.js';
|
|
3
|
+
import { Node } from '../ast/ast.js';
|
|
4
|
+
import { parseType, parseEffectList } from './type-parser.js';
|
|
5
|
+
import { parseConstraints } from './constraint-parser.js';
|
|
6
|
+
import { inferFieldType, refineInferredType } from './type-inference.js';
|
|
7
|
+
import { assignSpan, cloneSpan, lastConsumedToken, spanFromSources, spanFromTokens, } from './span-utils.js';
|
|
8
|
+
const WAIT_FOR_PARTS = kwParts(KW.WAIT_FOR);
|
|
9
|
+
const MAX_ATTEMPTS_PARTS = kwParts(KW.MAX_ATTEMPTS);
|
|
10
|
+
function peekKeywordIgnoringLayout(ctx, startIndex = ctx.index) {
|
|
11
|
+
let idx = startIndex;
|
|
12
|
+
while (idx < ctx.tokens.length) {
|
|
13
|
+
const tok = ctx.tokens[idx];
|
|
14
|
+
if (tok.kind === TokenKind.NEWLINE ||
|
|
15
|
+
tok.kind === TokenKind.INDENT ||
|
|
16
|
+
tok.kind === TokenKind.DEDENT) {
|
|
17
|
+
idx++;
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
20
|
+
if (tok.kind === TokenKind.IDENT || tok.kind === TokenKind.TYPE_IDENT || tok.kind === TokenKind.KEYWORD) {
|
|
21
|
+
const value = tok.value || '';
|
|
22
|
+
return value.toLowerCase();
|
|
23
|
+
}
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
function spanFromToken(token) {
|
|
29
|
+
return spanFromTokens(token, token);
|
|
30
|
+
}
|
|
31
|
+
function assignTokenSpan(node, token) {
|
|
32
|
+
return assignSpan(node, spanFromToken(token));
|
|
33
|
+
}
|
|
34
|
+
function assignSpanFromSources(node, ...sources) {
|
|
35
|
+
return assignSpan(node, spanFromSources(...sources));
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* 解析代码块(Block)
|
|
39
|
+
* @param ctx Parser 上下文
|
|
40
|
+
* @param error 错误报告函数
|
|
41
|
+
* @returns Block 节点
|
|
42
|
+
*/
|
|
43
|
+
export function parseBlock(ctx, error) {
|
|
44
|
+
const statements = [];
|
|
45
|
+
ctx.consumeNewlines();
|
|
46
|
+
// Check if we have an INDENT token (new indented block)
|
|
47
|
+
const hasIndent = ctx.at(TokenKind.INDENT);
|
|
48
|
+
if (hasIndent) {
|
|
49
|
+
// Standard indented block: consume INDENT and parse until DEDENT
|
|
50
|
+
ctx.next();
|
|
51
|
+
while (!ctx.at(TokenKind.DEDENT) && !ctx.at(TokenKind.EOF)) {
|
|
52
|
+
ctx.consumeNewlines();
|
|
53
|
+
if (ctx.at(TokenKind.DEDENT) || ctx.at(TokenKind.EOF))
|
|
54
|
+
break;
|
|
55
|
+
statements.push(parseStatement(ctx, error));
|
|
56
|
+
ctx.consumeNewlines();
|
|
57
|
+
}
|
|
58
|
+
if (!ctx.at(TokenKind.DEDENT))
|
|
59
|
+
error('Expected dedent');
|
|
60
|
+
const endTok = ctx.peek();
|
|
61
|
+
ctx.next();
|
|
62
|
+
const b = Node.Block(statements);
|
|
63
|
+
if (statements.length > 0) {
|
|
64
|
+
const firstStmt = statements[0];
|
|
65
|
+
const lastStmt = statements[statements.length - 1];
|
|
66
|
+
assignSpan(b, spanFromSources(firstStmt, lastStmt));
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
assignSpan(b, spanFromSources(endTok));
|
|
70
|
+
}
|
|
71
|
+
return b;
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
// Already in an indented context (multi-line parameters case):
|
|
75
|
+
// Parse statements until we hit DEDENT or EOF
|
|
76
|
+
const startTok = ctx.peek();
|
|
77
|
+
while (!ctx.at(TokenKind.DEDENT) && !ctx.at(TokenKind.EOF)) {
|
|
78
|
+
ctx.consumeNewlines();
|
|
79
|
+
if (ctx.at(TokenKind.DEDENT) || ctx.at(TokenKind.EOF))
|
|
80
|
+
break;
|
|
81
|
+
statements.push(parseStatement(ctx, error));
|
|
82
|
+
ctx.consumeNewlines();
|
|
83
|
+
}
|
|
84
|
+
if (statements.length === 0)
|
|
85
|
+
error('Expected at least one statement in function body');
|
|
86
|
+
const endTok = ctx.tokens[ctx.index - 1] || startTok;
|
|
87
|
+
const b = Node.Block(statements);
|
|
88
|
+
if (statements.length > 0) {
|
|
89
|
+
const firstStmt = statements[0];
|
|
90
|
+
const lastStmt = statements[statements.length - 1];
|
|
91
|
+
assignSpan(b, spanFromSources(firstStmt, lastStmt));
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
assignSpan(b, spanFromSources(startTok, endTok));
|
|
95
|
+
}
|
|
96
|
+
// Don't consume DEDENT here - let the caller handle it
|
|
97
|
+
return b;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* 期望语句以句号结束
|
|
102
|
+
* @param ctx Parser 上下文
|
|
103
|
+
* @param error 错误报告函数
|
|
104
|
+
*/
|
|
105
|
+
function expectPeriodEnd(ctx, error) {
|
|
106
|
+
if (!ctx.at(TokenKind.DOT))
|
|
107
|
+
error("Expected '.' at end of statement");
|
|
108
|
+
ctx.next();
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* 期望语句以句号或换行符结束
|
|
112
|
+
* @param ctx Parser 上下文
|
|
113
|
+
* @param error 错误报告函数
|
|
114
|
+
*/
|
|
115
|
+
function expectPeriodEndOrLine(ctx, error) {
|
|
116
|
+
if (ctx.at(TokenKind.DOT)) {
|
|
117
|
+
ctx.next();
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
// Tolerate newline/dedent/EOF terminators inside blocks for certain statements (e.g., Return)
|
|
121
|
+
if (ctx.at(TokenKind.NEWLINE) || ctx.at(TokenKind.DEDENT) || ctx.at(TokenKind.EOF))
|
|
122
|
+
return;
|
|
123
|
+
error("Expected '.' at end of statement");
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* 解析语句
|
|
127
|
+
* @param ctx Parser 上下文
|
|
128
|
+
* @param error 错误报告函数
|
|
129
|
+
* @returns Statement 节点
|
|
130
|
+
*/
|
|
131
|
+
export function parseStatement(ctx, error) {
|
|
132
|
+
if (ctx.isKeyword(KW.LET)) {
|
|
133
|
+
const letTok = ctx.peek();
|
|
134
|
+
ctx.nextWord();
|
|
135
|
+
const nameTok = ctx.peek();
|
|
136
|
+
const name = parseIdent(ctx, error);
|
|
137
|
+
expectKeyword(ctx, error, KW.BE, "Use 'be' in bindings: 'Let x be ...'.");
|
|
138
|
+
// Special-case lambda block form to avoid trailing '.'
|
|
139
|
+
if ((ctx.isKeyword('a') && tokLowerAt(ctx, ctx.index + 1) === 'function') || ctx.isKeyword('function')) {
|
|
140
|
+
if (ctx.isKeyword('a'))
|
|
141
|
+
ctx.nextWord(); // optional 'a'
|
|
142
|
+
const functionTok = ctx.nextWord(); // 'function'
|
|
143
|
+
const params = parseParamList(ctx, error);
|
|
144
|
+
expectCommaOr(ctx);
|
|
145
|
+
expectKeyword(ctx, error, KW.PRODUCE, "Expected 'produce' and return type");
|
|
146
|
+
let retType;
|
|
147
|
+
if (ctx.at(TokenKind.COLON)) {
|
|
148
|
+
retType = Node.TypeName('Unknown');
|
|
149
|
+
assignSpan(retType, spanFromTokens(ctx.peek(), ctx.peek()));
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
retType = parseType(ctx, error);
|
|
153
|
+
}
|
|
154
|
+
if (!ctx.at(TokenKind.COLON))
|
|
155
|
+
error("Expected ':' after return type in lambda");
|
|
156
|
+
ctx.next();
|
|
157
|
+
expectNewline(ctx, error);
|
|
158
|
+
const body = parseBlock(ctx, error);
|
|
159
|
+
const lambda = Node.Lambda(params, retType, body);
|
|
160
|
+
const lambdaEnd = lastConsumedToken(ctx);
|
|
161
|
+
assignSpan(lambda, spanFromTokens(functionTok, lambdaEnd));
|
|
162
|
+
const nd = Node.Let(name, lambda);
|
|
163
|
+
assignSpan(nd, spanFromTokens(letTok, lambdaEnd));
|
|
164
|
+
if (nameTok)
|
|
165
|
+
nd.nameSpan = spanFromToken(nameTok);
|
|
166
|
+
return nd;
|
|
167
|
+
}
|
|
168
|
+
const expr = parseExpr(ctx, error);
|
|
169
|
+
expectPeriodEnd(ctx, error);
|
|
170
|
+
const nd = Node.Let(name, expr);
|
|
171
|
+
const endTok = lastConsumedToken(ctx);
|
|
172
|
+
assignSpan(nd, spanFromTokens(letTok, endTok));
|
|
173
|
+
if (nameTok)
|
|
174
|
+
nd.nameSpan = spanFromToken(nameTok);
|
|
175
|
+
return nd;
|
|
176
|
+
}
|
|
177
|
+
if (ctx.isKeyword(KW.SET)) {
|
|
178
|
+
const setTok = ctx.peek();
|
|
179
|
+
ctx.nextWord();
|
|
180
|
+
const name = parseIdent(ctx, error);
|
|
181
|
+
expectKeyword(ctx, error, KW.TO_WORD, "Use 'to' in assignments: 'Set x to ...'.");
|
|
182
|
+
const expr = parseExpr(ctx, error);
|
|
183
|
+
expectPeriodEnd(ctx, error);
|
|
184
|
+
const nd = Node.Set(name, expr);
|
|
185
|
+
const endTok = lastConsumedToken(ctx);
|
|
186
|
+
assignSpan(nd, spanFromTokens(setTok, endTok));
|
|
187
|
+
return nd;
|
|
188
|
+
}
|
|
189
|
+
if (ctx.isKeyword(KW.RETURN)) {
|
|
190
|
+
const retTok = ctx.peek();
|
|
191
|
+
ctx.nextWord();
|
|
192
|
+
const expr = parseExpr(ctx, error);
|
|
193
|
+
expectPeriodEndOrLine(ctx, error);
|
|
194
|
+
// Allow trailing effect sentence immediately after a Return: 'It performs io.'
|
|
195
|
+
// This attaches to the enclosing function's effects if present.
|
|
196
|
+
if ((tokLowerAt(ctx, ctx.index) === 'it' && tokLowerAt(ctx, ctx.index + 1) === 'performs') || tokLowerAt(ctx, ctx.index) === 'performs') {
|
|
197
|
+
if (tokLowerAt(ctx, ctx.index) === 'it')
|
|
198
|
+
ctx.nextWord();
|
|
199
|
+
if (tokLowerAt(ctx, ctx.index) === 'performs') {
|
|
200
|
+
ctx.nextWord();
|
|
201
|
+
const effs = parseEffectList(ctx, error);
|
|
202
|
+
expectPeriodEnd(ctx, error);
|
|
203
|
+
if (Array.isArray(ctx.collectedEffects))
|
|
204
|
+
ctx.collectedEffects.push(...effs);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
const nd = Node.Return(expr);
|
|
208
|
+
const endTok = lastConsumedToken(ctx);
|
|
209
|
+
assignSpan(nd, spanFromTokens(retTok, endTok));
|
|
210
|
+
return nd;
|
|
211
|
+
}
|
|
212
|
+
if (ctx.isKeyword(KW.AWAIT)) {
|
|
213
|
+
const awaitTok = ctx.nextWord();
|
|
214
|
+
if (!ctx.at(TokenKind.LPAREN))
|
|
215
|
+
error("Expected '(' after await");
|
|
216
|
+
const args = parseArgList(ctx, error);
|
|
217
|
+
if (args.length !== 1)
|
|
218
|
+
error('await(expr) takes exactly one argument');
|
|
219
|
+
const target = assignTokenSpan(Node.Name('await'), awaitTok);
|
|
220
|
+
const callSpanEnd = lastConsumedToken(ctx);
|
|
221
|
+
const aw = Node.Call(target, args);
|
|
222
|
+
assignSpan(aw, spanFromTokens(awaitTok, callSpanEnd));
|
|
223
|
+
expectPeriodEnd(ctx, error);
|
|
224
|
+
return aw;
|
|
225
|
+
}
|
|
226
|
+
if (ctx.isKeyword(KW.IF)) {
|
|
227
|
+
const ifTok = ctx.peek();
|
|
228
|
+
ctx.nextWord();
|
|
229
|
+
const cond = parseExpr(ctx, error);
|
|
230
|
+
// CNL 改进: 移除冗余逗号,只保留冒号 (If condition: → 更自然)
|
|
231
|
+
if (!ctx.at(TokenKind.COLON))
|
|
232
|
+
error("Expected ':' after condition in If");
|
|
233
|
+
ctx.next();
|
|
234
|
+
expectNewline(ctx, error);
|
|
235
|
+
const thenBlock = parseBlock(ctx, error);
|
|
236
|
+
let elseBlock = null;
|
|
237
|
+
if (ctx.isKeyword(KW.OTHERWISE)) {
|
|
238
|
+
ctx.nextWord();
|
|
239
|
+
// CNL 改进: 移除冗余逗号,只保留冒号 (Otherwise: → 更自然)
|
|
240
|
+
if (!ctx.at(TokenKind.COLON))
|
|
241
|
+
error("Expected ':' after Otherwise");
|
|
242
|
+
ctx.next();
|
|
243
|
+
expectNewline(ctx, error);
|
|
244
|
+
elseBlock = parseBlock(ctx, error);
|
|
245
|
+
}
|
|
246
|
+
const nd = Node.If(cond, thenBlock, elseBlock);
|
|
247
|
+
const endTok = lastConsumedToken(ctx);
|
|
248
|
+
assignSpan(nd, spanFromTokens(ifTok, endTok));
|
|
249
|
+
return nd;
|
|
250
|
+
}
|
|
251
|
+
if (ctx.isKeyword(KW.MATCH)) {
|
|
252
|
+
const mTok = ctx.peek();
|
|
253
|
+
ctx.nextWord();
|
|
254
|
+
const expr = parseExpr(ctx, error);
|
|
255
|
+
if (!ctx.at(TokenKind.COLON))
|
|
256
|
+
error("Expected ':' after match expression");
|
|
257
|
+
ctx.next();
|
|
258
|
+
expectNewline(ctx, error);
|
|
259
|
+
const cases = parseCases(ctx, error);
|
|
260
|
+
const nd = Node.Match(expr, cases);
|
|
261
|
+
const endTok = lastConsumedToken(ctx);
|
|
262
|
+
assignSpan(nd, spanFromTokens(mTok, endTok));
|
|
263
|
+
return nd;
|
|
264
|
+
}
|
|
265
|
+
if (ctx.isKeyword(KW.WORKFLOW)) {
|
|
266
|
+
return parseWorkflow(ctx, error);
|
|
267
|
+
}
|
|
268
|
+
// Plain bare expression as statement (allow method calls, constructions) ending with '.'
|
|
269
|
+
if (ctx.at(TokenKind.IDENT) ||
|
|
270
|
+
ctx.at(TokenKind.TYPE_IDENT) ||
|
|
271
|
+
ctx.at(TokenKind.STRING) ||
|
|
272
|
+
ctx.at(TokenKind.INT) ||
|
|
273
|
+
ctx.at(TokenKind.BOOL) ||
|
|
274
|
+
ctx.at(TokenKind.NULL) ||
|
|
275
|
+
ctx.at(TokenKind.LPAREN)) {
|
|
276
|
+
const exprStart = ctx.index;
|
|
277
|
+
try {
|
|
278
|
+
const _e = parseExpr(ctx, error);
|
|
279
|
+
expectPeriodEnd(ctx, error);
|
|
280
|
+
return _e; // Not lowering; in v0, only Return statements are valid side-effects.
|
|
281
|
+
}
|
|
282
|
+
catch {
|
|
283
|
+
// rewind
|
|
284
|
+
ctx.index = exprStart;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
if (ctx.isKeyword(KW.WITHIN)) {
|
|
288
|
+
ctx.nextWord();
|
|
289
|
+
expectKeyword(ctx, error, KW.SCOPE, "Expected 'scope' after 'Within'");
|
|
290
|
+
if (!ctx.at(TokenKind.COLON))
|
|
291
|
+
error("Expected ':' after 'scope'");
|
|
292
|
+
ctx.next();
|
|
293
|
+
expectNewline(ctx, error);
|
|
294
|
+
return parseBlock(ctx, error); // Lowering later
|
|
295
|
+
}
|
|
296
|
+
if (ctx.isKeyword(KW.START)) {
|
|
297
|
+
const startTok = ctx.nextWord();
|
|
298
|
+
const name = parseIdent(ctx, error);
|
|
299
|
+
expectKeyword(ctx, error, KW.AS, "Expected 'as' after name");
|
|
300
|
+
expectKeyword(ctx, error, KW.ASYNC, "Expected 'async'");
|
|
301
|
+
const expr = parseExpr(ctx, error);
|
|
302
|
+
expectPeriodEnd(ctx, error);
|
|
303
|
+
const nd = Node.Start(name, expr);
|
|
304
|
+
const endTok = lastConsumedToken(ctx);
|
|
305
|
+
assignSpan(nd, spanFromTokens(startTok, endTok));
|
|
306
|
+
return nd;
|
|
307
|
+
}
|
|
308
|
+
if (ctx.isKeywordSeq(WAIT_FOR_PARTS)) {
|
|
309
|
+
const waitStart = ctx.peek();
|
|
310
|
+
ctx.nextWords(WAIT_FOR_PARTS);
|
|
311
|
+
const names = [];
|
|
312
|
+
names.push(parseIdent(ctx, error));
|
|
313
|
+
while (ctx.isKeyword(KW.AND) || ctx.at(TokenKind.COMMA)) {
|
|
314
|
+
if (ctx.isKeyword(KW.AND)) {
|
|
315
|
+
ctx.nextWord();
|
|
316
|
+
names.push(parseIdent(ctx, error));
|
|
317
|
+
}
|
|
318
|
+
else {
|
|
319
|
+
ctx.next();
|
|
320
|
+
names.push(parseIdent(ctx, error));
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
expectPeriodEnd(ctx, error);
|
|
324
|
+
const nd = Node.Wait(names);
|
|
325
|
+
const endTok = lastConsumedToken(ctx);
|
|
326
|
+
assignSpan(nd, spanFromTokens(waitStart, endTok));
|
|
327
|
+
return nd;
|
|
328
|
+
}
|
|
329
|
+
error('Unknown statement');
|
|
330
|
+
}
|
|
331
|
+
function parseWorkflow(ctx, error) {
|
|
332
|
+
const workflowTok = ctx.peek();
|
|
333
|
+
expectKeyword(ctx, error, KW.WORKFLOW, "Expected 'workflow'");
|
|
334
|
+
if (!ctx.at(TokenKind.COLON))
|
|
335
|
+
error("Expected ':' after 'workflow'");
|
|
336
|
+
ctx.next();
|
|
337
|
+
expectNewline(ctx, error);
|
|
338
|
+
if (!ctx.at(TokenKind.INDENT))
|
|
339
|
+
error('Expected indent after workflow header');
|
|
340
|
+
ctx.next();
|
|
341
|
+
ctx.consumeNewlines();
|
|
342
|
+
const steps = [];
|
|
343
|
+
while (ctx.isKeyword(KW.STEP)) {
|
|
344
|
+
steps.push(parseStep(ctx, error));
|
|
345
|
+
ctx.consumeNewlines();
|
|
346
|
+
}
|
|
347
|
+
if (steps.length === 0)
|
|
348
|
+
error('Workflow must declare at least one step');
|
|
349
|
+
let retry;
|
|
350
|
+
if (ctx.isKeyword(KW.RETRY)) {
|
|
351
|
+
retry = parseRetryPolicy(ctx, error);
|
|
352
|
+
ctx.consumeNewlines();
|
|
353
|
+
}
|
|
354
|
+
let timeout;
|
|
355
|
+
if (ctx.isKeyword(KW.TIMEOUT)) {
|
|
356
|
+
timeout = parseTimeout(ctx, error);
|
|
357
|
+
ctx.consumeNewlines();
|
|
358
|
+
}
|
|
359
|
+
if (!ctx.at(TokenKind.DEDENT))
|
|
360
|
+
error('Expected dedent after workflow body');
|
|
361
|
+
ctx.next();
|
|
362
|
+
ctx.consumeNewlines();
|
|
363
|
+
expectPeriodEnd(ctx, error);
|
|
364
|
+
const workflow = Node.Workflow(steps, retry, timeout);
|
|
365
|
+
const endTok = lastConsumedToken(ctx);
|
|
366
|
+
assignSpan(workflow, spanFromTokens(workflowTok, endTok));
|
|
367
|
+
return workflow;
|
|
368
|
+
}
|
|
369
|
+
function parseStep(ctx, error) {
|
|
370
|
+
const stepTok = ctx.peek();
|
|
371
|
+
expectKeyword(ctx, error, KW.STEP, "Expected 'step'");
|
|
372
|
+
const name = parseIdent(ctx, error);
|
|
373
|
+
const dependencies = [];
|
|
374
|
+
if (ctx.isKeyword(KW.DEPENDS)) {
|
|
375
|
+
ctx.nextWord();
|
|
376
|
+
expectKeyword(ctx, error, KW.ON, "Expected 'on' after 'depends'");
|
|
377
|
+
if (!ctx.at(TokenKind.LBRACKET))
|
|
378
|
+
error("Expected '[' after 'depends on'");
|
|
379
|
+
ctx.next();
|
|
380
|
+
if (!ctx.at(TokenKind.RBRACKET)) {
|
|
381
|
+
while (true) {
|
|
382
|
+
if (!ctx.at(TokenKind.STRING))
|
|
383
|
+
error('Expected string dependency name');
|
|
384
|
+
const depTok = ctx.next();
|
|
385
|
+
dependencies.push(depTok.value);
|
|
386
|
+
if (ctx.at(TokenKind.COMMA)) {
|
|
387
|
+
ctx.next();
|
|
388
|
+
continue;
|
|
389
|
+
}
|
|
390
|
+
if (ctx.at(TokenKind.RBRACKET)) {
|
|
391
|
+
break;
|
|
392
|
+
}
|
|
393
|
+
error("Expected ',' or ']' after dependency name");
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
if (!ctx.at(TokenKind.RBRACKET))
|
|
397
|
+
error("Expected ']' to close dependency list");
|
|
398
|
+
ctx.next();
|
|
399
|
+
}
|
|
400
|
+
if (!ctx.at(TokenKind.COLON))
|
|
401
|
+
error("Expected ':' after step name");
|
|
402
|
+
ctx.next();
|
|
403
|
+
expectNewline(ctx, error);
|
|
404
|
+
const body = parseBlock(ctx, error);
|
|
405
|
+
ctx.consumeNewlines();
|
|
406
|
+
let compensate;
|
|
407
|
+
if (ctx.isKeyword(KW.COMPENSATE)) {
|
|
408
|
+
ctx.nextWord();
|
|
409
|
+
if (!ctx.at(TokenKind.COLON))
|
|
410
|
+
error("Expected ':' after 'compensate'");
|
|
411
|
+
ctx.next();
|
|
412
|
+
expectNewline(ctx, error);
|
|
413
|
+
compensate = parseBlock(ctx, error);
|
|
414
|
+
ctx.consumeNewlines();
|
|
415
|
+
}
|
|
416
|
+
const step = Node.Step(name, body, compensate, dependencies);
|
|
417
|
+
const endTok = lastConsumedToken(ctx);
|
|
418
|
+
assignSpan(step, spanFromTokens(stepTok, endTok));
|
|
419
|
+
return step;
|
|
420
|
+
}
|
|
421
|
+
function parseRetryPolicy(ctx, error) {
|
|
422
|
+
expectKeyword(ctx, error, KW.RETRY, "Expected 'retry'");
|
|
423
|
+
if (!ctx.at(TokenKind.COLON))
|
|
424
|
+
error("Expected ':' after 'retry'");
|
|
425
|
+
ctx.next();
|
|
426
|
+
expectNewline(ctx, error);
|
|
427
|
+
if (!ctx.at(TokenKind.INDENT))
|
|
428
|
+
error('Expected indent for retry policy');
|
|
429
|
+
ctx.next();
|
|
430
|
+
ctx.consumeNewlines();
|
|
431
|
+
let maxAttempts = null;
|
|
432
|
+
let backoff = null;
|
|
433
|
+
while (!ctx.at(TokenKind.DEDENT)) {
|
|
434
|
+
if (ctx.isKeywordSeq(MAX_ATTEMPTS_PARTS)) {
|
|
435
|
+
ctx.nextWords(MAX_ATTEMPTS_PARTS);
|
|
436
|
+
if (!ctx.at(TokenKind.COLON))
|
|
437
|
+
error("Expected ':' after 'max attempts'");
|
|
438
|
+
ctx.next();
|
|
439
|
+
if (!ctx.at(TokenKind.INT))
|
|
440
|
+
error("Expected integer after 'max attempts'");
|
|
441
|
+
const attempts = ctx.next().value;
|
|
442
|
+
if (attempts <= 0)
|
|
443
|
+
error("'max attempts' must be greater than zero");
|
|
444
|
+
maxAttempts = attempts;
|
|
445
|
+
expectPeriodEnd(ctx, error);
|
|
446
|
+
}
|
|
447
|
+
else if (ctx.isKeyword(KW.BACKOFF)) {
|
|
448
|
+
ctx.nextWord();
|
|
449
|
+
if (!ctx.at(TokenKind.COLON))
|
|
450
|
+
error("Expected ':' after 'backoff'");
|
|
451
|
+
ctx.next();
|
|
452
|
+
const modeTok = ctx.nextWord();
|
|
453
|
+
const mode = String(modeTok.value ?? '').toLowerCase();
|
|
454
|
+
if (mode !== 'exponential' && mode !== 'linear') {
|
|
455
|
+
error("Backoff must be either 'exponential' or 'linear'");
|
|
456
|
+
}
|
|
457
|
+
backoff = mode;
|
|
458
|
+
expectPeriodEnd(ctx, error);
|
|
459
|
+
}
|
|
460
|
+
else {
|
|
461
|
+
error('Unknown retry directive');
|
|
462
|
+
}
|
|
463
|
+
ctx.consumeNewlines();
|
|
464
|
+
}
|
|
465
|
+
ctx.next();
|
|
466
|
+
if (maxAttempts === null)
|
|
467
|
+
error("Retry section must include 'max attempts'");
|
|
468
|
+
if (backoff === null)
|
|
469
|
+
error("Retry section must include 'backoff'");
|
|
470
|
+
return { maxAttempts, backoff };
|
|
471
|
+
}
|
|
472
|
+
function parseTimeout(ctx, error) {
|
|
473
|
+
expectKeyword(ctx, error, KW.TIMEOUT, "Expected 'timeout'");
|
|
474
|
+
if (!ctx.at(TokenKind.COLON))
|
|
475
|
+
error("Expected ':' after 'timeout'");
|
|
476
|
+
ctx.next();
|
|
477
|
+
if (!ctx.at(TokenKind.INT))
|
|
478
|
+
error('Expected integer timeout value');
|
|
479
|
+
const secondsTok = ctx.next();
|
|
480
|
+
const seconds = secondsTok.value;
|
|
481
|
+
if (seconds < 0)
|
|
482
|
+
error('Timeout value must be non-negative');
|
|
483
|
+
if (!(ctx.isKeyword('seconds') || ctx.isKeyword('second'))) {
|
|
484
|
+
error("Timeout must specify time unit 'seconds'");
|
|
485
|
+
}
|
|
486
|
+
ctx.nextWord();
|
|
487
|
+
expectPeriodEnd(ctx, error);
|
|
488
|
+
return { milliseconds: seconds * 1000 };
|
|
489
|
+
}
|
|
490
|
+
/**
|
|
491
|
+
* 解析 Match 语句的 Case 列表
|
|
492
|
+
* @param ctx Parser 上下文
|
|
493
|
+
* @param error 错误报告函数
|
|
494
|
+
* @returns Case 节点数组
|
|
495
|
+
*/
|
|
496
|
+
function parseCases(ctx, error) {
|
|
497
|
+
const cases = [];
|
|
498
|
+
if (!ctx.at(TokenKind.INDENT))
|
|
499
|
+
error('Expected indent for cases');
|
|
500
|
+
ctx.next();
|
|
501
|
+
while (!ctx.at(TokenKind.DEDENT)) {
|
|
502
|
+
if (!ctx.isKeyword(KW.WHEN))
|
|
503
|
+
error("Expected 'When'");
|
|
504
|
+
const whenTok = ctx.nextWord();
|
|
505
|
+
const pat = parsePattern(ctx, error);
|
|
506
|
+
if (!ctx.at(TokenKind.COMMA))
|
|
507
|
+
error("Expected ',' after pattern");
|
|
508
|
+
ctx.next();
|
|
509
|
+
const body = parseCaseBody(ctx, error);
|
|
510
|
+
const caseNode = Node.Case(pat, body);
|
|
511
|
+
const endTok = lastConsumedToken(ctx);
|
|
512
|
+
assignSpan(caseNode, spanFromTokens(whenTok, endTok));
|
|
513
|
+
cases.push(caseNode);
|
|
514
|
+
while (ctx.at(TokenKind.NEWLINE))
|
|
515
|
+
ctx.next();
|
|
516
|
+
}
|
|
517
|
+
ctx.next();
|
|
518
|
+
return cases;
|
|
519
|
+
}
|
|
520
|
+
/**
|
|
521
|
+
* 解析 Case 的 Body 部分(可以是 Return 语句或 Block)
|
|
522
|
+
* @param ctx Parser 上下文
|
|
523
|
+
* @param error 错误报告函数
|
|
524
|
+
* @returns Block 或 Return 节点
|
|
525
|
+
*/
|
|
526
|
+
function parseCaseBody(ctx, error) {
|
|
527
|
+
if (ctx.isKeyword(KW.RETURN)) {
|
|
528
|
+
const retTok = ctx.nextWord();
|
|
529
|
+
const e = parseExpr(ctx, error);
|
|
530
|
+
expectPeriodEnd(ctx, error);
|
|
531
|
+
const nd = Node.Return(e);
|
|
532
|
+
const endTok = lastConsumedToken(ctx);
|
|
533
|
+
assignSpan(nd, spanFromTokens(retTok, endTok));
|
|
534
|
+
return nd;
|
|
535
|
+
}
|
|
536
|
+
return parseBlock(ctx, error);
|
|
537
|
+
}
|
|
538
|
+
/**
|
|
539
|
+
* 解析表达式
|
|
540
|
+
* @param ctx Parser 上下文
|
|
541
|
+
* @param error 错误报告函数
|
|
542
|
+
* @returns Expression 节点
|
|
543
|
+
*/
|
|
544
|
+
export function parseExpr(ctx, error) {
|
|
545
|
+
return parseNot(ctx, error);
|
|
546
|
+
}
|
|
547
|
+
/**
|
|
548
|
+
* 解析逻辑非表达式(not)
|
|
549
|
+
* @param ctx Parser 上下文
|
|
550
|
+
* @param error 错误报告函数
|
|
551
|
+
* @returns Expression 节点
|
|
552
|
+
*/
|
|
553
|
+
function parseNot(ctx, error) {
|
|
554
|
+
if (ctx.isKeyword(KW.NOT)) {
|
|
555
|
+
const notTok = ctx.nextWord();
|
|
556
|
+
const expr = parseNot(ctx, error);
|
|
557
|
+
const notName = assignTokenSpan(Node.Name('not'), notTok);
|
|
558
|
+
const call = Node.Call(notName, [expr]);
|
|
559
|
+
assignSpan(call, spanFromSources(notTok, expr));
|
|
560
|
+
return call;
|
|
561
|
+
}
|
|
562
|
+
return parseComparison(ctx, error);
|
|
563
|
+
}
|
|
564
|
+
/**
|
|
565
|
+
* 解析比较表达式
|
|
566
|
+
* @param ctx Parser 上下文
|
|
567
|
+
* @param error 错误报告函数
|
|
568
|
+
* @returns Expression 节点
|
|
569
|
+
*/
|
|
570
|
+
function parseComparison(ctx, error) {
|
|
571
|
+
let left = parseAddition(ctx, error);
|
|
572
|
+
const lessThanParts = kwParts(KW.LESS_THAN);
|
|
573
|
+
const greaterThanParts = kwParts(KW.GREATER_THAN);
|
|
574
|
+
const equalsToParts = kwParts(KW.EQUALS_TO);
|
|
575
|
+
const atLeastParts = kwParts(KW.AT_LEAST);
|
|
576
|
+
const atMostParts = kwParts(KW.AT_MOST);
|
|
577
|
+
let more = true;
|
|
578
|
+
while (more) {
|
|
579
|
+
if (ctx.isKeyword(KW.LESS_THAN) || ctx.isKeywordSeq(lessThanParts)) {
|
|
580
|
+
const opTok = ctx.peek();
|
|
581
|
+
if (ctx.isKeywordSeq(lessThanParts)) {
|
|
582
|
+
ctx.nextWords(lessThanParts);
|
|
583
|
+
}
|
|
584
|
+
else {
|
|
585
|
+
ctx.nextWord();
|
|
586
|
+
}
|
|
587
|
+
const right = parseAddition(ctx, error);
|
|
588
|
+
const target = assignTokenSpan(Node.Name('<'), opTok);
|
|
589
|
+
const call = Node.Call(target, [left, right]);
|
|
590
|
+
assignSpan(call, spanFromSources(left, opTok, right));
|
|
591
|
+
left = call;
|
|
592
|
+
}
|
|
593
|
+
else if (ctx.isKeyword(KW.GREATER_THAN) || ctx.isKeywordSeq(greaterThanParts)) {
|
|
594
|
+
const opTok = ctx.peek();
|
|
595
|
+
if (ctx.isKeywordSeq(greaterThanParts)) {
|
|
596
|
+
ctx.nextWords(greaterThanParts);
|
|
597
|
+
}
|
|
598
|
+
else {
|
|
599
|
+
ctx.nextWord();
|
|
600
|
+
}
|
|
601
|
+
const right = parseAddition(ctx, error);
|
|
602
|
+
const target = assignTokenSpan(Node.Name('>'), opTok);
|
|
603
|
+
const call = Node.Call(target, [left, right]);
|
|
604
|
+
assignSpan(call, spanFromSources(left, opTok, right));
|
|
605
|
+
left = call;
|
|
606
|
+
}
|
|
607
|
+
else if (ctx.isKeyword(KW.EQUALS_TO) || ctx.isKeywordSeq(equalsToParts)) {
|
|
608
|
+
const opTok = ctx.peek();
|
|
609
|
+
if (ctx.isKeywordSeq(equalsToParts)) {
|
|
610
|
+
ctx.nextWords(equalsToParts);
|
|
611
|
+
}
|
|
612
|
+
else {
|
|
613
|
+
ctx.nextWord();
|
|
614
|
+
}
|
|
615
|
+
const right = parseAddition(ctx, error);
|
|
616
|
+
const target = assignTokenSpan(Node.Name('=='), opTok);
|
|
617
|
+
const call = Node.Call(target, [left, right]);
|
|
618
|
+
assignSpan(call, spanFromSources(left, opTok, right));
|
|
619
|
+
left = call;
|
|
620
|
+
}
|
|
621
|
+
else if (ctx.isKeyword(KW.AT_LEAST) || ctx.isKeywordSeq(atLeastParts)) {
|
|
622
|
+
const opTok = ctx.peek();
|
|
623
|
+
if (ctx.isKeywordSeq(atLeastParts)) {
|
|
624
|
+
ctx.nextWords(atLeastParts);
|
|
625
|
+
}
|
|
626
|
+
else {
|
|
627
|
+
ctx.nextWord();
|
|
628
|
+
}
|
|
629
|
+
const right = parseAddition(ctx, error);
|
|
630
|
+
const target = assignTokenSpan(Node.Name('>='), opTok);
|
|
631
|
+
const call = Node.Call(target, [left, right]);
|
|
632
|
+
assignSpan(call, spanFromSources(left, opTok, right));
|
|
633
|
+
left = call;
|
|
634
|
+
}
|
|
635
|
+
else if (ctx.isKeyword(KW.AT_MOST) || ctx.isKeywordSeq(atMostParts)) {
|
|
636
|
+
const opTok = ctx.peek();
|
|
637
|
+
if (ctx.isKeywordSeq(atMostParts)) {
|
|
638
|
+
ctx.nextWords(atMostParts);
|
|
639
|
+
}
|
|
640
|
+
else {
|
|
641
|
+
ctx.nextWord();
|
|
642
|
+
}
|
|
643
|
+
const right = parseAddition(ctx, error);
|
|
644
|
+
const target = assignTokenSpan(Node.Name('<='), opTok);
|
|
645
|
+
const call = Node.Call(target, [left, right]);
|
|
646
|
+
assignSpan(call, spanFromSources(left, opTok, right));
|
|
647
|
+
left = call;
|
|
648
|
+
}
|
|
649
|
+
else {
|
|
650
|
+
more = false;
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
return left;
|
|
654
|
+
}
|
|
655
|
+
/**
|
|
656
|
+
* 解析加减法表达式
|
|
657
|
+
* @param ctx Parser 上下文
|
|
658
|
+
* @param error 错误报告函数
|
|
659
|
+
* @returns Expression 节点
|
|
660
|
+
*/
|
|
661
|
+
function parseAddition(ctx, error) {
|
|
662
|
+
let left = parseMultiplication(ctx, error);
|
|
663
|
+
let more = true;
|
|
664
|
+
while (more) {
|
|
665
|
+
if (ctx.isKeyword(KW.PLUS)) {
|
|
666
|
+
const opTok = ctx.nextWord();
|
|
667
|
+
const right = parseMultiplication(ctx, error);
|
|
668
|
+
const target = assignTokenSpan(Node.Name('+'), opTok);
|
|
669
|
+
const call = Node.Call(target, [left, right]);
|
|
670
|
+
assignSpan(call, spanFromSources(left, opTok, right));
|
|
671
|
+
left = call;
|
|
672
|
+
}
|
|
673
|
+
else if (ctx.isKeyword(KW.MINUS)) {
|
|
674
|
+
const opTok = ctx.nextWord();
|
|
675
|
+
const right = parseMultiplication(ctx, error);
|
|
676
|
+
const target = assignTokenSpan(Node.Name('-'), opTok);
|
|
677
|
+
const call = Node.Call(target, [left, right]);
|
|
678
|
+
assignSpan(call, spanFromSources(left, opTok, right));
|
|
679
|
+
left = call;
|
|
680
|
+
}
|
|
681
|
+
else {
|
|
682
|
+
more = false;
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
return left;
|
|
686
|
+
}
|
|
687
|
+
/**
|
|
688
|
+
* 解析乘除法表达式
|
|
689
|
+
* @param ctx Parser 上下文
|
|
690
|
+
* @param error 错误报告函数
|
|
691
|
+
* @returns Expression 节点
|
|
692
|
+
*/
|
|
693
|
+
function parseMultiplication(ctx, error) {
|
|
694
|
+
let left = parsePrimary(ctx, error);
|
|
695
|
+
const dividedByParts = kwParts(KW.DIVIDED_BY);
|
|
696
|
+
let more = true;
|
|
697
|
+
while (more) {
|
|
698
|
+
if (ctx.isKeyword(KW.TIMES)) {
|
|
699
|
+
const opTok = ctx.nextWord();
|
|
700
|
+
const right = parsePrimary(ctx, error);
|
|
701
|
+
const target = assignTokenSpan(Node.Name('*'), opTok);
|
|
702
|
+
const call = Node.Call(target, [left, right]);
|
|
703
|
+
assignSpan(call, spanFromSources(left, opTok, right));
|
|
704
|
+
left = call;
|
|
705
|
+
}
|
|
706
|
+
else if (ctx.isKeyword(KW.DIVIDED_BY) || ctx.isKeywordSeq(dividedByParts)) {
|
|
707
|
+
const opTok = ctx.peek();
|
|
708
|
+
if (ctx.isKeywordSeq(dividedByParts)) {
|
|
709
|
+
ctx.nextWords(dividedByParts);
|
|
710
|
+
}
|
|
711
|
+
else {
|
|
712
|
+
ctx.nextWord();
|
|
713
|
+
}
|
|
714
|
+
const right = parsePrimary(ctx, error);
|
|
715
|
+
const target = assignTokenSpan(Node.Name('/'), opTok);
|
|
716
|
+
const call = Node.Call(target, [left, right]);
|
|
717
|
+
assignSpan(call, spanFromSources(left, opTok, right));
|
|
718
|
+
left = call;
|
|
719
|
+
}
|
|
720
|
+
else {
|
|
721
|
+
more = false;
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
return left;
|
|
725
|
+
}
|
|
726
|
+
/**
|
|
727
|
+
* 解析基础表达式
|
|
728
|
+
* @param ctx Parser 上下文
|
|
729
|
+
* @param error 错误报告函数
|
|
730
|
+
* @returns Expression 节点
|
|
731
|
+
*/
|
|
732
|
+
function parsePrimary(ctx, error) {
|
|
733
|
+
// Minimal: construction, literals, names, Ok/Err/Some/None, call with dotted names and parens args
|
|
734
|
+
// Lambda (block form): 'a function' (or 'function') ... 'produce' Type ':' \n Block
|
|
735
|
+
if ((ctx.isKeyword('a') && tokLowerAt(ctx, ctx.index + 1) === 'function') || ctx.isKeyword('function')) {
|
|
736
|
+
const optionalATok = ctx.isKeyword('a') ? ctx.nextWord() : null; // optional 'a'
|
|
737
|
+
const functionTok = ctx.nextWord(); // 'function'
|
|
738
|
+
const params = parseParamList(ctx, error);
|
|
739
|
+
expectCommaOr(ctx);
|
|
740
|
+
expectKeyword(ctx, error, KW.PRODUCE, "Expected 'produce' and return type");
|
|
741
|
+
let retType;
|
|
742
|
+
if (ctx.at(TokenKind.COLON)) {
|
|
743
|
+
retType = Node.TypeName('Unknown');
|
|
744
|
+
assignSpan(retType, spanFromTokens(ctx.peek(), ctx.peek()));
|
|
745
|
+
}
|
|
746
|
+
else {
|
|
747
|
+
retType = parseType(ctx, error);
|
|
748
|
+
}
|
|
749
|
+
if (!ctx.at(TokenKind.COLON))
|
|
750
|
+
error("Expected ':' after return type in lambda");
|
|
751
|
+
ctx.next();
|
|
752
|
+
expectNewline(ctx, error);
|
|
753
|
+
const body = parseBlock(ctx, error);
|
|
754
|
+
const lambda = Node.Lambda(params, retType, body);
|
|
755
|
+
const lambdaEnd = lastConsumedToken(ctx);
|
|
756
|
+
const lambdaStart = optionalATok ?? functionTok;
|
|
757
|
+
assignSpan(lambda, spanFromTokens(lambdaStart, lambdaEnd));
|
|
758
|
+
return lambda;
|
|
759
|
+
}
|
|
760
|
+
// Lambda (short form): (x: Text, y: Int) => expr
|
|
761
|
+
if (ctx.at(TokenKind.LPAREN)) {
|
|
762
|
+
const save = ctx.index;
|
|
763
|
+
const lparenTok = ctx.peek();
|
|
764
|
+
try {
|
|
765
|
+
ctx.next(); // consume '('
|
|
766
|
+
const params = [];
|
|
767
|
+
let first = true;
|
|
768
|
+
while (!ctx.at(TokenKind.RPAREN)) {
|
|
769
|
+
if (!first) {
|
|
770
|
+
if (ctx.at(TokenKind.COMMA)) {
|
|
771
|
+
ctx.next();
|
|
772
|
+
}
|
|
773
|
+
else {
|
|
774
|
+
throw new Error('comma');
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
const nameTok = ctx.peek();
|
|
778
|
+
const pname = parseIdent(ctx, error);
|
|
779
|
+
let ptype;
|
|
780
|
+
let colonTok;
|
|
781
|
+
let typeInferred = false;
|
|
782
|
+
if (ctx.at(TokenKind.COLON)) {
|
|
783
|
+
colonTok = ctx.next();
|
|
784
|
+
ptype = parseType(ctx, error);
|
|
785
|
+
}
|
|
786
|
+
else {
|
|
787
|
+
typeInferred = true;
|
|
788
|
+
ptype = inferFieldType(pname);
|
|
789
|
+
assignSpan(ptype, spanFromTokens(nameTok, nameTok));
|
|
790
|
+
}
|
|
791
|
+
const param = {
|
|
792
|
+
name: pname,
|
|
793
|
+
type: ptype,
|
|
794
|
+
...(typeInferred ? { typeInferred: true } : {}),
|
|
795
|
+
span: colonTok
|
|
796
|
+
? spanFromSources(nameTok, colonTok, ptype)
|
|
797
|
+
: spanFromSources(nameTok, ptype),
|
|
798
|
+
};
|
|
799
|
+
params.push(param);
|
|
800
|
+
first = false;
|
|
801
|
+
}
|
|
802
|
+
const rparenTok = ctx.peek();
|
|
803
|
+
ctx.next(); // consume ')'
|
|
804
|
+
if (!(ctx.at(TokenKind.EQUALS) && ctx.tokens[ctx.index + 1] && ctx.tokens[ctx.index + 1].kind === TokenKind.GT)) {
|
|
805
|
+
throw new Error('arrow');
|
|
806
|
+
}
|
|
807
|
+
const eqTok = ctx.next(); // '='
|
|
808
|
+
const gtTok = ctx.next(); // '>'
|
|
809
|
+
// Expression body; infer return type when possible
|
|
810
|
+
const bodyExpr = parseExpr(ctx, error);
|
|
811
|
+
const returnNode = Node.Return(bodyExpr);
|
|
812
|
+
assignSpanFromSources(returnNode, bodyExpr);
|
|
813
|
+
const body = Node.Block([returnNode]);
|
|
814
|
+
assignSpanFromSources(body, bodyExpr);
|
|
815
|
+
const retType = inferLambdaReturnType(bodyExpr);
|
|
816
|
+
const lambda = Node.Lambda(params, retType, body);
|
|
817
|
+
assignSpan(lambda, spanFromSources(lparenTok, rparenTok, eqTok, gtTok, body));
|
|
818
|
+
return lambda;
|
|
819
|
+
}
|
|
820
|
+
catch {
|
|
821
|
+
// rewind and treat as parenthesized expression
|
|
822
|
+
ctx.index = save;
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
if (ctx.isKeywordSeq(KW.OK_OF)) {
|
|
826
|
+
const tokens = kwParts(KW.OK_OF).map(() => ctx.nextWord());
|
|
827
|
+
const expr = parseExpr(ctx, error);
|
|
828
|
+
const node = Node.Ok(expr);
|
|
829
|
+
assignSpanFromSources(node, tokens[0], expr);
|
|
830
|
+
return node;
|
|
831
|
+
}
|
|
832
|
+
if (ctx.isKeywordSeq(KW.ERR_OF)) {
|
|
833
|
+
const tokens = kwParts(KW.ERR_OF).map(() => ctx.nextWord());
|
|
834
|
+
const expr = parseExpr(ctx, error);
|
|
835
|
+
const node = Node.Err(expr);
|
|
836
|
+
assignSpanFromSources(node, tokens[0], expr);
|
|
837
|
+
return node;
|
|
838
|
+
}
|
|
839
|
+
if (ctx.isKeywordSeq(KW.SOME_OF)) {
|
|
840
|
+
const tokens = kwParts(KW.SOME_OF).map(() => ctx.nextWord());
|
|
841
|
+
const expr = parseExpr(ctx, error);
|
|
842
|
+
const node = Node.Some(expr);
|
|
843
|
+
assignSpanFromSources(node, tokens[0], expr);
|
|
844
|
+
return node;
|
|
845
|
+
}
|
|
846
|
+
if (ctx.isKeyword(KW.NONE)) {
|
|
847
|
+
const tok = ctx.nextWord();
|
|
848
|
+
const node = Node.None();
|
|
849
|
+
assignSpan(node, spanFromToken(tok));
|
|
850
|
+
return node;
|
|
851
|
+
}
|
|
852
|
+
if (ctx.at(TokenKind.STRING)) {
|
|
853
|
+
const tok = ctx.next();
|
|
854
|
+
const node = Node.String(tok.value);
|
|
855
|
+
assignSpan(node, spanFromToken(tok));
|
|
856
|
+
return node;
|
|
857
|
+
}
|
|
858
|
+
if (ctx.at(TokenKind.BOOL)) {
|
|
859
|
+
const tok = ctx.next();
|
|
860
|
+
const node = Node.Bool(tok.value);
|
|
861
|
+
assignSpan(node, spanFromToken(tok));
|
|
862
|
+
return node;
|
|
863
|
+
}
|
|
864
|
+
if (ctx.isKeyword(KW.NULL)) {
|
|
865
|
+
const tok = ctx.nextWord();
|
|
866
|
+
const node = Node.Null();
|
|
867
|
+
assignSpan(node, spanFromToken(tok));
|
|
868
|
+
return node;
|
|
869
|
+
}
|
|
870
|
+
if (ctx.at(TokenKind.NULL)) {
|
|
871
|
+
const tok = ctx.next();
|
|
872
|
+
const node = Node.Null();
|
|
873
|
+
assignSpan(node, spanFromToken(tok));
|
|
874
|
+
return node;
|
|
875
|
+
}
|
|
876
|
+
if (ctx.at(TokenKind.INT)) {
|
|
877
|
+
const tok = ctx.next();
|
|
878
|
+
const node = Node.Int(tok.value);
|
|
879
|
+
assignSpan(node, spanFromToken(tok));
|
|
880
|
+
return node;
|
|
881
|
+
}
|
|
882
|
+
if (ctx.at(TokenKind.LONG)) {
|
|
883
|
+
const tok = ctx.next();
|
|
884
|
+
const node = Node.Long(tok.value);
|
|
885
|
+
assignSpan(node, spanFromToken(tok));
|
|
886
|
+
return node;
|
|
887
|
+
}
|
|
888
|
+
if (ctx.at(TokenKind.FLOAT)) {
|
|
889
|
+
const tok = ctx.next();
|
|
890
|
+
const node = Node.Double(tok.value);
|
|
891
|
+
assignSpan(node, spanFromToken(tok));
|
|
892
|
+
return node;
|
|
893
|
+
}
|
|
894
|
+
if (ctx.isKeyword(KW.AWAIT)) {
|
|
895
|
+
const awaitTok = ctx.nextWord();
|
|
896
|
+
const args = parseArgList(ctx, error);
|
|
897
|
+
if (args.length !== 1)
|
|
898
|
+
error('await(expr) takes exactly one argument');
|
|
899
|
+
const target = assignTokenSpan(Node.Name('await'), awaitTok);
|
|
900
|
+
const call = Node.Call(target, args);
|
|
901
|
+
const endTok = lastConsumedToken(ctx);
|
|
902
|
+
assignSpan(call, spanFromSources(awaitTok, endTok));
|
|
903
|
+
return call;
|
|
904
|
+
}
|
|
905
|
+
// Parenthesized expressions
|
|
906
|
+
if (ctx.at(TokenKind.LPAREN)) {
|
|
907
|
+
const lparenTok = ctx.next();
|
|
908
|
+
const expr = parseExpr(ctx, error);
|
|
909
|
+
if (!ctx.at(TokenKind.RPAREN))
|
|
910
|
+
error("Expected ')' after expression");
|
|
911
|
+
const rparenTok = ctx.next();
|
|
912
|
+
assignSpanFromSources(expr, lparenTok, rparenTok, expr);
|
|
913
|
+
return expr;
|
|
914
|
+
}
|
|
915
|
+
// Construction: Type with a = expr and b = expr
|
|
916
|
+
if (ctx.at(TokenKind.TYPE_IDENT)) {
|
|
917
|
+
const typeTok = ctx.next();
|
|
918
|
+
const typeName = typeTok.value;
|
|
919
|
+
if (ctx.isKeyword(KW.WITH)) {
|
|
920
|
+
const withTok = ctx.nextWord();
|
|
921
|
+
const fields = [];
|
|
922
|
+
let hasMore = true;
|
|
923
|
+
while (hasMore) {
|
|
924
|
+
const nameTok = ctx.peek();
|
|
925
|
+
const name = parseIdent(ctx, error);
|
|
926
|
+
if (!ctx.at(TokenKind.EQUALS))
|
|
927
|
+
error("Expected '=' in construction");
|
|
928
|
+
const equalsTok = ctx.peek();
|
|
929
|
+
ctx.next();
|
|
930
|
+
const e = parseExpr(ctx, error);
|
|
931
|
+
const fld = {
|
|
932
|
+
name,
|
|
933
|
+
expr: e,
|
|
934
|
+
span: spanFromSources(nameTok, equalsTok, e),
|
|
935
|
+
};
|
|
936
|
+
fields.push(fld);
|
|
937
|
+
if (ctx.isKeyword(KW.AND)) {
|
|
938
|
+
ctx.nextWord();
|
|
939
|
+
continue;
|
|
940
|
+
}
|
|
941
|
+
if (ctx.at(TokenKind.COMMA)) {
|
|
942
|
+
ctx.next();
|
|
943
|
+
continue;
|
|
944
|
+
}
|
|
945
|
+
hasMore = false;
|
|
946
|
+
}
|
|
947
|
+
const constructNode = Node.Construct(typeName, fields);
|
|
948
|
+
const endTok = lastConsumedToken(ctx);
|
|
949
|
+
assignSpan(constructNode, spanFromSources(typeTok, withTok, endTok));
|
|
950
|
+
return constructNode;
|
|
951
|
+
}
|
|
952
|
+
// Dotted chain after TypeIdent (e.g., AuthRepo.verify)
|
|
953
|
+
let full = typeName;
|
|
954
|
+
const consumedTokens = [typeTok];
|
|
955
|
+
while (ctx.at(TokenKind.DOT) &&
|
|
956
|
+
ctx.tokens[ctx.index + 1] &&
|
|
957
|
+
(ctx.tokens[ctx.index + 1].kind === TokenKind.IDENT || ctx.tokens[ctx.index + 1].kind === TokenKind.TYPE_IDENT)) {
|
|
958
|
+
const dotTok = ctx.next();
|
|
959
|
+
consumedTokens.push(dotTok);
|
|
960
|
+
if (ctx.at(TokenKind.IDENT)) {
|
|
961
|
+
const partTok = ctx.peek();
|
|
962
|
+
const part = parseIdent(ctx, error);
|
|
963
|
+
consumedTokens.push(partTok);
|
|
964
|
+
full += '.' + part;
|
|
965
|
+
}
|
|
966
|
+
else if (ctx.at(TokenKind.TYPE_IDENT)) {
|
|
967
|
+
const partTok = ctx.next();
|
|
968
|
+
consumedTokens.push(partTok);
|
|
969
|
+
full += '.' + partTok.value;
|
|
970
|
+
}
|
|
971
|
+
else {
|
|
972
|
+
error('Expected identifier after dot');
|
|
973
|
+
}
|
|
974
|
+
}
|
|
975
|
+
const target = Node.Name(full);
|
|
976
|
+
assignSpan(target, spanFromSources(...consumedTokens));
|
|
977
|
+
if (ctx.at(TokenKind.LPAREN)) {
|
|
978
|
+
const args = parseArgList(ctx, error);
|
|
979
|
+
const call = Node.Call(target, args);
|
|
980
|
+
const endTok = lastConsumedToken(ctx);
|
|
981
|
+
assignSpan(call, spanFromSources(target, endTok));
|
|
982
|
+
return call;
|
|
983
|
+
}
|
|
984
|
+
return target;
|
|
985
|
+
}
|
|
986
|
+
if (ctx.at(TokenKind.IDENT)) {
|
|
987
|
+
const nameTok = ctx.peek();
|
|
988
|
+
const name = parseIdent(ctx, error);
|
|
989
|
+
// dotted chain
|
|
990
|
+
let full = name;
|
|
991
|
+
const consumedTokens = [nameTok];
|
|
992
|
+
while (ctx.at(TokenKind.DOT) &&
|
|
993
|
+
ctx.tokens[ctx.index + 1] &&
|
|
994
|
+
(ctx.tokens[ctx.index + 1].kind === TokenKind.IDENT || ctx.tokens[ctx.index + 1].kind === TokenKind.TYPE_IDENT)) {
|
|
995
|
+
const dotTok = ctx.next();
|
|
996
|
+
consumedTokens.push(dotTok);
|
|
997
|
+
if (ctx.at(TokenKind.IDENT)) {
|
|
998
|
+
const partTok = ctx.peek();
|
|
999
|
+
full += '.' + parseIdent(ctx, error);
|
|
1000
|
+
consumedTokens.push(partTok);
|
|
1001
|
+
}
|
|
1002
|
+
else if (ctx.at(TokenKind.TYPE_IDENT)) {
|
|
1003
|
+
const partTok = ctx.next();
|
|
1004
|
+
full += '.' + partTok.value;
|
|
1005
|
+
consumedTokens.push(partTok);
|
|
1006
|
+
}
|
|
1007
|
+
}
|
|
1008
|
+
const target = Node.Name(full);
|
|
1009
|
+
assignSpan(target, spanFromSources(...consumedTokens));
|
|
1010
|
+
if (ctx.at(TokenKind.LPAREN)) {
|
|
1011
|
+
const args = parseArgList(ctx, error);
|
|
1012
|
+
const call = Node.Call(target, args);
|
|
1013
|
+
const endTok = lastConsumedToken(ctx);
|
|
1014
|
+
assignSpan(call, spanFromSources(target, endTok));
|
|
1015
|
+
return call;
|
|
1016
|
+
}
|
|
1017
|
+
return target;
|
|
1018
|
+
}
|
|
1019
|
+
error('Unexpected expression');
|
|
1020
|
+
}
|
|
1021
|
+
/**
|
|
1022
|
+
* 解析参数列表
|
|
1023
|
+
* @param ctx Parser 上下文
|
|
1024
|
+
* @param error 错误报告函数
|
|
1025
|
+
* @returns Expression 数组
|
|
1026
|
+
*/
|
|
1027
|
+
export function parseArgList(ctx, error) {
|
|
1028
|
+
if (!ctx.at(TokenKind.LPAREN))
|
|
1029
|
+
error("Expected '('");
|
|
1030
|
+
ctx.next();
|
|
1031
|
+
const args = [];
|
|
1032
|
+
while (!ctx.at(TokenKind.RPAREN)) {
|
|
1033
|
+
args.push(parseExpr(ctx, error));
|
|
1034
|
+
if (ctx.at(TokenKind.COMMA)) {
|
|
1035
|
+
ctx.next();
|
|
1036
|
+
continue;
|
|
1037
|
+
}
|
|
1038
|
+
else
|
|
1039
|
+
break;
|
|
1040
|
+
}
|
|
1041
|
+
if (!ctx.at(TokenKind.RPAREN))
|
|
1042
|
+
error("Expected ')'");
|
|
1043
|
+
ctx.next();
|
|
1044
|
+
return args;
|
|
1045
|
+
}
|
|
1046
|
+
/**
|
|
1047
|
+
* 解析模式(Pattern)
|
|
1048
|
+
* @param ctx Parser 上下文
|
|
1049
|
+
* @param error 错误报告函数
|
|
1050
|
+
* @returns Pattern 节点
|
|
1051
|
+
*/
|
|
1052
|
+
export function parsePattern(ctx, error) {
|
|
1053
|
+
if (ctx.isKeyword(KW.NULL) || ctx.at(TokenKind.NULL)) {
|
|
1054
|
+
const tok = ctx.at(TokenKind.NULL) ? ctx.next() : ctx.nextWord();
|
|
1055
|
+
const node = Node.PatternNull();
|
|
1056
|
+
assignSpan(node, spanFromToken(tok));
|
|
1057
|
+
return node;
|
|
1058
|
+
}
|
|
1059
|
+
if (ctx.at(TokenKind.INT)) {
|
|
1060
|
+
const tok = ctx.next();
|
|
1061
|
+
const node = Node.PatternInt(tok.value);
|
|
1062
|
+
assignSpan(node, spanFromToken(tok));
|
|
1063
|
+
return node;
|
|
1064
|
+
}
|
|
1065
|
+
if (ctx.at(TokenKind.TYPE_IDENT)) {
|
|
1066
|
+
const typeTok = ctx.next();
|
|
1067
|
+
const typeName = typeTok.value;
|
|
1068
|
+
if (ctx.at(TokenKind.LPAREN)) {
|
|
1069
|
+
const lparenTok = ctx.next();
|
|
1070
|
+
const names = [];
|
|
1071
|
+
const nameTokens = [];
|
|
1072
|
+
while (!ctx.at(TokenKind.RPAREN)) {
|
|
1073
|
+
const nameTok = ctx.peek();
|
|
1074
|
+
names.push(parseIdent(ctx, error));
|
|
1075
|
+
nameTokens.push(nameTok);
|
|
1076
|
+
if (ctx.at(TokenKind.COMMA)) {
|
|
1077
|
+
ctx.next();
|
|
1078
|
+
continue;
|
|
1079
|
+
}
|
|
1080
|
+
else
|
|
1081
|
+
break;
|
|
1082
|
+
}
|
|
1083
|
+
if (!ctx.at(TokenKind.RPAREN))
|
|
1084
|
+
error("Expected ')' in pattern");
|
|
1085
|
+
const rparenTok = ctx.next();
|
|
1086
|
+
const node = Node.PatternCtor(typeName, names);
|
|
1087
|
+
assignSpan(node, spanFromSources(typeTok, lparenTok, rparenTok, ...nameTokens));
|
|
1088
|
+
return node;
|
|
1089
|
+
}
|
|
1090
|
+
// No LPAREN: treat bare TypeIdent as a variant name pattern (enum member)
|
|
1091
|
+
const node = Node.PatternName(typeName);
|
|
1092
|
+
assignSpan(node, spanFromToken(typeTok));
|
|
1093
|
+
return node;
|
|
1094
|
+
}
|
|
1095
|
+
const nameTok = ctx.peek();
|
|
1096
|
+
const name = parseIdent(ctx, error);
|
|
1097
|
+
const node = Node.PatternName(name);
|
|
1098
|
+
assignSpan(node, spanFromToken(nameTok));
|
|
1099
|
+
return node;
|
|
1100
|
+
}
|
|
1101
|
+
/**
|
|
1102
|
+
* 解析参数列表(函数声明)
|
|
1103
|
+
* @param ctx Parser 上下文
|
|
1104
|
+
* @param error 错误报告函数
|
|
1105
|
+
* @returns Parameter 数组
|
|
1106
|
+
*/
|
|
1107
|
+
export function parseParamList(ctx, error) {
|
|
1108
|
+
const params = [];
|
|
1109
|
+
// 'with' params
|
|
1110
|
+
if (ctx.isKeyword(KW.WITH)) {
|
|
1111
|
+
ctx.nextWord();
|
|
1112
|
+
let hasMore = true;
|
|
1113
|
+
while (hasMore) {
|
|
1114
|
+
// 在开始解析参数前,先消费换行和缩进,支持多行格式
|
|
1115
|
+
ctx.consumeNewlines();
|
|
1116
|
+
ctx.consumeIndent();
|
|
1117
|
+
const nameTok = ctx.peek();
|
|
1118
|
+
const name = parseIdent(ctx, error);
|
|
1119
|
+
let type;
|
|
1120
|
+
let colonTok;
|
|
1121
|
+
let typeInferred = false;
|
|
1122
|
+
if (ctx.at(TokenKind.COLON)) {
|
|
1123
|
+
colonTok = ctx.next();
|
|
1124
|
+
type = parseType(ctx, error);
|
|
1125
|
+
}
|
|
1126
|
+
else {
|
|
1127
|
+
typeInferred = true;
|
|
1128
|
+
type = inferFieldType(name);
|
|
1129
|
+
assignSpan(type, spanFromTokens(nameTok, nameTok));
|
|
1130
|
+
}
|
|
1131
|
+
// 解析可选的约束列表(在类型之后)
|
|
1132
|
+
const { constraints, lastToken: constraintEndToken } = parseConstraints(ctx, error);
|
|
1133
|
+
if (typeInferred && constraints.length > 0) {
|
|
1134
|
+
type = refineInferredType(type, constraints);
|
|
1135
|
+
assignSpan(type, spanFromTokens(nameTok, nameTok));
|
|
1136
|
+
}
|
|
1137
|
+
const spanEnd = constraintEndToken || type;
|
|
1138
|
+
const paramSpan = colonTok
|
|
1139
|
+
? spanFromSources(nameTok, colonTok, spanEnd)
|
|
1140
|
+
: spanFromSources(nameTok, spanEnd);
|
|
1141
|
+
const param = constraints.length > 0
|
|
1142
|
+
? { name, type, constraints, ...(typeInferred ? { typeInferred: true } : {}), span: paramSpan }
|
|
1143
|
+
: { name, type, ...(typeInferred ? { typeInferred: true } : {}), span: paramSpan };
|
|
1144
|
+
params.push(param);
|
|
1145
|
+
if (ctx.at(TokenKind.IDENT) && (ctx.peek().value || '').toLowerCase() === KW.AND) {
|
|
1146
|
+
ctx.nextWord();
|
|
1147
|
+
// 'and' 后允许换行和缩进
|
|
1148
|
+
ctx.consumeNewlines();
|
|
1149
|
+
ctx.consumeIndent();
|
|
1150
|
+
continue;
|
|
1151
|
+
}
|
|
1152
|
+
if (ctx.at(TokenKind.COMMA)) {
|
|
1153
|
+
ctx.next();
|
|
1154
|
+
// 逗号后允许换行
|
|
1155
|
+
ctx.consumeNewlines();
|
|
1156
|
+
const after = peekKeywordIgnoringLayout(ctx);
|
|
1157
|
+
if (after === KW.PRODUCE) {
|
|
1158
|
+
hasMore = false;
|
|
1159
|
+
}
|
|
1160
|
+
else {
|
|
1161
|
+
// 不是 'produce',继续解析参数(可能有 INDENT 表示增加了缩进)
|
|
1162
|
+
ctx.consumeIndent();
|
|
1163
|
+
continue;
|
|
1164
|
+
}
|
|
1165
|
+
}
|
|
1166
|
+
else {
|
|
1167
|
+
hasMore = false;
|
|
1168
|
+
}
|
|
1169
|
+
}
|
|
1170
|
+
return params;
|
|
1171
|
+
}
|
|
1172
|
+
// Bare params: name: Type [constraints] [(and|,) name: Type [constraints]]*
|
|
1173
|
+
if (ctx.at(TokenKind.IDENT) && ctx.tokens[ctx.index + 1] && ctx.tokens[ctx.index + 1].kind === TokenKind.COLON) {
|
|
1174
|
+
let hasMore = true;
|
|
1175
|
+
while (hasMore) {
|
|
1176
|
+
// 在开始解析参数前,先消费换行和缩进,支持多行格式
|
|
1177
|
+
ctx.consumeNewlines();
|
|
1178
|
+
ctx.consumeIndent();
|
|
1179
|
+
const nameTok = ctx.peek();
|
|
1180
|
+
const name = parseIdent(ctx, error);
|
|
1181
|
+
let type;
|
|
1182
|
+
let colonTok;
|
|
1183
|
+
let typeInferred = false;
|
|
1184
|
+
if (ctx.at(TokenKind.COLON)) {
|
|
1185
|
+
colonTok = ctx.next();
|
|
1186
|
+
type = parseType(ctx, error);
|
|
1187
|
+
}
|
|
1188
|
+
else {
|
|
1189
|
+
typeInferred = true;
|
|
1190
|
+
type = inferFieldType(name);
|
|
1191
|
+
assignSpan(type, spanFromTokens(nameTok, nameTok));
|
|
1192
|
+
}
|
|
1193
|
+
// 解析可选的约束列表(在类型之后)
|
|
1194
|
+
const { constraints, lastToken: constraintEndToken } = parseConstraints(ctx, error);
|
|
1195
|
+
if (typeInferred && constraints.length > 0) {
|
|
1196
|
+
type = refineInferredType(type, constraints);
|
|
1197
|
+
assignSpan(type, spanFromTokens(nameTok, nameTok));
|
|
1198
|
+
}
|
|
1199
|
+
const spanEnd = constraintEndToken || type;
|
|
1200
|
+
const paramSpan = colonTok
|
|
1201
|
+
? spanFromSources(nameTok, colonTok, spanEnd)
|
|
1202
|
+
: spanFromSources(nameTok, spanEnd);
|
|
1203
|
+
const param = constraints.length > 0
|
|
1204
|
+
? { name, type, constraints, ...(typeInferred ? { typeInferred: true } : {}), span: paramSpan }
|
|
1205
|
+
: { name, type, ...(typeInferred ? { typeInferred: true } : {}), span: paramSpan };
|
|
1206
|
+
params.push(param);
|
|
1207
|
+
// Accept 'and' or ',' between parameters
|
|
1208
|
+
if (ctx.at(TokenKind.IDENT) && (ctx.peek().value || '').toLowerCase() === KW.AND) {
|
|
1209
|
+
ctx.nextWord();
|
|
1210
|
+
// 'and' 后允许换行和缩进
|
|
1211
|
+
ctx.consumeNewlines();
|
|
1212
|
+
ctx.consumeIndent();
|
|
1213
|
+
continue;
|
|
1214
|
+
}
|
|
1215
|
+
if (ctx.at(TokenKind.COMMA)) {
|
|
1216
|
+
ctx.next();
|
|
1217
|
+
// 逗号后允许换行
|
|
1218
|
+
ctx.consumeNewlines();
|
|
1219
|
+
const after = peekKeywordIgnoringLayout(ctx);
|
|
1220
|
+
if (after === KW.PRODUCE || after === KW.WITH) {
|
|
1221
|
+
hasMore = false;
|
|
1222
|
+
}
|
|
1223
|
+
else {
|
|
1224
|
+
// 不是终止关键字,继续解析参数
|
|
1225
|
+
ctx.consumeIndent();
|
|
1226
|
+
continue;
|
|
1227
|
+
}
|
|
1228
|
+
}
|
|
1229
|
+
else {
|
|
1230
|
+
hasMore = false;
|
|
1231
|
+
}
|
|
1232
|
+
}
|
|
1233
|
+
}
|
|
1234
|
+
return params;
|
|
1235
|
+
}
|
|
1236
|
+
/**
|
|
1237
|
+
* 推断 Lambda 返回类型(用于短形式 Lambda)
|
|
1238
|
+
* @param e Expression
|
|
1239
|
+
* @returns Type
|
|
1240
|
+
*/
|
|
1241
|
+
export function inferLambdaReturnType(e) {
|
|
1242
|
+
const attachSpan = (node) => {
|
|
1243
|
+
assignSpan(node, cloneSpan(e.span));
|
|
1244
|
+
return node;
|
|
1245
|
+
};
|
|
1246
|
+
switch (e.kind) {
|
|
1247
|
+
case 'String':
|
|
1248
|
+
return attachSpan(Node.TypeName('Text'));
|
|
1249
|
+
case 'Int':
|
|
1250
|
+
return attachSpan(Node.TypeName('Int'));
|
|
1251
|
+
case 'Bool':
|
|
1252
|
+
return attachSpan(Node.TypeName('Bool'));
|
|
1253
|
+
case 'Call': {
|
|
1254
|
+
if (e.target.kind === 'Name') {
|
|
1255
|
+
const n = e.target.name;
|
|
1256
|
+
if (n === 'Text.concat')
|
|
1257
|
+
return attachSpan(Node.TypeName('Text'));
|
|
1258
|
+
if (n === 'Text.length')
|
|
1259
|
+
return attachSpan(Node.TypeName('Int'));
|
|
1260
|
+
if (n === '+')
|
|
1261
|
+
return attachSpan(Node.TypeName('Int'));
|
|
1262
|
+
if (n === 'not')
|
|
1263
|
+
return attachSpan(Node.TypeName('Bool'));
|
|
1264
|
+
if (n === '<' || n === '>' || n === '<=' || n === '>=' || n === '==' || n === '!=')
|
|
1265
|
+
return attachSpan(Node.TypeName('Bool'));
|
|
1266
|
+
}
|
|
1267
|
+
return attachSpan(Node.TypeName('Unknown'));
|
|
1268
|
+
}
|
|
1269
|
+
default:
|
|
1270
|
+
return attachSpan(Node.TypeName('Unknown'));
|
|
1271
|
+
}
|
|
1272
|
+
}
|
|
1273
|
+
// ===== 辅助函数 =====
|
|
1274
|
+
/**
|
|
1275
|
+
* 解析标识符
|
|
1276
|
+
* @param ctx Parser 上下文
|
|
1277
|
+
* @param error 错误报告函数
|
|
1278
|
+
* @returns 标识符字符串
|
|
1279
|
+
*/
|
|
1280
|
+
function parseIdent(ctx, error) {
|
|
1281
|
+
if (!ctx.at(TokenKind.IDENT)) {
|
|
1282
|
+
error('Expected identifier');
|
|
1283
|
+
}
|
|
1284
|
+
return ctx.next().value;
|
|
1285
|
+
}
|
|
1286
|
+
/**
|
|
1287
|
+
* 期望关键字
|
|
1288
|
+
* @param ctx Parser 上下文
|
|
1289
|
+
* @param error 错误报告函数
|
|
1290
|
+
* @param kw 关键字
|
|
1291
|
+
* @param msg 错误消息
|
|
1292
|
+
*/
|
|
1293
|
+
function expectKeyword(ctx, error, kw, msg) {
|
|
1294
|
+
if (!ctx.isKeyword(kw))
|
|
1295
|
+
error(msg);
|
|
1296
|
+
ctx.nextWord();
|
|
1297
|
+
}
|
|
1298
|
+
/**
|
|
1299
|
+
* 期望逗号或允许省略
|
|
1300
|
+
* @param ctx Parser 上下文
|
|
1301
|
+
*/
|
|
1302
|
+
function expectCommaOr(ctx) {
|
|
1303
|
+
if (ctx.at(TokenKind.COMMA)) {
|
|
1304
|
+
ctx.next();
|
|
1305
|
+
}
|
|
1306
|
+
}
|
|
1307
|
+
/**
|
|
1308
|
+
* 期望换行符
|
|
1309
|
+
* @param ctx Parser 上下文
|
|
1310
|
+
* @param error 错误报告函数
|
|
1311
|
+
*/
|
|
1312
|
+
function expectNewline(ctx, error) {
|
|
1313
|
+
if (!ctx.at(TokenKind.NEWLINE))
|
|
1314
|
+
error('Expected newline');
|
|
1315
|
+
ctx.next();
|
|
1316
|
+
}
|
|
1317
|
+
//# sourceMappingURL=expr-stmt-parser.js.map
|