driftdetect-core 0.7.1 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/boundaries/types.d.ts +1 -1
- package/dist/boundaries/types.d.ts.map +1 -1
- package/dist/call-graph/analysis/graph-builder.d.ts.map +1 -1
- package/dist/call-graph/analysis/graph-builder.js +2 -0
- package/dist/call-graph/analysis/graph-builder.js.map +1 -1
- package/dist/call-graph/extractors/cpp-data-access-extractor.d.ts +37 -0
- package/dist/call-graph/extractors/cpp-data-access-extractor.d.ts.map +1 -0
- package/dist/call-graph/extractors/cpp-data-access-extractor.js +467 -0
- package/dist/call-graph/extractors/cpp-data-access-extractor.js.map +1 -0
- package/dist/call-graph/extractors/cpp-hybrid-extractor.d.ts +89 -0
- package/dist/call-graph/extractors/cpp-hybrid-extractor.d.ts.map +1 -0
- package/dist/call-graph/extractors/cpp-hybrid-extractor.js +541 -0
- package/dist/call-graph/extractors/cpp-hybrid-extractor.js.map +1 -0
- package/dist/call-graph/extractors/index.d.ts +8 -1
- package/dist/call-graph/extractors/index.d.ts.map +1 -1
- package/dist/call-graph/extractors/index.js +9 -1
- package/dist/call-graph/extractors/index.js.map +1 -1
- package/dist/call-graph/extractors/regex/cpp-regex.d.ts +46 -0
- package/dist/call-graph/extractors/regex/cpp-regex.d.ts.map +1 -0
- package/dist/call-graph/extractors/regex/cpp-regex.js +325 -0
- package/dist/call-graph/extractors/regex/cpp-regex.js.map +1 -0
- package/dist/call-graph/extractors/regex/index.d.ts +2 -0
- package/dist/call-graph/extractors/regex/index.d.ts.map +1 -1
- package/dist/call-graph/extractors/regex/index.js +16 -0
- package/dist/call-graph/extractors/regex/index.js.map +1 -1
- package/dist/call-graph/extractors/regex/rust-regex.d.ts +45 -0
- package/dist/call-graph/extractors/regex/rust-regex.d.ts.map +1 -0
- package/dist/call-graph/extractors/regex/rust-regex.js +517 -0
- package/dist/call-graph/extractors/regex/rust-regex.js.map +1 -0
- package/dist/call-graph/extractors/rust-data-access-extractor.d.ts +35 -0
- package/dist/call-graph/extractors/rust-data-access-extractor.d.ts.map +1 -0
- package/dist/call-graph/extractors/rust-data-access-extractor.js +349 -0
- package/dist/call-graph/extractors/rust-data-access-extractor.js.map +1 -0
- package/dist/call-graph/extractors/rust-extractor.d.ts +125 -0
- package/dist/call-graph/extractors/rust-extractor.d.ts.map +1 -0
- package/dist/call-graph/extractors/rust-extractor.js +604 -0
- package/dist/call-graph/extractors/rust-extractor.js.map +1 -0
- package/dist/call-graph/extractors/rust-hybrid-extractor.d.ts +119 -0
- package/dist/call-graph/extractors/rust-hybrid-extractor.d.ts.map +1 -0
- package/dist/call-graph/extractors/rust-hybrid-extractor.js +548 -0
- package/dist/call-graph/extractors/rust-hybrid-extractor.js.map +1 -0
- package/dist/call-graph/index.d.ts +2 -0
- package/dist/call-graph/index.d.ts.map +1 -1
- package/dist/call-graph/index.js +4 -0
- package/dist/call-graph/index.js.map +1 -1
- package/dist/call-graph/streaming-builder.d.ts +60 -0
- package/dist/call-graph/streaming-builder.d.ts.map +1 -0
- package/dist/call-graph/streaming-builder.js +204 -0
- package/dist/call-graph/streaming-builder.js.map +1 -0
- package/dist/call-graph/types.d.ts +1 -1
- package/dist/call-graph/types.d.ts.map +1 -1
- package/dist/call-graph/unified-provider.d.ts +72 -0
- package/dist/call-graph/unified-provider.d.ts.map +1 -0
- package/dist/call-graph/unified-provider.js +502 -0
- package/dist/call-graph/unified-provider.js.map +1 -0
- package/dist/constants/extractors/regex/rust-regex.d.ts +43 -0
- package/dist/constants/extractors/regex/rust-regex.d.ts.map +1 -0
- package/dist/constants/extractors/regex/rust-regex.js +370 -0
- package/dist/constants/extractors/regex/rust-regex.js.map +1 -0
- package/dist/constants/types.d.ts +1 -1
- package/dist/constants/types.d.ts.map +1 -1
- package/dist/constants/types.js.map +1 -1
- package/dist/constraints/store/constraint-store.d.ts.map +1 -1
- package/dist/constraints/store/constraint-store.js +2 -0
- package/dist/constraints/store/constraint-store.js.map +1 -1
- package/dist/constraints/types.d.ts +1 -1
- package/dist/constraints/types.d.ts.map +1 -1
- package/dist/constraints/types.js +2 -0
- package/dist/constraints/types.js.map +1 -1
- package/dist/context/context-generator.d.ts +38 -0
- package/dist/context/context-generator.d.ts.map +1 -0
- package/dist/context/context-generator.js +392 -0
- package/dist/context/context-generator.js.map +1 -0
- package/dist/context/index.d.ts +13 -0
- package/dist/context/index.d.ts.map +1 -0
- package/dist/context/index.js +14 -0
- package/dist/context/index.js.map +1 -0
- package/dist/context/package-detector.d.ts +53 -0
- package/dist/context/package-detector.d.ts.map +1 -0
- package/dist/context/package-detector.js +672 -0
- package/dist/context/package-detector.js.map +1 -0
- package/dist/context/types.d.ts +258 -0
- package/dist/context/types.d.ts.map +1 -0
- package/dist/context/types.js +10 -0
- package/dist/context/types.js.map +1 -0
- package/dist/cpp/cpp-analyzer.d.ts +179 -0
- package/dist/cpp/cpp-analyzer.d.ts.map +1 -0
- package/dist/cpp/cpp-analyzer.js +532 -0
- package/dist/cpp/cpp-analyzer.js.map +1 -0
- package/dist/cpp/index.d.ts +9 -0
- package/dist/cpp/index.d.ts.map +1 -0
- package/dist/cpp/index.js +9 -0
- package/dist/cpp/index.js.map +1 -0
- package/dist/decisions/analyzer/decision-mining-analyzer.d.ts.map +1 -1
- package/dist/decisions/analyzer/decision-mining-analyzer.js +4 -0
- package/dist/decisions/analyzer/decision-mining-analyzer.js.map +1 -1
- package/dist/decisions/types.d.ts +1 -1
- package/dist/decisions/types.d.ts.map +1 -1
- package/dist/environment/extractors/cpp-env-extractor.d.ts +58 -0
- package/dist/environment/extractors/cpp-env-extractor.d.ts.map +1 -0
- package/dist/environment/extractors/cpp-env-extractor.js +298 -0
- package/dist/environment/extractors/cpp-env-extractor.js.map +1 -0
- package/dist/environment/extractors/index.d.ts +2 -0
- package/dist/environment/extractors/index.d.ts.map +1 -1
- package/dist/environment/extractors/index.js +2 -0
- package/dist/environment/extractors/index.js.map +1 -1
- package/dist/environment/extractors/rust-env-extractor.d.ts +58 -0
- package/dist/environment/extractors/rust-env-extractor.d.ts.map +1 -0
- package/dist/environment/extractors/rust-env-extractor.js +297 -0
- package/dist/environment/extractors/rust-env-extractor.js.map +1 -0
- package/dist/environment/index.d.ts +1 -1
- package/dist/environment/index.d.ts.map +1 -1
- package/dist/environment/index.js +1 -1
- package/dist/environment/index.js.map +1 -1
- package/dist/environment/types.d.ts +2 -2
- package/dist/environment/types.d.ts.map +1 -1
- package/dist/environment/types.js.map +1 -1
- package/dist/index.d.ts +15 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +62 -2
- package/dist/index.js.map +1 -1
- package/dist/licensing/feature-guard.d.ts +103 -0
- package/dist/licensing/feature-guard.d.ts.map +1 -0
- package/dist/licensing/feature-guard.js +195 -0
- package/dist/licensing/feature-guard.js.map +1 -0
- package/dist/licensing/index.d.ts +46 -0
- package/dist/licensing/index.d.ts.map +1 -0
- package/dist/licensing/index.js +47 -0
- package/dist/licensing/index.js.map +1 -0
- package/dist/licensing/license-manager.d.ts +88 -0
- package/dist/licensing/license-manager.d.ts.map +1 -0
- package/dist/licensing/license-manager.js +251 -0
- package/dist/licensing/license-manager.js.map +1 -0
- package/dist/licensing/license-validator.d.ts +60 -0
- package/dist/licensing/license-validator.d.ts.map +1 -0
- package/dist/licensing/license-validator.js +300 -0
- package/dist/licensing/license-validator.js.map +1 -0
- package/dist/licensing/types.d.ts +76 -0
- package/dist/licensing/types.d.ts.map +1 -0
- package/dist/licensing/types.js +51 -0
- package/dist/licensing/types.js.map +1 -0
- package/dist/parsers/tree-sitter/cpp-loader.d.ts +51 -0
- package/dist/parsers/tree-sitter/cpp-loader.d.ts.map +1 -0
- package/dist/parsers/tree-sitter/cpp-loader.js +162 -0
- package/dist/parsers/tree-sitter/cpp-loader.js.map +1 -0
- package/dist/parsers/tree-sitter/index.d.ts +6 -0
- package/dist/parsers/tree-sitter/index.d.ts.map +1 -1
- package/dist/parsers/tree-sitter/index.js +16 -0
- package/dist/parsers/tree-sitter/index.js.map +1 -1
- package/dist/parsers/tree-sitter/rust-loader.d.ts +50 -0
- package/dist/parsers/tree-sitter/rust-loader.d.ts.map +1 -0
- package/dist/parsers/tree-sitter/rust-loader.js +161 -0
- package/dist/parsers/tree-sitter/rust-loader.js.map +1 -0
- package/dist/parsers/tree-sitter/tree-sitter-cpp-parser.d.ts +198 -0
- package/dist/parsers/tree-sitter/tree-sitter-cpp-parser.d.ts.map +1 -0
- package/dist/parsers/tree-sitter/tree-sitter-cpp-parser.js +671 -0
- package/dist/parsers/tree-sitter/tree-sitter-cpp-parser.js.map +1 -0
- package/dist/parsers/tree-sitter/tree-sitter-rust-parser.d.ts +180 -0
- package/dist/parsers/tree-sitter/tree-sitter-rust-parser.d.ts.map +1 -0
- package/dist/parsers/tree-sitter/tree-sitter-rust-parser.js +478 -0
- package/dist/parsers/tree-sitter/tree-sitter-rust-parser.js.map +1 -0
- package/dist/parsers/types.d.ts +1 -1
- package/dist/parsers/types.d.ts.map +1 -1
- package/dist/patterns/adapters/pattern-store-adapter.d.ts.map +1 -1
- package/dist/patterns/adapters/pattern-store-adapter.js +35 -10
- package/dist/patterns/adapters/pattern-store-adapter.js.map +1 -1
- package/dist/quality-gates/gates/base-gate.d.ts +71 -0
- package/dist/quality-gates/gates/base-gate.d.ts.map +1 -0
- package/dist/quality-gates/gates/base-gate.js +178 -0
- package/dist/quality-gates/gates/base-gate.js.map +1 -0
- package/dist/quality-gates/gates/constraint-verification/constraint-verification-gate.d.ts +62 -0
- package/dist/quality-gates/gates/constraint-verification/constraint-verification-gate.d.ts.map +1 -0
- package/dist/quality-gates/gates/constraint-verification/constraint-verification-gate.js +255 -0
- package/dist/quality-gates/gates/constraint-verification/constraint-verification-gate.js.map +1 -0
- package/dist/quality-gates/gates/constraint-verification/index.d.ts +7 -0
- package/dist/quality-gates/gates/constraint-verification/index.d.ts.map +1 -0
- package/dist/quality-gates/gates/constraint-verification/index.js +7 -0
- package/dist/quality-gates/gates/constraint-verification/index.js.map +1 -0
- package/dist/quality-gates/gates/custom-rules/custom-rules-gate.d.ts +73 -0
- package/dist/quality-gates/gates/custom-rules/custom-rules-gate.d.ts.map +1 -0
- package/dist/quality-gates/gates/custom-rules/custom-rules-gate.js +351 -0
- package/dist/quality-gates/gates/custom-rules/custom-rules-gate.js.map +1 -0
- package/dist/quality-gates/gates/custom-rules/index.d.ts +7 -0
- package/dist/quality-gates/gates/custom-rules/index.d.ts.map +1 -0
- package/dist/quality-gates/gates/custom-rules/index.js +7 -0
- package/dist/quality-gates/gates/custom-rules/index.js.map +1 -0
- package/dist/quality-gates/gates/impact-simulation/impact-simulation-gate.d.ts +61 -0
- package/dist/quality-gates/gates/impact-simulation/impact-simulation-gate.d.ts.map +1 -0
- package/dist/quality-gates/gates/impact-simulation/impact-simulation-gate.js +318 -0
- package/dist/quality-gates/gates/impact-simulation/impact-simulation-gate.js.map +1 -0
- package/dist/quality-gates/gates/impact-simulation/index.d.ts +7 -0
- package/dist/quality-gates/gates/impact-simulation/index.d.ts.map +1 -0
- package/dist/quality-gates/gates/impact-simulation/index.js +7 -0
- package/dist/quality-gates/gates/impact-simulation/index.js.map +1 -0
- package/dist/quality-gates/gates/index.d.ts +13 -0
- package/dist/quality-gates/gates/index.d.ts.map +1 -0
- package/dist/quality-gates/gates/index.js +13 -0
- package/dist/quality-gates/gates/index.js.map +1 -0
- package/dist/quality-gates/gates/pattern-compliance/index.d.ts +7 -0
- package/dist/quality-gates/gates/pattern-compliance/index.d.ts.map +1 -0
- package/dist/quality-gates/gates/pattern-compliance/index.js +7 -0
- package/dist/quality-gates/gates/pattern-compliance/index.js.map +1 -0
- package/dist/quality-gates/gates/pattern-compliance/pattern-compliance-gate.d.ts +61 -0
- package/dist/quality-gates/gates/pattern-compliance/pattern-compliance-gate.d.ts.map +1 -0
- package/dist/quality-gates/gates/pattern-compliance/pattern-compliance-gate.js +261 -0
- package/dist/quality-gates/gates/pattern-compliance/pattern-compliance-gate.js.map +1 -0
- package/dist/quality-gates/gates/regression-detection/index.d.ts +7 -0
- package/dist/quality-gates/gates/regression-detection/index.d.ts.map +1 -0
- package/dist/quality-gates/gates/regression-detection/index.js +7 -0
- package/dist/quality-gates/gates/regression-detection/index.js.map +1 -0
- package/dist/quality-gates/gates/regression-detection/regression-detection-gate.d.ts +69 -0
- package/dist/quality-gates/gates/regression-detection/regression-detection-gate.d.ts.map +1 -0
- package/dist/quality-gates/gates/regression-detection/regression-detection-gate.js +330 -0
- package/dist/quality-gates/gates/regression-detection/regression-detection-gate.js.map +1 -0
- package/dist/quality-gates/gates/security-boundary/index.d.ts +7 -0
- package/dist/quality-gates/gates/security-boundary/index.d.ts.map +1 -0
- package/dist/quality-gates/gates/security-boundary/index.js +7 -0
- package/dist/quality-gates/gates/security-boundary/index.js.map +1 -0
- package/dist/quality-gates/gates/security-boundary/security-boundary-gate.d.ts +65 -0
- package/dist/quality-gates/gates/security-boundary/security-boundary-gate.d.ts.map +1 -0
- package/dist/quality-gates/gates/security-boundary/security-boundary-gate.js +307 -0
- package/dist/quality-gates/gates/security-boundary/security-boundary-gate.js.map +1 -0
- package/dist/quality-gates/index.d.ts +35 -0
- package/dist/quality-gates/index.d.ts.map +1 -0
- package/dist/quality-gates/index.js +43 -0
- package/dist/quality-gates/index.js.map +1 -0
- package/dist/quality-gates/orchestrator/gate-orchestrator.d.ts +79 -0
- package/dist/quality-gates/orchestrator/gate-orchestrator.d.ts.map +1 -0
- package/dist/quality-gates/orchestrator/gate-orchestrator.js +314 -0
- package/dist/quality-gates/orchestrator/gate-orchestrator.js.map +1 -0
- package/dist/quality-gates/orchestrator/gate-registry.d.ts +53 -0
- package/dist/quality-gates/orchestrator/gate-registry.d.ts.map +1 -0
- package/dist/quality-gates/orchestrator/gate-registry.js +141 -0
- package/dist/quality-gates/orchestrator/gate-registry.js.map +1 -0
- package/dist/quality-gates/orchestrator/index.d.ts +10 -0
- package/dist/quality-gates/orchestrator/index.d.ts.map +1 -0
- package/dist/quality-gates/orchestrator/index.js +10 -0
- package/dist/quality-gates/orchestrator/index.js.map +1 -0
- package/dist/quality-gates/orchestrator/parallel-executor.d.ts +35 -0
- package/dist/quality-gates/orchestrator/parallel-executor.d.ts.map +1 -0
- package/dist/quality-gates/orchestrator/parallel-executor.js +70 -0
- package/dist/quality-gates/orchestrator/parallel-executor.js.map +1 -0
- package/dist/quality-gates/orchestrator/result-aggregator.d.ts +27 -0
- package/dist/quality-gates/orchestrator/result-aggregator.d.ts.map +1 -0
- package/dist/quality-gates/orchestrator/result-aggregator.js +70 -0
- package/dist/quality-gates/orchestrator/result-aggregator.js.map +1 -0
- package/dist/quality-gates/policy/default-policies.d.ts +14 -0
- package/dist/quality-gates/policy/default-policies.d.ts.map +1 -0
- package/dist/quality-gates/policy/default-policies.js +266 -0
- package/dist/quality-gates/policy/default-policies.js.map +1 -0
- package/dist/quality-gates/policy/index.d.ts +9 -0
- package/dist/quality-gates/policy/index.d.ts.map +1 -0
- package/dist/quality-gates/policy/index.js +9 -0
- package/dist/quality-gates/policy/index.js.map +1 -0
- package/dist/quality-gates/policy/policy-evaluator.d.ts +43 -0
- package/dist/quality-gates/policy/policy-evaluator.d.ts.map +1 -0
- package/dist/quality-gates/policy/policy-evaluator.js +136 -0
- package/dist/quality-gates/policy/policy-evaluator.js.map +1 -0
- package/dist/quality-gates/policy/policy-loader.d.ts +72 -0
- package/dist/quality-gates/policy/policy-loader.d.ts.map +1 -0
- package/dist/quality-gates/policy/policy-loader.js +228 -0
- package/dist/quality-gates/policy/policy-loader.js.map +1 -0
- package/dist/quality-gates/reporters/github-reporter.d.ts +19 -0
- package/dist/quality-gates/reporters/github-reporter.d.ts.map +1 -0
- package/dist/quality-gates/reporters/github-reporter.js +49 -0
- package/dist/quality-gates/reporters/github-reporter.js.map +1 -0
- package/dist/quality-gates/reporters/gitlab-reporter.d.ts +20 -0
- package/dist/quality-gates/reporters/gitlab-reporter.d.ts.map +1 -0
- package/dist/quality-gates/reporters/gitlab-reporter.js +42 -0
- package/dist/quality-gates/reporters/gitlab-reporter.js.map +1 -0
- package/dist/quality-gates/reporters/index.d.ts +12 -0
- package/dist/quality-gates/reporters/index.d.ts.map +1 -0
- package/dist/quality-gates/reporters/index.js +12 -0
- package/dist/quality-gates/reporters/index.js.map +1 -0
- package/dist/quality-gates/reporters/json-reporter.d.ts +18 -0
- package/dist/quality-gates/reporters/json-reporter.d.ts.map +1 -0
- package/dist/quality-gates/reporters/json-reporter.js +51 -0
- package/dist/quality-gates/reporters/json-reporter.js.map +1 -0
- package/dist/quality-gates/reporters/reporter-interface.d.ts +35 -0
- package/dist/quality-gates/reporters/reporter-interface.d.ts.map +1 -0
- package/dist/quality-gates/reporters/reporter-interface.js +22 -0
- package/dist/quality-gates/reporters/reporter-interface.js.map +1 -0
- package/dist/quality-gates/reporters/sarif-reporter.d.ts +22 -0
- package/dist/quality-gates/reporters/sarif-reporter.d.ts.map +1 -0
- package/dist/quality-gates/reporters/sarif-reporter.js +85 -0
- package/dist/quality-gates/reporters/sarif-reporter.js.map +1 -0
- package/dist/quality-gates/reporters/text-reporter.d.ts +18 -0
- package/dist/quality-gates/reporters/text-reporter.d.ts.map +1 -0
- package/dist/quality-gates/reporters/text-reporter.js +92 -0
- package/dist/quality-gates/reporters/text-reporter.js.map +1 -0
- package/dist/quality-gates/store/gate-run-store.d.ts +37 -0
- package/dist/quality-gates/store/gate-run-store.d.ts.map +1 -0
- package/dist/quality-gates/store/gate-run-store.js +104 -0
- package/dist/quality-gates/store/gate-run-store.js.map +1 -0
- package/dist/quality-gates/store/index.d.ts +8 -0
- package/dist/quality-gates/store/index.d.ts.map +1 -0
- package/dist/quality-gates/store/index.js +8 -0
- package/dist/quality-gates/store/index.js.map +1 -0
- package/dist/quality-gates/store/snapshot-store.d.ts +41 -0
- package/dist/quality-gates/store/snapshot-store.d.ts.map +1 -0
- package/dist/quality-gates/store/snapshot-store.js +117 -0
- package/dist/quality-gates/store/snapshot-store.js.map +1 -0
- package/dist/quality-gates/types.d.ts +992 -0
- package/dist/quality-gates/types.d.ts.map +1 -0
- package/dist/quality-gates/types.js +14 -0
- package/dist/quality-gates/types.js.map +1 -0
- package/dist/rust/index.d.ts +7 -0
- package/dist/rust/index.d.ts.map +1 -0
- package/dist/rust/index.js +8 -0
- package/dist/rust/index.js.map +1 -0
- package/dist/rust/rust-analyzer.d.ts +185 -0
- package/dist/rust/rust-analyzer.d.ts.map +1 -0
- package/dist/rust/rust-analyzer.js +538 -0
- package/dist/rust/rust-analyzer.js.map +1 -0
- package/dist/scanner/file-walker.d.ts.map +1 -1
- package/dist/scanner/file-walker.js +11 -0
- package/dist/scanner/file-walker.js.map +1 -1
- package/dist/simulation/simulation-engine.d.ts +6 -0
- package/dist/simulation/simulation-engine.d.ts.map +1 -1
- package/dist/simulation/simulation-engine.js +6 -0
- package/dist/simulation/simulation-engine.js.map +1 -1
- package/dist/speculative/types.d.ts +1 -1
- package/dist/speculative/types.d.ts.map +1 -1
- package/dist/speculative/types.js +2 -0
- package/dist/speculative/types.js.map +1 -1
- package/dist/store/project-config.d.ts +19 -0
- package/dist/store/project-config.d.ts.map +1 -1
- package/dist/store/project-config.js.map +1 -1
- package/dist/telemetry/index.d.ts +10 -0
- package/dist/telemetry/index.d.ts.map +1 -0
- package/dist/telemetry/index.js +11 -0
- package/dist/telemetry/index.js.map +1 -0
- package/dist/telemetry/telemetry-client.d.ts +127 -0
- package/dist/telemetry/telemetry-client.d.ts.map +1 -0
- package/dist/telemetry/telemetry-client.js +373 -0
- package/dist/telemetry/telemetry-client.js.map +1 -0
- package/dist/telemetry/types.d.ts +160 -0
- package/dist/telemetry/types.d.ts.map +1 -0
- package/dist/telemetry/types.js +27 -0
- package/dist/telemetry/types.js.map +1 -0
- package/dist/test-topology/extractors/cpp-test-extractor.d.ts +38 -0
- package/dist/test-topology/extractors/cpp-test-extractor.d.ts.map +1 -0
- package/dist/test-topology/extractors/cpp-test-extractor.js +507 -0
- package/dist/test-topology/extractors/cpp-test-extractor.js.map +1 -0
- package/dist/test-topology/extractors/index.d.ts +2 -0
- package/dist/test-topology/extractors/index.d.ts.map +1 -1
- package/dist/test-topology/extractors/index.js +2 -0
- package/dist/test-topology/extractors/index.js.map +1 -1
- package/dist/test-topology/extractors/regex/index.d.ts +1 -0
- package/dist/test-topology/extractors/regex/index.d.ts.map +1 -1
- package/dist/test-topology/extractors/regex/index.js +4 -0
- package/dist/test-topology/extractors/regex/index.js.map +1 -1
- package/dist/test-topology/extractors/regex/rust-test-regex.d.ts +66 -0
- package/dist/test-topology/extractors/regex/rust-test-regex.d.ts.map +1 -0
- package/dist/test-topology/extractors/regex/rust-test-regex.js +565 -0
- package/dist/test-topology/extractors/regex/rust-test-regex.js.map +1 -0
- package/dist/test-topology/extractors/rust-test-extractor.d.ts +49 -0
- package/dist/test-topology/extractors/rust-test-extractor.d.ts.map +1 -0
- package/dist/test-topology/extractors/rust-test-extractor.js +422 -0
- package/dist/test-topology/extractors/rust-test-extractor.js.map +1 -0
- package/dist/test-topology/hybrid-test-topology-analyzer.d.ts.map +1 -1
- package/dist/test-topology/hybrid-test-topology-analyzer.js +2 -0
- package/dist/test-topology/hybrid-test-topology-analyzer.js.map +1 -1
- package/dist/test-topology/test-topology-analyzer.d.ts.map +1 -1
- package/dist/test-topology/test-topology-analyzer.js +2 -0
- package/dist/test-topology/test-topology-analyzer.js.map +1 -1
- package/dist/test-topology/types.d.ts +2 -2
- package/dist/test-topology/types.d.ts.map +1 -1
- package/dist/unified-provider/integration/unified-scanner.d.ts.map +1 -1
- package/dist/unified-provider/integration/unified-scanner.js +3 -0
- package/dist/unified-provider/integration/unified-scanner.js.map +1 -1
- package/dist/unified-provider/matching/diesel-matcher.d.ts +33 -0
- package/dist/unified-provider/matching/diesel-matcher.d.ts.map +1 -0
- package/dist/unified-provider/matching/diesel-matcher.js +210 -0
- package/dist/unified-provider/matching/diesel-matcher.js.map +1 -0
- package/dist/unified-provider/matching/index.d.ts +3 -1
- package/dist/unified-provider/matching/index.d.ts.map +1 -1
- package/dist/unified-provider/matching/index.js +4 -1
- package/dist/unified-provider/matching/index.js.map +1 -1
- package/dist/unified-provider/matching/matcher-registry.d.ts.map +1 -1
- package/dist/unified-provider/matching/matcher-registry.js +7 -2
- package/dist/unified-provider/matching/matcher-registry.js.map +1 -1
- package/dist/unified-provider/matching/seaorm-matcher.d.ts +35 -0
- package/dist/unified-provider/matching/seaorm-matcher.d.ts.map +1 -0
- package/dist/unified-provider/matching/seaorm-matcher.js +200 -0
- package/dist/unified-provider/matching/seaorm-matcher.js.map +1 -0
- package/dist/unified-provider/matching/sqlx-matcher.d.ts +19 -24
- package/dist/unified-provider/matching/sqlx-matcher.d.ts.map +1 -1
- package/dist/unified-provider/matching/sqlx-matcher.js +171 -149
- package/dist/unified-provider/matching/sqlx-matcher.js.map +1 -1
- package/dist/unified-provider/normalization/cpp-normalizer.d.ts +62 -0
- package/dist/unified-provider/normalization/cpp-normalizer.d.ts.map +1 -0
- package/dist/unified-provider/normalization/cpp-normalizer.js +581 -0
- package/dist/unified-provider/normalization/cpp-normalizer.js.map +1 -0
- package/dist/unified-provider/normalization/index.d.ts +2 -0
- package/dist/unified-provider/normalization/index.d.ts.map +1 -1
- package/dist/unified-provider/normalization/index.js +11 -1
- package/dist/unified-provider/normalization/index.js.map +1 -1
- package/dist/unified-provider/normalization/rust-normalizer.d.ts +71 -0
- package/dist/unified-provider/normalization/rust-normalizer.d.ts.map +1 -0
- package/dist/unified-provider/normalization/rust-normalizer.js +670 -0
- package/dist/unified-provider/normalization/rust-normalizer.js.map +1 -0
- package/dist/unified-provider/parsing/parser-registry.d.ts.map +1 -1
- package/dist/unified-provider/parsing/parser-registry.js +62 -1
- package/dist/unified-provider/parsing/parser-registry.js.map +1 -1
- package/dist/unified-provider/provider/unified-language-provider.js +1 -1
- package/dist/unified-provider/provider/unified-language-provider.js.map +1 -1
- package/dist/unified-provider/types.d.ts +1 -1
- package/dist/unified-provider/types.d.ts.map +1 -1
- package/dist/wrappers/index.d.ts.map +1 -1
- package/dist/wrappers/index.js +2 -0
- package/dist/wrappers/index.js.map +1 -1
- package/dist/wrappers/integration/adapter.d.ts.map +1 -1
- package/dist/wrappers/integration/adapter.js +2 -0
- package/dist/wrappers/integration/adapter.js.map +1 -1
- package/dist/wrappers/integration/scanner.d.ts.map +1 -1
- package/dist/wrappers/integration/scanner.js +2 -0
- package/dist/wrappers/integration/scanner.js.map +1 -1
- package/dist/wrappers/primitives/registry.d.ts +18 -0
- package/dist/wrappers/primitives/registry.d.ts.map +1 -1
- package/dist/wrappers/primitives/registry.js +190 -0
- package/dist/wrappers/primitives/registry.js.map +1 -1
- package/dist/wrappers/types.d.ts +1 -1
- package/dist/wrappers/types.d.ts.map +1 -1
- package/package.json +5 -2
- package/LICENSE +0 -21
- package/dist/lake/lake.bak/index-store.d.ts +0 -82
- package/dist/lake/lake.bak/index-store.d.ts.map +0 -1
- package/dist/lake/lake.bak/index-store.js +0 -357
- package/dist/lake/lake.bak/index-store.js.map +0 -1
- package/dist/lake/lake.bak/index.d.ts +0 -81
- package/dist/lake/lake.bak/index.d.ts.map +0 -1
- package/dist/lake/lake.bak/index.js +0 -114
- package/dist/lake/lake.bak/index.js.map +0 -1
- package/dist/lake/lake.bak/manifest-store.d.ts +0 -51
- package/dist/lake/lake.bak/manifest-store.d.ts.map +0 -1
- package/dist/lake/lake.bak/manifest-store.js +0 -347
- package/dist/lake/lake.bak/manifest-store.js.map +0 -1
- package/dist/lake/lake.bak/query-engine.d.ts +0 -112
- package/dist/lake/lake.bak/query-engine.d.ts.map +0 -1
- package/dist/lake/lake.bak/query-engine.js +0 -370
- package/dist/lake/lake.bak/query-engine.js.map +0 -1
- package/dist/lake/lake.bak/types.d.ts +0 -428
- package/dist/lake/lake.bak/types.d.ts.map +0 -1
- package/dist/lake/lake.bak/types.js +0 -46
- package/dist/lake/lake.bak/types.js.map +0 -1
- package/dist/lake/lake.bak/view-materializer.d.ts +0 -70
- package/dist/lake/lake.bak/view-materializer.d.ts.map +0 -1
- package/dist/lake/lake.bak/view-materializer.js +0 -314
- package/dist/lake/lake.bak/view-materializer.js.map +0 -1
- package/dist/lake/lake.bak/view-store.d.ts +0 -57
- package/dist/lake/lake.bak/view-store.d.ts.map +0 -1
- package/dist/lake/lake.bak/view-store.js +0 -348
- package/dist/lake/lake.bak/view-store.js.map +0 -1
- package/dist/unified-provider/migration/deprecated-extractors.d.ts +0 -104
- package/dist/unified-provider/migration/deprecated-extractors.d.ts.map +0 -1
- package/dist/unified-provider/migration/deprecated-extractors.js +0 -129
- package/dist/unified-provider/migration/deprecated-extractors.js.map +0 -1
- package/dist/unified-provider/migration/deprecated-scanner.d.ts +0 -40
- package/dist/unified-provider/migration/deprecated-scanner.d.ts.map +0 -1
- package/dist/unified-provider/migration/deprecated-scanner.js +0 -49
- package/dist/unified-provider/migration/deprecated-scanner.js.map +0 -1
- package/dist/unified-provider/migration/index.d.ts +0 -41
- package/dist/unified-provider/migration/index.d.ts.map +0 -1
- package/dist/unified-provider/migration/index.js +0 -43
- package/dist/unified-provider/migration/index.js.map +0 -1
|
@@ -0,0 +1,671 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tree-Sitter C++ Parser Utilities
|
|
3
|
+
*
|
|
4
|
+
* Provides C++-specific parsing utilities built on tree-sitter.
|
|
5
|
+
* Handles C++ syntax including:
|
|
6
|
+
* - Functions and methods
|
|
7
|
+
* - Classes, structs, and enums
|
|
8
|
+
* - Templates and specializations
|
|
9
|
+
* - Namespaces
|
|
10
|
+
* - Virtual functions and inheritance
|
|
11
|
+
* - Smart pointers and RAII patterns
|
|
12
|
+
* - Operator overloading
|
|
13
|
+
*
|
|
14
|
+
* @license Apache-2.0
|
|
15
|
+
*/
|
|
16
|
+
import { isCppTreeSitterAvailable, createCppParser } from './cpp-loader.js';
|
|
17
|
+
// ============================================================================
|
|
18
|
+
// Parser Class
|
|
19
|
+
// ============================================================================
|
|
20
|
+
/**
|
|
21
|
+
* C++-specific tree-sitter parser
|
|
22
|
+
*/
|
|
23
|
+
export class CppTreeSitterParser {
|
|
24
|
+
parser = null;
|
|
25
|
+
currentAccessSpecifier = 'none';
|
|
26
|
+
currentNamespace = '';
|
|
27
|
+
/**
|
|
28
|
+
* Check if tree-sitter-cpp is available
|
|
29
|
+
*/
|
|
30
|
+
static isAvailable() {
|
|
31
|
+
return isCppTreeSitterAvailable();
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Parse C++ source code
|
|
35
|
+
*/
|
|
36
|
+
parse(source) {
|
|
37
|
+
const result = {
|
|
38
|
+
functions: [],
|
|
39
|
+
classes: [],
|
|
40
|
+
enums: [],
|
|
41
|
+
namespaces: [],
|
|
42
|
+
includes: [],
|
|
43
|
+
macros: [],
|
|
44
|
+
errors: [],
|
|
45
|
+
};
|
|
46
|
+
if (!isCppTreeSitterAvailable()) {
|
|
47
|
+
result.errors.push('Tree-sitter-cpp is not available');
|
|
48
|
+
return result;
|
|
49
|
+
}
|
|
50
|
+
try {
|
|
51
|
+
if (!this.parser) {
|
|
52
|
+
this.parser = createCppParser();
|
|
53
|
+
}
|
|
54
|
+
const tree = this.parser.parse(source);
|
|
55
|
+
this.currentNamespace = '';
|
|
56
|
+
this.currentAccessSpecifier = 'none';
|
|
57
|
+
this.visitNode(tree.rootNode, result, source);
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
result.errors.push(error instanceof Error ? error.message : 'Unknown parse error');
|
|
61
|
+
}
|
|
62
|
+
return result;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Visit a node and extract information
|
|
66
|
+
*/
|
|
67
|
+
visitNode(node, result, source) {
|
|
68
|
+
switch (node.type) {
|
|
69
|
+
case 'function_definition':
|
|
70
|
+
this.extractFunction(node, result, source);
|
|
71
|
+
break;
|
|
72
|
+
case 'declaration':
|
|
73
|
+
this.extractDeclaration(node, result, source);
|
|
74
|
+
break;
|
|
75
|
+
case 'class_specifier':
|
|
76
|
+
case 'struct_specifier':
|
|
77
|
+
this.extractClass(node, result, source);
|
|
78
|
+
break;
|
|
79
|
+
case 'enum_specifier':
|
|
80
|
+
this.extractEnum(node, result);
|
|
81
|
+
break;
|
|
82
|
+
case 'namespace_definition':
|
|
83
|
+
this.extractNamespace(node, result, source);
|
|
84
|
+
return; // Don't recurse, handled internally
|
|
85
|
+
case 'preproc_include':
|
|
86
|
+
this.extractInclude(node, result);
|
|
87
|
+
break;
|
|
88
|
+
case 'preproc_def':
|
|
89
|
+
case 'preproc_function_def':
|
|
90
|
+
this.extractMacro(node, result);
|
|
91
|
+
break;
|
|
92
|
+
case 'access_specifier':
|
|
93
|
+
this.updateAccessSpecifier(node);
|
|
94
|
+
break;
|
|
95
|
+
case 'template_declaration':
|
|
96
|
+
this.extractTemplateDeclaration(node, result, source);
|
|
97
|
+
return; // Don't recurse, handled internally
|
|
98
|
+
default:
|
|
99
|
+
// Recurse into children
|
|
100
|
+
for (const child of node.children) {
|
|
101
|
+
this.visitNode(child, result, source);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Extract function information
|
|
107
|
+
*/
|
|
108
|
+
extractFunction(node, result, _source) {
|
|
109
|
+
const declaratorNode = node.childForFieldName('declarator');
|
|
110
|
+
if (!declaratorNode)
|
|
111
|
+
return;
|
|
112
|
+
const { name, className } = this.extractFunctionName(declaratorNode);
|
|
113
|
+
if (!name)
|
|
114
|
+
return;
|
|
115
|
+
const typeNode = node.childForFieldName('type');
|
|
116
|
+
const fn = {
|
|
117
|
+
name,
|
|
118
|
+
qualifiedName: this.buildQualifiedName(name, className),
|
|
119
|
+
isVirtual: this.hasSpecifier(node, 'virtual'),
|
|
120
|
+
isPureVirtual: this.isPureVirtual(node),
|
|
121
|
+
isStatic: this.hasSpecifier(node, 'static'),
|
|
122
|
+
isConst: this.isConstMethod(declaratorNode),
|
|
123
|
+
isNoexcept: this.hasNoexcept(declaratorNode),
|
|
124
|
+
isConstexpr: this.hasSpecifier(node, 'constexpr'),
|
|
125
|
+
isInline: this.hasSpecifier(node, 'inline'),
|
|
126
|
+
isExplicit: this.hasSpecifier(node, 'explicit'),
|
|
127
|
+
accessSpecifier: this.currentAccessSpecifier,
|
|
128
|
+
parameters: this.extractParameters(declaratorNode),
|
|
129
|
+
templateParams: [],
|
|
130
|
+
startLine: node.startPosition.row + 1,
|
|
131
|
+
endLine: node.endPosition.row + 1,
|
|
132
|
+
};
|
|
133
|
+
if (typeNode) {
|
|
134
|
+
fn.returnType = this.extractType(typeNode);
|
|
135
|
+
}
|
|
136
|
+
if (className) {
|
|
137
|
+
fn.className = className;
|
|
138
|
+
}
|
|
139
|
+
if (this.currentNamespace) {
|
|
140
|
+
fn.namespaceName = this.currentNamespace;
|
|
141
|
+
}
|
|
142
|
+
result.functions.push(fn);
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Extract declaration (function declarations, variable declarations)
|
|
146
|
+
*/
|
|
147
|
+
extractDeclaration(node, result, source) {
|
|
148
|
+
// Check if this is a function declaration
|
|
149
|
+
const declaratorNode = node.childForFieldName('declarator');
|
|
150
|
+
if (declaratorNode && this.isFunctionDeclarator(declaratorNode)) {
|
|
151
|
+
this.extractFunctionDeclaration(node, result, source);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Extract function declaration (prototype)
|
|
156
|
+
*/
|
|
157
|
+
extractFunctionDeclaration(node, result, _source) {
|
|
158
|
+
const declaratorNode = node.childForFieldName('declarator');
|
|
159
|
+
if (!declaratorNode)
|
|
160
|
+
return;
|
|
161
|
+
const { name, className } = this.extractFunctionName(declaratorNode);
|
|
162
|
+
if (!name)
|
|
163
|
+
return;
|
|
164
|
+
const typeNode = node.childForFieldName('type');
|
|
165
|
+
const fn = {
|
|
166
|
+
name,
|
|
167
|
+
qualifiedName: this.buildQualifiedName(name, className),
|
|
168
|
+
isVirtual: this.hasSpecifier(node, 'virtual'),
|
|
169
|
+
isPureVirtual: this.isPureVirtual(node),
|
|
170
|
+
isStatic: this.hasSpecifier(node, 'static'),
|
|
171
|
+
isConst: this.isConstMethod(declaratorNode),
|
|
172
|
+
isNoexcept: this.hasNoexcept(declaratorNode),
|
|
173
|
+
isConstexpr: this.hasSpecifier(node, 'constexpr'),
|
|
174
|
+
isInline: this.hasSpecifier(node, 'inline'),
|
|
175
|
+
isExplicit: this.hasSpecifier(node, 'explicit'),
|
|
176
|
+
accessSpecifier: this.currentAccessSpecifier,
|
|
177
|
+
parameters: this.extractParameters(declaratorNode),
|
|
178
|
+
templateParams: [],
|
|
179
|
+
startLine: node.startPosition.row + 1,
|
|
180
|
+
endLine: node.endPosition.row + 1,
|
|
181
|
+
};
|
|
182
|
+
if (typeNode) {
|
|
183
|
+
fn.returnType = this.extractType(typeNode);
|
|
184
|
+
}
|
|
185
|
+
if (className) {
|
|
186
|
+
fn.className = className;
|
|
187
|
+
}
|
|
188
|
+
if (this.currentNamespace) {
|
|
189
|
+
fn.namespaceName = this.currentNamespace;
|
|
190
|
+
}
|
|
191
|
+
result.functions.push(fn);
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Extract class/struct information
|
|
195
|
+
*/
|
|
196
|
+
extractClass(node, result, source) {
|
|
197
|
+
const nameNode = node.childForFieldName('name');
|
|
198
|
+
if (!nameNode)
|
|
199
|
+
return;
|
|
200
|
+
const name = nameNode.text;
|
|
201
|
+
const kind = node.type === 'class_specifier' ? 'class' : 'struct';
|
|
202
|
+
const bodyNode = node.childForFieldName('body');
|
|
203
|
+
const cls = {
|
|
204
|
+
name,
|
|
205
|
+
kind,
|
|
206
|
+
isTemplate: false,
|
|
207
|
+
templateParams: [],
|
|
208
|
+
baseClasses: this.extractBaseClasses(node),
|
|
209
|
+
methods: [],
|
|
210
|
+
virtualMethods: [],
|
|
211
|
+
fields: [],
|
|
212
|
+
accessSpecifier: this.currentAccessSpecifier,
|
|
213
|
+
startLine: node.startPosition.row + 1,
|
|
214
|
+
endLine: node.endPosition.row + 1,
|
|
215
|
+
};
|
|
216
|
+
if (this.currentNamespace) {
|
|
217
|
+
cls.namespaceName = this.currentNamespace;
|
|
218
|
+
}
|
|
219
|
+
// Set default access specifier based on class/struct
|
|
220
|
+
const savedAccessSpecifier = this.currentAccessSpecifier;
|
|
221
|
+
this.currentAccessSpecifier = kind === 'class' ? 'private' : 'public';
|
|
222
|
+
// Extract members from body
|
|
223
|
+
if (bodyNode) {
|
|
224
|
+
this.extractClassMembers(bodyNode, cls, result, source);
|
|
225
|
+
}
|
|
226
|
+
this.currentAccessSpecifier = savedAccessSpecifier;
|
|
227
|
+
result.classes.push(cls);
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Extract class members
|
|
231
|
+
*/
|
|
232
|
+
extractClassMembers(bodyNode, cls, result, source) {
|
|
233
|
+
for (const child of bodyNode.children) {
|
|
234
|
+
switch (child.type) {
|
|
235
|
+
case 'access_specifier':
|
|
236
|
+
this.updateAccessSpecifier(child);
|
|
237
|
+
break;
|
|
238
|
+
case 'function_definition':
|
|
239
|
+
this.extractFunction(child, result, source);
|
|
240
|
+
const fnName = this.extractFunctionNameFromNode(child);
|
|
241
|
+
if (fnName) {
|
|
242
|
+
cls.methods.push(fnName);
|
|
243
|
+
if (this.hasSpecifier(child, 'virtual')) {
|
|
244
|
+
cls.virtualMethods.push(fnName);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
break;
|
|
248
|
+
case 'declaration':
|
|
249
|
+
if (this.isFunctionDeclarator(child.childForFieldName('declarator'))) {
|
|
250
|
+
this.extractFunctionDeclaration(child, result, source);
|
|
251
|
+
const declName = this.extractFunctionNameFromNode(child);
|
|
252
|
+
if (declName) {
|
|
253
|
+
cls.methods.push(declName);
|
|
254
|
+
if (this.hasSpecifier(child, 'virtual')) {
|
|
255
|
+
cls.virtualMethods.push(declName);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
else {
|
|
260
|
+
// Field declaration
|
|
261
|
+
const field = this.extractField(child);
|
|
262
|
+
if (field) {
|
|
263
|
+
cls.fields.push(field);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
break;
|
|
267
|
+
case 'field_declaration':
|
|
268
|
+
const fieldDecl = this.extractField(child);
|
|
269
|
+
if (fieldDecl) {
|
|
270
|
+
cls.fields.push(fieldDecl);
|
|
271
|
+
}
|
|
272
|
+
break;
|
|
273
|
+
case 'template_declaration':
|
|
274
|
+
this.extractTemplateDeclaration(child, result, source);
|
|
275
|
+
break;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Extract enum information
|
|
281
|
+
*/
|
|
282
|
+
extractEnum(node, result) {
|
|
283
|
+
const nameNode = node.childForFieldName('name');
|
|
284
|
+
const bodyNode = node.childForFieldName('body');
|
|
285
|
+
const name = nameNode?.text ?? '';
|
|
286
|
+
const isScoped = this.isScopedEnum(node);
|
|
287
|
+
const enumDef = {
|
|
288
|
+
name,
|
|
289
|
+
isScoped,
|
|
290
|
+
values: [],
|
|
291
|
+
startLine: node.startPosition.row + 1,
|
|
292
|
+
endLine: node.endPosition.row + 1,
|
|
293
|
+
};
|
|
294
|
+
// Extract underlying type
|
|
295
|
+
const baseNode = node.childForFieldName('base');
|
|
296
|
+
if (baseNode) {
|
|
297
|
+
enumDef.underlyingType = baseNode.text;
|
|
298
|
+
}
|
|
299
|
+
if (this.currentNamespace) {
|
|
300
|
+
enumDef.namespaceName = this.currentNamespace;
|
|
301
|
+
}
|
|
302
|
+
// Extract enum values
|
|
303
|
+
if (bodyNode) {
|
|
304
|
+
for (const child of bodyNode.children) {
|
|
305
|
+
if (child.type === 'enumerator') {
|
|
306
|
+
const valueName = child.childForFieldName('name')?.text;
|
|
307
|
+
const valueExpr = child.childForFieldName('value')?.text;
|
|
308
|
+
if (valueName) {
|
|
309
|
+
enumDef.values.push({
|
|
310
|
+
name: valueName,
|
|
311
|
+
value: valueExpr,
|
|
312
|
+
line: child.startPosition.row + 1,
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
result.enums.push(enumDef);
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* Extract namespace information
|
|
322
|
+
*/
|
|
323
|
+
extractNamespace(node, result, source) {
|
|
324
|
+
const nameNode = node.childForFieldName('name');
|
|
325
|
+
const bodyNode = node.childForFieldName('body');
|
|
326
|
+
const name = nameNode?.text ?? '';
|
|
327
|
+
const isAnonymous = !nameNode;
|
|
328
|
+
result.namespaces.push({
|
|
329
|
+
name,
|
|
330
|
+
isAnonymous,
|
|
331
|
+
startLine: node.startPosition.row + 1,
|
|
332
|
+
endLine: node.endPosition.row + 1,
|
|
333
|
+
});
|
|
334
|
+
// Save and update namespace context
|
|
335
|
+
const savedNamespace = this.currentNamespace;
|
|
336
|
+
this.currentNamespace = this.currentNamespace
|
|
337
|
+
? `${this.currentNamespace}::${name}`
|
|
338
|
+
: name;
|
|
339
|
+
// Process namespace body
|
|
340
|
+
if (bodyNode) {
|
|
341
|
+
for (const child of bodyNode.children) {
|
|
342
|
+
this.visitNode(child, result, source);
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
this.currentNamespace = savedNamespace;
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* Extract include directive
|
|
349
|
+
*/
|
|
350
|
+
extractInclude(node, result) {
|
|
351
|
+
const pathNode = node.childForFieldName('path');
|
|
352
|
+
if (!pathNode)
|
|
353
|
+
return;
|
|
354
|
+
const pathText = pathNode.text;
|
|
355
|
+
const isSystem = pathText.startsWith('<');
|
|
356
|
+
const path = pathText.replace(/^[<"]|[>"]$/g, '');
|
|
357
|
+
result.includes.push({
|
|
358
|
+
path,
|
|
359
|
+
isSystem,
|
|
360
|
+
line: node.startPosition.row + 1,
|
|
361
|
+
});
|
|
362
|
+
}
|
|
363
|
+
/**
|
|
364
|
+
* Extract macro definition
|
|
365
|
+
*/
|
|
366
|
+
extractMacro(node, result) {
|
|
367
|
+
const nameNode = node.childForFieldName('name');
|
|
368
|
+
if (!nameNode)
|
|
369
|
+
return;
|
|
370
|
+
const macro = {
|
|
371
|
+
name: nameNode.text,
|
|
372
|
+
line: node.startPosition.row + 1,
|
|
373
|
+
};
|
|
374
|
+
// Extract parameters for function-like macros
|
|
375
|
+
const paramsNode = node.childForFieldName('parameters');
|
|
376
|
+
if (paramsNode) {
|
|
377
|
+
macro.parameters = [];
|
|
378
|
+
for (const child of paramsNode.children) {
|
|
379
|
+
if (child.type === 'identifier') {
|
|
380
|
+
macro.parameters.push(child.text);
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
// Extract body
|
|
385
|
+
const valueNode = node.childForFieldName('value');
|
|
386
|
+
if (valueNode) {
|
|
387
|
+
macro.body = valueNode.text;
|
|
388
|
+
}
|
|
389
|
+
result.macros.push(macro);
|
|
390
|
+
}
|
|
391
|
+
/**
|
|
392
|
+
* Extract template declaration
|
|
393
|
+
*/
|
|
394
|
+
extractTemplateDeclaration(node, result, source) {
|
|
395
|
+
const paramsNode = node.childForFieldName('parameters');
|
|
396
|
+
const templateParams = paramsNode ? this.extractTemplateParams(paramsNode) : [];
|
|
397
|
+
// Find the templated declaration
|
|
398
|
+
for (const child of node.children) {
|
|
399
|
+
if (child.type === 'function_definition') {
|
|
400
|
+
this.extractFunction(child, result, source);
|
|
401
|
+
// Add template params to the last function
|
|
402
|
+
if (result.functions.length > 0) {
|
|
403
|
+
result.functions[result.functions.length - 1].templateParams = templateParams;
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
else if (child.type === 'declaration') {
|
|
407
|
+
this.extractDeclaration(child, result, source);
|
|
408
|
+
if (result.functions.length > 0) {
|
|
409
|
+
result.functions[result.functions.length - 1].templateParams = templateParams;
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
else if (child.type === 'class_specifier' || child.type === 'struct_specifier') {
|
|
413
|
+
this.extractClass(child, result, source);
|
|
414
|
+
// Add template params to the last class
|
|
415
|
+
if (result.classes.length > 0) {
|
|
416
|
+
const lastClass = result.classes[result.classes.length - 1];
|
|
417
|
+
lastClass.isTemplate = true;
|
|
418
|
+
lastClass.templateParams = templateParams;
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
// ============================================================================
|
|
424
|
+
// Helper Methods
|
|
425
|
+
// ============================================================================
|
|
426
|
+
extractFunctionName(declaratorNode) {
|
|
427
|
+
let name = null;
|
|
428
|
+
let className = null;
|
|
429
|
+
const visit = (n) => {
|
|
430
|
+
if (n.type === 'identifier') {
|
|
431
|
+
name = n.text;
|
|
432
|
+
}
|
|
433
|
+
else if (n.type === 'field_identifier') {
|
|
434
|
+
name = n.text;
|
|
435
|
+
}
|
|
436
|
+
else if (n.type === 'qualified_identifier') {
|
|
437
|
+
const parts = n.text.split('::');
|
|
438
|
+
name = parts[parts.length - 1] ?? null;
|
|
439
|
+
if (parts.length > 1) {
|
|
440
|
+
className = parts.slice(0, -1).join('::');
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
else if (n.type === 'destructor_name') {
|
|
444
|
+
name = n.text;
|
|
445
|
+
}
|
|
446
|
+
else if (n.type === 'operator_name') {
|
|
447
|
+
name = n.text;
|
|
448
|
+
}
|
|
449
|
+
else if (n.type === 'function_declarator') {
|
|
450
|
+
const innerDeclarator = n.childForFieldName('declarator');
|
|
451
|
+
if (innerDeclarator) {
|
|
452
|
+
visit(innerDeclarator);
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
else if (n.type === 'pointer_declarator' || n.type === 'reference_declarator') {
|
|
456
|
+
for (const child of n.children) {
|
|
457
|
+
visit(child);
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
};
|
|
461
|
+
visit(declaratorNode);
|
|
462
|
+
return { name, className };
|
|
463
|
+
}
|
|
464
|
+
extractFunctionNameFromNode(node) {
|
|
465
|
+
const declaratorNode = node.childForFieldName('declarator');
|
|
466
|
+
if (!declaratorNode)
|
|
467
|
+
return null;
|
|
468
|
+
const { name } = this.extractFunctionName(declaratorNode);
|
|
469
|
+
return name;
|
|
470
|
+
}
|
|
471
|
+
buildQualifiedName(name, className) {
|
|
472
|
+
const parts = [];
|
|
473
|
+
if (this.currentNamespace) {
|
|
474
|
+
parts.push(this.currentNamespace);
|
|
475
|
+
}
|
|
476
|
+
if (className) {
|
|
477
|
+
parts.push(className);
|
|
478
|
+
}
|
|
479
|
+
parts.push(name);
|
|
480
|
+
return parts.join('::');
|
|
481
|
+
}
|
|
482
|
+
extractParameters(declaratorNode) {
|
|
483
|
+
const params = [];
|
|
484
|
+
const findParams = (n) => {
|
|
485
|
+
if (n.type === 'function_declarator') {
|
|
486
|
+
return n.childForFieldName('parameters');
|
|
487
|
+
}
|
|
488
|
+
for (const child of n.children) {
|
|
489
|
+
const result = findParams(child);
|
|
490
|
+
if (result)
|
|
491
|
+
return result;
|
|
492
|
+
}
|
|
493
|
+
return null;
|
|
494
|
+
};
|
|
495
|
+
const paramsNode = findParams(declaratorNode);
|
|
496
|
+
if (!paramsNode)
|
|
497
|
+
return params;
|
|
498
|
+
for (const child of paramsNode.children) {
|
|
499
|
+
if (child.type === 'parameter_declaration') {
|
|
500
|
+
const typeNode = child.childForFieldName('type');
|
|
501
|
+
const declarator = child.childForFieldName('declarator');
|
|
502
|
+
const defaultValue = child.childForFieldName('default_value');
|
|
503
|
+
const typeText = typeNode?.text ?? 'unknown';
|
|
504
|
+
let name = 'unnamed';
|
|
505
|
+
if (declarator) {
|
|
506
|
+
const { name: paramName } = this.extractFunctionName(declarator);
|
|
507
|
+
if (paramName)
|
|
508
|
+
name = paramName;
|
|
509
|
+
}
|
|
510
|
+
params.push({
|
|
511
|
+
name,
|
|
512
|
+
type: typeText,
|
|
513
|
+
hasDefault: !!defaultValue,
|
|
514
|
+
defaultValue: defaultValue?.text,
|
|
515
|
+
isConst: typeText.includes('const'),
|
|
516
|
+
isReference: typeText.includes('&') && !typeText.includes('&&'),
|
|
517
|
+
isPointer: typeText.includes('*'),
|
|
518
|
+
isRvalueRef: typeText.includes('&&'),
|
|
519
|
+
});
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
return params;
|
|
523
|
+
}
|
|
524
|
+
extractTemplateParams(paramsNode) {
|
|
525
|
+
const params = [];
|
|
526
|
+
for (const child of paramsNode.children) {
|
|
527
|
+
if (child.type === 'type_parameter_declaration') {
|
|
528
|
+
const nameNode = child.childForFieldName('name');
|
|
529
|
+
const defaultNode = child.childForFieldName('default_type');
|
|
530
|
+
params.push({
|
|
531
|
+
name: nameNode?.text ?? 'T',
|
|
532
|
+
kind: 'type',
|
|
533
|
+
default: defaultNode?.text,
|
|
534
|
+
});
|
|
535
|
+
}
|
|
536
|
+
else if (child.type === 'parameter_declaration') {
|
|
537
|
+
const typeNode = child.childForFieldName('type');
|
|
538
|
+
const declarator = child.childForFieldName('declarator');
|
|
539
|
+
params.push({
|
|
540
|
+
name: declarator?.text ?? 'N',
|
|
541
|
+
kind: 'non-type',
|
|
542
|
+
constraint: typeNode?.text,
|
|
543
|
+
});
|
|
544
|
+
}
|
|
545
|
+
else if (child.type === 'template_template_parameter_declaration') {
|
|
546
|
+
const nameNode = child.childForFieldName('name');
|
|
547
|
+
params.push({
|
|
548
|
+
name: nameNode?.text ?? 'Template',
|
|
549
|
+
kind: 'template',
|
|
550
|
+
});
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
return params;
|
|
554
|
+
}
|
|
555
|
+
extractBaseClasses(node) {
|
|
556
|
+
const bases = [];
|
|
557
|
+
for (const child of node.children) {
|
|
558
|
+
if (child.type === 'base_class_clause') {
|
|
559
|
+
for (const baseChild of child.children) {
|
|
560
|
+
if (baseChild.type === 'type_identifier' || baseChild.type === 'qualified_identifier') {
|
|
561
|
+
let accessSpecifier = 'private';
|
|
562
|
+
let isVirtual = false;
|
|
563
|
+
// Check siblings for access specifier and virtual
|
|
564
|
+
let sibling = baseChild.previousSibling;
|
|
565
|
+
while (sibling) {
|
|
566
|
+
if (sibling.text === 'public')
|
|
567
|
+
accessSpecifier = 'public';
|
|
568
|
+
else if (sibling.text === 'protected')
|
|
569
|
+
accessSpecifier = 'protected';
|
|
570
|
+
else if (sibling.text === 'private')
|
|
571
|
+
accessSpecifier = 'private';
|
|
572
|
+
else if (sibling.text === 'virtual')
|
|
573
|
+
isVirtual = true;
|
|
574
|
+
sibling = sibling.previousSibling;
|
|
575
|
+
}
|
|
576
|
+
bases.push({
|
|
577
|
+
name: baseChild.text,
|
|
578
|
+
accessSpecifier,
|
|
579
|
+
isVirtual,
|
|
580
|
+
});
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
return bases;
|
|
586
|
+
}
|
|
587
|
+
extractField(node) {
|
|
588
|
+
const typeNode = node.childForFieldName('type');
|
|
589
|
+
const declaratorNode = node.childForFieldName('declarator');
|
|
590
|
+
if (!declaratorNode)
|
|
591
|
+
return null;
|
|
592
|
+
const { name } = this.extractFunctionName(declaratorNode);
|
|
593
|
+
if (!name)
|
|
594
|
+
return null;
|
|
595
|
+
const typeText = typeNode?.text ?? 'unknown';
|
|
596
|
+
return {
|
|
597
|
+
name,
|
|
598
|
+
type: typeText,
|
|
599
|
+
accessSpecifier: this.currentAccessSpecifier === 'none' ? 'private' : this.currentAccessSpecifier,
|
|
600
|
+
isStatic: this.hasSpecifier(node, 'static'),
|
|
601
|
+
isConst: typeText.includes('const'),
|
|
602
|
+
isMutable: this.hasSpecifier(node, 'mutable'),
|
|
603
|
+
};
|
|
604
|
+
}
|
|
605
|
+
extractType(typeNode) {
|
|
606
|
+
return typeNode.text;
|
|
607
|
+
}
|
|
608
|
+
hasSpecifier(node, specifier) {
|
|
609
|
+
for (const child of node.children) {
|
|
610
|
+
if (child.type === 'storage_class_specifier' || child.type === 'type_qualifier') {
|
|
611
|
+
if (child.text === specifier)
|
|
612
|
+
return true;
|
|
613
|
+
}
|
|
614
|
+
if (child.text === specifier)
|
|
615
|
+
return true;
|
|
616
|
+
}
|
|
617
|
+
return false;
|
|
618
|
+
}
|
|
619
|
+
isPureVirtual(node) {
|
|
620
|
+
// Look for = 0 at the end
|
|
621
|
+
const text = node.text;
|
|
622
|
+
return /=\s*0\s*;?\s*$/.test(text);
|
|
623
|
+
}
|
|
624
|
+
isConstMethod(declaratorNode) {
|
|
625
|
+
// Look for const after the parameter list
|
|
626
|
+
const text = declaratorNode.text;
|
|
627
|
+
return /\)\s*const/.test(text);
|
|
628
|
+
}
|
|
629
|
+
hasNoexcept(declaratorNode) {
|
|
630
|
+
const text = declaratorNode.text;
|
|
631
|
+
return text.includes('noexcept');
|
|
632
|
+
}
|
|
633
|
+
isFunctionDeclarator(node) {
|
|
634
|
+
if (!node)
|
|
635
|
+
return false;
|
|
636
|
+
const visit = (n) => {
|
|
637
|
+
if (n.type === 'function_declarator')
|
|
638
|
+
return true;
|
|
639
|
+
for (const child of n.children) {
|
|
640
|
+
if (visit(child))
|
|
641
|
+
return true;
|
|
642
|
+
}
|
|
643
|
+
return false;
|
|
644
|
+
};
|
|
645
|
+
return visit(node);
|
|
646
|
+
}
|
|
647
|
+
isScopedEnum(node) {
|
|
648
|
+
for (const child of node.children) {
|
|
649
|
+
if (child.text === 'class' || child.text === 'struct') {
|
|
650
|
+
return true;
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
return false;
|
|
654
|
+
}
|
|
655
|
+
updateAccessSpecifier(node) {
|
|
656
|
+
const text = node.text.replace(':', '').trim();
|
|
657
|
+
if (text === 'public')
|
|
658
|
+
this.currentAccessSpecifier = 'public';
|
|
659
|
+
else if (text === 'protected')
|
|
660
|
+
this.currentAccessSpecifier = 'protected';
|
|
661
|
+
else if (text === 'private')
|
|
662
|
+
this.currentAccessSpecifier = 'private';
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
/**
|
|
666
|
+
* Create a C++ tree-sitter parser instance
|
|
667
|
+
*/
|
|
668
|
+
export function createCppTreeSitterParser() {
|
|
669
|
+
return new CppTreeSitterParser();
|
|
670
|
+
}
|
|
671
|
+
//# sourceMappingURL=tree-sitter-cpp-parser.js.map
|