gitnexus 1.6.6-rc.98 → 1.6.6
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 +122 -68
- package/dist/_shared/graph/types.d.ts +17 -1
- package/dist/_shared/graph/types.d.ts.map +1 -1
- package/dist/_shared/index.d.ts +3 -5
- package/dist/_shared/index.d.ts.map +1 -1
- package/dist/_shared/index.js +2 -4
- package/dist/_shared/index.js.map +1 -1
- package/dist/_shared/scope-resolution/module-scope-index.d.ts +1 -2
- package/dist/_shared/scope-resolution/module-scope-index.d.ts.map +1 -1
- package/dist/_shared/scope-resolution/module-scope-index.js +1 -2
- package/dist/_shared/scope-resolution/module-scope-index.js.map +1 -1
- package/dist/_shared/scope-resolution/parsed-file.d.ts +24 -0
- package/dist/_shared/scope-resolution/parsed-file.d.ts.map +1 -1
- package/dist/_shared/scope-resolution/reference-site.d.ts +13 -1
- package/dist/_shared/scope-resolution/reference-site.d.ts.map +1 -1
- package/dist/_shared/scope-resolution/registries/context.d.ts +1 -0
- package/dist/_shared/scope-resolution/registries/context.d.ts.map +1 -1
- package/dist/_shared/scope-resolution/registries/context.js +6 -0
- package/dist/_shared/scope-resolution/registries/context.js.map +1 -1
- package/dist/_shared/scope-resolution/registries/evidence.d.ts +2 -3
- package/dist/_shared/scope-resolution/registries/evidence.d.ts.map +1 -1
- package/dist/_shared/scope-resolution/registries/evidence.js +2 -3
- package/dist/_shared/scope-resolution/registries/evidence.js.map +1 -1
- package/dist/_shared/scope-resolution/registries/macro-registry.d.ts +29 -0
- package/dist/_shared/scope-resolution/registries/macro-registry.d.ts.map +1 -0
- package/dist/_shared/scope-resolution/registries/macro-registry.js +32 -0
- package/dist/_shared/scope-resolution/registries/macro-registry.js.map +1 -0
- package/dist/_shared/scope-resolution/symbol-definition.d.ts +9 -0
- package/dist/_shared/scope-resolution/symbol-definition.d.ts.map +1 -1
- package/dist/_shared/scope-resolution/types.d.ts +1 -1
- package/dist/_shared/scope-resolution/types.d.ts.map +1 -1
- package/dist/cli/ai-context.d.ts +35 -1
- package/dist/cli/ai-context.js +111 -12
- package/dist/cli/analyze-config.d.ts +92 -0
- package/dist/cli/analyze-config.js +364 -0
- package/dist/cli/analyze.d.ts +17 -1
- package/dist/cli/analyze.js +224 -71
- package/dist/cli/cli-message.d.ts +1 -1
- package/dist/cli/doctor.d.ts +18 -0
- package/dist/cli/doctor.js +32 -0
- package/dist/cli/i18n/en.d.ts +2 -2
- package/dist/cli/i18n/en.js +2 -2
- package/dist/cli/i18n/resources.d.ts +2 -2
- package/dist/cli/i18n/zh-CN.js +2 -2
- package/dist/cli/index.js +4 -2
- package/dist/cli/resolve-invocation.d.ts +21 -0
- package/dist/cli/resolve-invocation.js +68 -0
- package/dist/cli/setup.d.ts +33 -0
- package/dist/cli/setup.js +96 -35
- package/dist/cli/skill-gen.js +2 -2
- package/dist/cli/wiki.js +20 -4
- package/dist/core/embeddings/embedder.d.ts +1 -1
- package/dist/core/embeddings/embedder.js +14 -1
- package/dist/core/embeddings/runtime-support.d.ts +41 -0
- package/dist/core/embeddings/runtime-support.js +65 -0
- package/dist/core/group/extractors/grpc-patterns/proto.js +2 -1
- package/dist/core/group/extractors/http-patterns/java.js +15 -1
- package/dist/core/ingestion/call-processor.d.ts +57 -227
- package/dist/core/ingestion/call-processor.js +172 -2595
- package/dist/core/ingestion/call-routing.d.ts +6 -5
- package/dist/core/ingestion/call-routing.js +6 -6
- package/dist/core/ingestion/call-types.d.ts +0 -75
- package/dist/core/ingestion/class-extractors/configs/c-cpp.js +26 -1
- package/dist/core/ingestion/class-extractors/configs/ruby.js +3 -0
- package/dist/core/ingestion/class-extractors/generic.js +9 -11
- package/dist/core/ingestion/class-types.d.ts +23 -0
- package/dist/core/ingestion/cobol/cobol-preprocessor.d.ts +11 -0
- package/dist/core/ingestion/cobol/cobol-preprocessor.js +227 -73
- package/dist/core/ingestion/cobol-processor.d.ts +1 -0
- package/dist/core/ingestion/cobol-processor.js +51 -2
- package/dist/core/ingestion/emit-references.js +8 -2
- package/dist/core/ingestion/export-detection.d.ts +2 -1
- package/dist/core/ingestion/export-detection.js +2 -6
- package/dist/core/ingestion/field-extractors/configs/dart.d.ts +0 -6
- package/dist/core/ingestion/field-extractors/configs/dart.js +62 -44
- package/dist/core/ingestion/field-extractors/configs/go.d.ts +0 -9
- package/dist/core/ingestion/field-extractors/configs/go.js +40 -1
- package/dist/core/ingestion/field-extractors/configs/jvm.js +43 -4
- package/dist/core/ingestion/field-extractors/configs/php.js +1 -2
- package/dist/core/ingestion/field-extractors/configs/swift.d.ts +12 -1
- package/dist/core/ingestion/field-extractors/configs/swift.js +31 -6
- package/dist/core/ingestion/field-extractors/generic.d.ts +6 -0
- package/dist/core/ingestion/field-extractors/generic.js +5 -4
- package/dist/core/ingestion/field-extractors/typescript.js +0 -29
- package/dist/core/ingestion/filesystem-walker.d.ts +0 -9
- package/dist/core/ingestion/filesystem-walker.js +0 -11
- package/dist/core/ingestion/finalize-orchestrator.js +14 -2
- package/dist/core/ingestion/import-resolvers/configs/swift.d.ts +21 -0
- package/dist/core/ingestion/import-resolvers/configs/swift.js +72 -11
- package/dist/core/ingestion/import-resolvers/python.d.ts +1 -1
- package/dist/core/ingestion/import-resolvers/standard.d.ts +2 -2
- package/dist/core/ingestion/import-resolvers/standard.js +6 -5
- package/dist/core/ingestion/import-resolvers/utils.d.ts +2 -5
- package/dist/core/ingestion/import-resolvers/utils.js +1 -9
- package/dist/core/ingestion/language-provider.d.ts +39 -119
- package/dist/core/ingestion/language-provider.js +0 -2
- package/dist/core/ingestion/languages/c/capture-side-channel.d.ts +62 -0
- package/dist/core/ingestion/languages/c/capture-side-channel.js +65 -0
- package/dist/core/ingestion/languages/c/captures.js +41 -23
- package/dist/core/ingestion/languages/c/import-decomposer.d.ts +9 -0
- package/dist/core/ingestion/languages/c/import-decomposer.js +15 -0
- package/dist/core/ingestion/languages/c/import-target.js +52 -9
- package/dist/core/ingestion/languages/c/index.d.ts +2 -1
- package/dist/core/ingestion/languages/c/index.js +2 -1
- package/dist/core/ingestion/languages/c/query.js +15 -0
- package/dist/core/ingestion/languages/c/scope-resolver.js +47 -4
- package/dist/core/ingestion/languages/c/static-linkage.d.ts +8 -0
- package/dist/core/ingestion/languages/c/static-linkage.js +46 -1
- package/dist/core/ingestion/languages/c-cpp.js +16 -7
- package/dist/core/ingestion/languages/cobol/captures.js +25 -2
- package/dist/core/ingestion/languages/cpp/adl.d.ts +88 -4
- package/dist/core/ingestion/languages/cpp/adl.js +380 -160
- package/dist/core/ingestion/languages/cpp/arity-metadata.js +2 -8
- package/dist/core/ingestion/languages/cpp/capture-side-channel.d.ts +65 -0
- package/dist/core/ingestion/languages/cpp/capture-side-channel.js +78 -0
- package/dist/core/ingestion/languages/cpp/captures.js +162 -54
- package/dist/core/ingestion/languages/cpp/file-local-linkage.d.ts +18 -52
- package/dist/core/ingestion/languages/cpp/file-local-linkage.js +49 -1
- package/dist/core/ingestion/languages/cpp/import-decomposer.d.ts +7 -0
- package/dist/core/ingestion/languages/cpp/import-decomposer.js +12 -0
- package/dist/core/ingestion/languages/cpp/index.d.ts +1 -0
- package/dist/core/ingestion/languages/cpp/index.js +1 -0
- package/dist/core/ingestion/languages/cpp/inline-namespaces.d.ts +8 -0
- package/dist/core/ingestion/languages/cpp/inline-namespaces.js +21 -0
- package/dist/core/ingestion/languages/cpp/query.js +21 -0
- package/dist/core/ingestion/languages/cpp/range-bindings.js +20 -5
- package/dist/core/ingestion/languages/cpp/scope-resolver.js +52 -5
- package/dist/core/ingestion/languages/cpp/two-phase-lookup.d.ts +20 -0
- package/dist/core/ingestion/languages/cpp/two-phase-lookup.js +83 -3
- package/dist/core/ingestion/languages/csharp/captures.js +205 -41
- package/dist/core/ingestion/languages/csharp/index.d.ts +3 -4
- package/dist/core/ingestion/languages/csharp/index.js +3 -4
- package/dist/core/ingestion/languages/csharp/interpret.js +17 -3
- package/dist/core/ingestion/languages/csharp/namespace-siblings.d.ts +17 -7
- package/dist/core/ingestion/languages/csharp/namespace-siblings.js +129 -124
- package/dist/core/ingestion/languages/csharp/qualified-type-names.d.ts +14 -0
- package/dist/core/ingestion/languages/csharp/qualified-type-names.js +59 -0
- package/dist/core/ingestion/languages/csharp/query.js +13 -0
- package/dist/core/ingestion/languages/csharp/receiver-binding.js +10 -6
- package/dist/core/ingestion/languages/csharp/scope-resolver.js +8 -1
- package/dist/core/ingestion/languages/csharp.js +0 -5
- package/dist/core/ingestion/languages/dart/arity-metadata.d.ts +25 -0
- package/dist/core/ingestion/languages/dart/arity-metadata.js +35 -0
- package/dist/core/ingestion/languages/dart/arity.d.ts +19 -0
- package/dist/core/ingestion/languages/dart/arity.js +31 -0
- package/dist/core/ingestion/languages/dart/built-ins.d.ts +11 -0
- package/dist/core/ingestion/languages/dart/built-ins.js +34 -0
- package/dist/core/ingestion/languages/dart/cache-stats.d.ts +13 -0
- package/dist/core/ingestion/languages/dart/cache-stats.js +24 -0
- package/dist/core/ingestion/languages/dart/captures.d.ts +29 -0
- package/dist/core/ingestion/languages/dart/captures.js +445 -0
- package/dist/core/ingestion/languages/dart/expand-wildcards.d.ts +13 -0
- package/dist/core/ingestion/languages/dart/expand-wildcards.js +31 -0
- package/dist/core/ingestion/languages/dart/import-target.d.ts +15 -0
- package/dist/core/ingestion/languages/dart/import-target.js +65 -0
- package/dist/core/ingestion/languages/dart/index.d.ts +28 -0
- package/dist/core/ingestion/languages/dart/index.js +28 -0
- package/dist/core/ingestion/languages/dart/interpret.d.ts +24 -0
- package/dist/core/ingestion/languages/dart/interpret.js +95 -0
- package/dist/core/ingestion/languages/dart/merge-bindings.d.ts +10 -0
- package/dist/core/ingestion/languages/dart/merge-bindings.js +39 -0
- package/dist/core/ingestion/languages/dart/query.d.ts +26 -0
- package/dist/core/ingestion/languages/dart/query.js +142 -0
- package/dist/core/ingestion/languages/dart/receiver-binding.d.ts +24 -0
- package/dist/core/ingestion/languages/dart/receiver-binding.js +87 -0
- package/dist/core/ingestion/languages/dart/scope-resolver.d.ts +29 -0
- package/dist/core/ingestion/languages/dart/scope-resolver.js +194 -0
- package/dist/core/ingestion/languages/dart/signature-bindings.d.ts +23 -0
- package/dist/core/ingestion/languages/dart/signature-bindings.js +51 -0
- package/dist/core/ingestion/languages/dart/simple-hooks.d.ts +20 -0
- package/dist/core/ingestion/languages/dart/simple-hooks.js +47 -0
- package/dist/core/ingestion/languages/dart.d.ts +0 -1
- package/dist/core/ingestion/languages/dart.js +15 -29
- package/dist/core/ingestion/languages/go/arity-metadata.d.ts +1 -0
- package/dist/core/ingestion/languages/go/arity-metadata.js +31 -1
- package/dist/core/ingestion/languages/go/captures.js +247 -26
- package/dist/core/ingestion/languages/go/interface-impls.js +476 -50
- package/dist/core/ingestion/languages/go/interpret.js +21 -11
- package/dist/core/ingestion/languages/go/method-owners.js +20 -8
- package/dist/core/ingestion/languages/go/query.js +15 -7
- package/dist/core/ingestion/languages/go/range-binding.js +24 -9
- package/dist/core/ingestion/languages/go/receiver-binding.js +1 -1
- package/dist/core/ingestion/languages/go/scope-resolver.js +2 -2
- package/dist/core/ingestion/languages/go/simple-hooks.js +10 -5
- package/dist/core/ingestion/languages/go/type-binding.d.ts +1 -0
- package/dist/core/ingestion/languages/go/type-binding.js +40 -2
- package/dist/core/ingestion/languages/go.d.ts +0 -1
- package/dist/core/ingestion/languages/go.js +0 -5
- package/dist/core/ingestion/languages/index.d.ts +0 -5
- package/dist/core/ingestion/languages/index.js +0 -3
- package/dist/core/ingestion/languages/java/captures.js +252 -23
- package/dist/core/ingestion/languages/java/interpret.js +12 -6
- package/dist/core/ingestion/languages/java/package-siblings.js +18 -5
- package/dist/core/ingestion/languages/java/query.js +16 -1
- package/dist/core/ingestion/languages/java/scope-resolver.d.ts +2 -8
- package/dist/core/ingestion/languages/java/scope-resolver.js +2 -8
- package/dist/core/ingestion/languages/java.js +0 -5
- package/dist/core/ingestion/languages/javascript/captures.js +185 -11
- package/dist/core/ingestion/languages/javascript/query.js +107 -1
- package/dist/core/ingestion/languages/kotlin/capture-side-channel.d.ts +57 -0
- package/dist/core/ingestion/languages/kotlin/capture-side-channel.js +60 -0
- package/dist/core/ingestion/languages/kotlin/captures.js +213 -22
- package/dist/core/ingestion/languages/kotlin/companion-scopes.d.ts +7 -0
- package/dist/core/ingestion/languages/kotlin/companion-scopes.js +10 -0
- package/dist/core/ingestion/languages/kotlin/index.d.ts +1 -0
- package/dist/core/ingestion/languages/kotlin/index.js +1 -0
- package/dist/core/ingestion/languages/kotlin/query.js +30 -0
- package/dist/core/ingestion/languages/kotlin/scope-resolver.d.ts +5 -7
- package/dist/core/ingestion/languages/kotlin/scope-resolver.js +22 -7
- package/dist/core/ingestion/languages/kotlin.js +8 -5
- package/dist/core/ingestion/languages/php/captures.js +135 -19
- package/dist/core/ingestion/languages/php/import-decomposer.js +21 -63
- package/dist/core/ingestion/languages/php/index.d.ts +3 -4
- package/dist/core/ingestion/languages/php/index.js +3 -4
- package/dist/core/ingestion/languages/php/query.js +5 -0
- package/dist/core/ingestion/languages/php/receiver-binding.js +8 -4
- package/dist/core/ingestion/languages/php.js +0 -4
- package/dist/core/ingestion/languages/python/captures.js +128 -13
- package/dist/core/ingestion/languages/python/depends-references.js +1 -1
- package/dist/core/ingestion/languages/python/import-target.d.ts +4 -5
- package/dist/core/ingestion/languages/python/import-target.js +108 -16
- package/dist/core/ingestion/languages/python/index-stats.d.ts +18 -0
- package/dist/core/ingestion/languages/python/index-stats.js +25 -0
- package/dist/core/ingestion/languages/python/index.d.ts +3 -4
- package/dist/core/ingestion/languages/python/index.js +3 -4
- package/dist/core/ingestion/languages/python/query.js +17 -0
- package/dist/core/ingestion/languages/python/scope-resolver.js +7 -6
- package/dist/core/ingestion/languages/python.d.ts +0 -2
- package/dist/core/ingestion/languages/python.js +0 -7
- package/dist/core/ingestion/languages/ruby/captures.js +174 -31
- package/dist/core/ingestion/languages/ruby/import-target.js +2 -1
- package/dist/core/ingestion/languages/ruby/interpret.js +2 -1
- package/dist/core/ingestion/languages/ruby/query.js +10 -0
- package/dist/core/ingestion/languages/ruby/scope-resolver.js +61 -11
- package/dist/core/ingestion/languages/ruby.js +4 -53
- package/dist/core/ingestion/languages/rust/captures.js +95 -13
- package/dist/core/ingestion/languages/rust/query.js +64 -1
- package/dist/core/ingestion/languages/rust/range-binding.js +40 -12
- package/dist/core/ingestion/languages/rust/receiver-binding.js +9 -0
- package/dist/core/ingestion/languages/rust/scope-resolver.js +75 -1
- package/dist/core/ingestion/languages/rust.d.ts +0 -2
- package/dist/core/ingestion/languages/rust.js +0 -6
- package/dist/core/ingestion/languages/swift/arity-metadata.d.ts +24 -0
- package/dist/core/ingestion/languages/swift/arity-metadata.js +41 -0
- package/dist/core/ingestion/languages/swift/arity.d.ts +29 -0
- package/dist/core/ingestion/languages/swift/arity.js +42 -0
- package/dist/core/ingestion/languages/swift/base-type.d.ts +20 -0
- package/dist/core/ingestion/languages/swift/base-type.js +27 -0
- package/dist/core/ingestion/languages/swift/cache-stats.d.ts +15 -0
- package/dist/core/ingestion/languages/swift/cache-stats.js +26 -0
- package/dist/core/ingestion/languages/swift/captures.d.ts +35 -0
- package/dist/core/ingestion/languages/swift/captures.js +495 -0
- package/dist/core/ingestion/languages/swift/implicit-imports.d.ts +34 -0
- package/dist/core/ingestion/languages/swift/implicit-imports.js +57 -0
- package/dist/core/ingestion/languages/swift/import-decomposer.d.ts +24 -0
- package/dist/core/ingestion/languages/swift/import-decomposer.js +84 -0
- package/dist/core/ingestion/languages/swift/import-target.d.ts +33 -0
- package/dist/core/ingestion/languages/swift/import-target.js +81 -0
- package/dist/core/ingestion/languages/swift/index.d.ts +37 -0
- package/dist/core/ingestion/languages/swift/index.js +37 -0
- package/dist/core/ingestion/languages/swift/interpret.d.ts +15 -0
- package/dist/core/ingestion/languages/swift/interpret.js +89 -0
- package/dist/core/ingestion/languages/swift/merge-bindings.d.ts +20 -0
- package/dist/core/ingestion/languages/swift/merge-bindings.js +48 -0
- package/dist/core/ingestion/languages/swift/query.d.ts +46 -0
- package/dist/core/ingestion/languages/swift/query.js +194 -0
- package/dist/core/ingestion/languages/swift/receiver-binding.d.ts +40 -0
- package/dist/core/ingestion/languages/swift/receiver-binding.js +161 -0
- package/dist/core/ingestion/languages/swift/scope-resolver.d.ts +50 -0
- package/dist/core/ingestion/languages/swift/scope-resolver.js +189 -0
- package/dist/core/ingestion/languages/swift/sibling-type-bindings.d.ts +34 -0
- package/dist/core/ingestion/languages/swift/sibling-type-bindings.js +65 -0
- package/dist/core/ingestion/languages/swift/signature-bindings.d.ts +25 -0
- package/dist/core/ingestion/languages/swift/signature-bindings.js +66 -0
- package/dist/core/ingestion/languages/swift/simple-hooks.d.ts +37 -0
- package/dist/core/ingestion/languages/swift/simple-hooks.js +60 -0
- package/dist/core/ingestion/languages/swift/target-grouping.d.ts +51 -0
- package/dist/core/ingestion/languages/swift/target-grouping.js +93 -0
- package/dist/core/ingestion/languages/swift/target-siblings.d.ts +30 -0
- package/dist/core/ingestion/languages/swift/target-siblings.js +71 -0
- package/dist/core/ingestion/languages/swift.d.ts +0 -5
- package/dist/core/ingestion/languages/swift.js +11 -87
- package/dist/core/ingestion/languages/typescript/array-callback.d.ts +3 -29
- package/dist/core/ingestion/languages/typescript/array-callback.js +4 -43
- package/dist/core/ingestion/languages/typescript/captures.js +147 -17
- package/dist/core/ingestion/languages/typescript/index.d.ts +3 -4
- package/dist/core/ingestion/languages/typescript/index.js +3 -4
- package/dist/core/ingestion/languages/typescript/query.d.ts +2 -3
- package/dist/core/ingestion/languages/typescript/query.js +125 -4
- package/dist/core/ingestion/languages/typescript/receiver-binding.js +0 -1
- package/dist/core/ingestion/languages/typescript.d.ts +2 -3
- package/dist/core/ingestion/languages/typescript.js +46 -23
- package/dist/core/ingestion/languages/vue/captures.d.ts +46 -0
- package/dist/core/ingestion/languages/vue/captures.js +67 -0
- package/dist/core/ingestion/languages/vue/import-target.d.ts +27 -0
- package/dist/core/ingestion/languages/vue/import-target.js +58 -0
- package/dist/core/ingestion/languages/vue/index.d.ts +49 -0
- package/dist/core/ingestion/languages/vue/index.js +49 -0
- package/dist/core/ingestion/languages/vue/scope-resolver.d.ts +55 -0
- package/dist/core/ingestion/languages/vue/scope-resolver.js +292 -0
- package/dist/core/ingestion/languages/vue.js +12 -4
- package/dist/core/ingestion/local-symbol-pruner.d.ts +11 -0
- package/dist/core/ingestion/local-symbol-pruner.js +63 -0
- package/dist/core/ingestion/method-extractors/configs/dart.js +14 -1
- package/dist/core/ingestion/method-extractors/configs/jvm.js +37 -20
- package/dist/core/ingestion/method-extractors/configs/php.js +0 -1
- package/dist/core/ingestion/method-extractors/configs/swift.js +11 -4
- package/dist/core/ingestion/method-types.d.ts +2 -2
- package/dist/core/ingestion/model/index.d.ts +0 -3
- package/dist/core/ingestion/model/index.js +0 -8
- package/dist/core/ingestion/model/resolve.d.ts +7 -43
- package/dist/core/ingestion/model/resolve.js +7 -226
- package/dist/core/ingestion/model/scope-resolution-indexes.d.ts +46 -1
- package/dist/core/ingestion/model/semantic-model.d.ts +4 -6
- package/dist/core/ingestion/model/semantic-model.js +1 -1
- package/dist/core/ingestion/model/symbol-table.d.ts +3 -4
- package/dist/core/ingestion/model/symbol-table.js +3 -4
- package/dist/core/ingestion/parsing-processor.d.ts +30 -24
- package/dist/core/ingestion/parsing-processor.js +76 -640
- package/dist/core/ingestion/pipeline-phases/communities.d.ts +1 -1
- package/dist/core/ingestion/pipeline-phases/communities.js +5 -2
- package/dist/core/ingestion/pipeline-phases/cross-file.d.ts +9 -8
- package/dist/core/ingestion/pipeline-phases/cross-file.js +16 -12
- package/dist/core/ingestion/pipeline-phases/index.d.ts +1 -0
- package/dist/core/ingestion/pipeline-phases/index.js +1 -0
- package/dist/core/ingestion/pipeline-phases/mro.d.ts +1 -1
- package/dist/core/ingestion/pipeline-phases/mro.js +2 -2
- package/dist/core/ingestion/pipeline-phases/parse-impl.d.ts +44 -22
- package/dist/core/ingestion/pipeline-phases/parse-impl.js +426 -565
- package/dist/core/ingestion/pipeline-phases/parse.d.ts +13 -33
- package/dist/core/ingestion/pipeline-phases/parse.js +2 -2
- package/dist/core/ingestion/pipeline-phases/processes.d.ts +1 -1
- package/dist/core/ingestion/pipeline-phases/processes.js +5 -3
- package/dist/core/ingestion/pipeline-phases/prune-local-symbols.d.ts +14 -0
- package/dist/core/ingestion/pipeline-phases/prune-local-symbols.js +26 -0
- package/dist/core/ingestion/pipeline.d.ts +27 -19
- package/dist/core/ingestion/pipeline.js +4 -2
- package/dist/core/ingestion/resolve-references.js +15 -3
- package/dist/core/ingestion/route-extractors/laravel.d.ts +10 -0
- package/dist/core/ingestion/route-extractors/laravel.js +88 -9
- package/dist/core/ingestion/scope-extractor-bridge.d.ts +2 -1
- package/dist/core/ingestion/scope-extractor-bridge.js +2 -2
- package/dist/core/ingestion/scope-extractor.js +13 -0
- package/dist/core/ingestion/scope-resolution/contract/scope-resolver.d.ts +181 -15
- package/dist/core/ingestion/scope-resolution/contract/scope-resolver.js +21 -10
- package/dist/core/ingestion/scope-resolution/graph-bridge/edges.js +10 -2
- package/dist/core/ingestion/scope-resolution/graph-bridge/ids.d.ts +7 -1
- package/dist/core/ingestion/scope-resolution/graph-bridge/ids.js +58 -6
- package/dist/core/ingestion/scope-resolution/graph-bridge/node-lookup.js +24 -5
- package/dist/core/ingestion/scope-resolution/passes/free-call-fallback.d.ts +68 -1
- package/dist/core/ingestion/scope-resolution/passes/free-call-fallback.js +189 -29
- package/dist/core/ingestion/scope-resolution/passes/imported-return-types.js +21 -1
- package/dist/core/ingestion/scope-resolution/passes/receiver-bound-calls.js +1 -1
- package/dist/core/ingestion/scope-resolution/pipeline/phase.d.ts +8 -11
- package/dist/core/ingestion/scope-resolution/pipeline/phase.js +171 -50
- package/dist/core/ingestion/scope-resolution/pipeline/registry.d.ts +3 -4
- package/dist/core/ingestion/scope-resolution/pipeline/registry.js +9 -4
- package/dist/core/ingestion/scope-resolution/pipeline/run.d.ts +28 -5
- package/dist/core/ingestion/scope-resolution/pipeline/run.js +191 -24
- package/dist/core/ingestion/scope-resolution/pipeline/validate-bindings-immutability.js +31 -0
- package/dist/core/ingestion/scope-resolution/scope/walkers.d.ts +72 -0
- package/dist/core/ingestion/scope-resolution/scope/walkers.js +440 -39
- package/dist/core/ingestion/scope-resolution/workspace-index.d.ts +18 -2
- package/dist/core/ingestion/scope-resolution/workspace-index.js +94 -7
- package/dist/core/ingestion/tree-sitter-queries.d.ts +14 -14
- package/dist/core/ingestion/tree-sitter-queries.js +380 -158
- package/dist/core/ingestion/ts-js-hoc-utils.d.ts +12 -0
- package/dist/core/ingestion/ts-js-hoc-utils.js +105 -0
- package/dist/core/ingestion/type-env.d.ts +2 -1
- package/dist/core/ingestion/type-env.js +6 -8
- package/dist/core/ingestion/type-extractors/c-cpp.js +8 -10
- package/dist/core/ingestion/type-extractors/csharp.js +18 -34
- package/dist/core/ingestion/type-extractors/go.js +2 -10
- package/dist/core/ingestion/type-extractors/jvm.js +6 -5
- package/dist/core/ingestion/type-extractors/php.js +1 -1
- package/dist/core/ingestion/type-extractors/python.js +1 -1
- package/dist/core/ingestion/type-extractors/ruby.js +2 -2
- package/dist/core/ingestion/type-extractors/rust.js +0 -16
- package/dist/core/ingestion/type-extractors/shared.d.ts +2 -2
- package/dist/core/ingestion/type-extractors/shared.js +25 -11
- package/dist/core/ingestion/type-extractors/swift.js +5 -5
- package/dist/core/ingestion/type-extractors/types.d.ts +1 -1
- package/dist/core/ingestion/type-extractors/typescript.js +1 -1
- package/dist/core/ingestion/utils/ast-helpers.d.ts +119 -1
- package/dist/core/ingestion/utils/ast-helpers.js +260 -13
- package/dist/core/ingestion/utils/callable-labels.d.ts +13 -0
- package/dist/core/ingestion/utils/callable-labels.js +14 -0
- package/dist/core/ingestion/utils/deferred-resolution-profile.d.ts +10 -0
- package/dist/core/ingestion/utils/deferred-resolution-profile.js +30 -0
- package/dist/core/ingestion/utils/heap-probe.d.ts +20 -0
- package/dist/core/ingestion/utils/heap-probe.js +39 -0
- package/dist/core/ingestion/utils/heritage-marker.d.ts +33 -0
- package/dist/core/ingestion/utils/heritage-marker.js +41 -0
- package/dist/core/ingestion/utils/qualified-name.d.ts +37 -0
- package/dist/core/ingestion/utils/qualified-name.js +67 -0
- package/dist/core/ingestion/variable-extractors/configs/c-cpp.js +49 -0
- package/dist/core/ingestion/variable-extractors/configs/dart.js +76 -62
- package/dist/core/ingestion/variable-extractors/configs/go.js +74 -7
- package/dist/core/ingestion/variable-extractors/configs/jvm.js +35 -8
- package/dist/core/ingestion/variable-extractors/generic.js +40 -12
- package/dist/core/ingestion/variable-types.d.ts +9 -0
- package/dist/core/ingestion/vue-sfc-extractor.d.ts +97 -7
- package/dist/core/ingestion/vue-sfc-extractor.js +433 -11
- package/dist/core/ingestion/workers/parse-worker.d.ts +0 -11
- package/dist/core/ingestion/workers/parse-worker.js +358 -187
- package/dist/core/ingestion/workers/worker-pool.d.ts +78 -9
- package/dist/core/ingestion/workers/worker-pool.js +346 -49
- package/dist/core/lbug/csv-generator.js +20 -2
- package/dist/core/lbug/lbug-adapter.js +29 -10
- package/dist/core/lbug/native-check.js +17 -5
- package/dist/core/lbug/pool-adapter.d.ts +0 -19
- package/dist/core/lbug/pool-adapter.js +40 -77
- package/dist/core/lbug/query-result-utils.d.ts +19 -0
- package/dist/core/lbug/query-result-utils.js +28 -0
- package/dist/core/run-analyze.d.ts +9 -2
- package/dist/core/run-analyze.js +24 -3
- package/dist/core/tree-sitter/parser-loader.d.ts +13 -0
- package/dist/core/tree-sitter/parser-loader.js +4 -0
- package/dist/core/tree-sitter/safe-parse.d.ts +70 -3
- package/dist/core/tree-sitter/safe-parse.js +214 -11
- package/dist/core/wiki/generator.js +13 -5
- package/dist/core/wiki/graph-queries.d.ts +3 -0
- package/dist/core/wiki/graph-queries.js +9 -1
- package/dist/core/wiki/llm-client.d.ts +1 -1
- package/dist/core/wiki/llm-client.js +7 -2
- package/dist/core/wiki/local-cli-client.d.ts +2 -1
- package/dist/core/wiki/local-cli-client.js +62 -4
- package/dist/mcp/compatible-stdio-transport.d.ts +3 -0
- package/dist/mcp/compatible-stdio-transport.js +22 -0
- package/dist/mcp/core/embedder.d.ts +1 -1
- package/dist/mcp/core/embedder.js +13 -1
- package/dist/mcp/local/local-backend.d.ts +37 -5
- package/dist/mcp/local/local-backend.js +227 -129
- package/dist/mcp/resources.js +3 -3
- package/dist/mcp/server.js +9 -1
- package/dist/storage/git.d.ts +11 -0
- package/dist/storage/git.js +30 -0
- package/dist/storage/parse-cache.d.ts +23 -1
- package/dist/storage/parse-cache.js +138 -32
- package/dist/storage/parsedfile-store.d.ts +142 -0
- package/dist/storage/parsedfile-store.js +367 -0
- package/dist/storage/repo-manager.d.ts +2 -1
- package/dist/storage/scope-index-store.d.ts +114 -0
- package/dist/storage/scope-index-store.js +236 -0
- package/dist/types/pipeline.d.ts +6 -3
- package/hooks/antigravity/gitnexus-antigravity-hook.cjs +2 -1
- package/hooks/claude/gitnexus-hook.cjs +2 -1
- package/hooks/claude/resolve-analyze-cmd.cjs +323 -0
- package/package.json +4 -5
- package/scripts/bench-scope-resolution.ts +1 -3
- package/scripts/cross-platform-tests.ts +4 -1
- package/skills/gitnexus-cli.md +8 -6
- package/skills/gitnexus-debugging.md +15 -15
- package/skills/gitnexus-exploring.md +11 -11
- package/skills/gitnexus-guide.md +1 -1
- package/skills/gitnexus-impact-analysis.md +10 -10
- package/skills/gitnexus-pr-review.md +19 -19
- package/skills/gitnexus-refactoring.md +25 -25
- package/web/assets/{agent-BRX-afm3.js → agent-EkX7webX.js} +156 -131
- package/web/assets/{architectureDiagram-UL44E2DR-B1oYB8-c.js → architectureDiagram-UL44E2DR-BoczH8cv.js} +1 -1
- package/web/assets/{chunk-LCXTWHL2-SPC6pgWI.js → chunk-LCXTWHL2-By5HB3b-.js} +1 -1
- package/web/assets/{chunk-RG4AUYOV-DZXr4Yv3.js → chunk-RG4AUYOV-BQE_DkpL.js} +1 -1
- package/web/assets/{classDiagram-KGZ6W3CR-BqpOj8L9.js → classDiagram-KGZ6W3CR-Dj_02GUH.js} +1 -1
- package/web/assets/{classDiagram-v2-72OJOZXJ-FmElywK2.js → classDiagram-v2-72OJOZXJ-D-NArMpf.js} +1 -1
- package/web/assets/{diagram-3NCE3AQN-BWtJXMDq.js → diagram-3NCE3AQN-VXtXDO95.js} +1 -1
- package/web/assets/{diagram-GF46GFSD-Hh-fChxU.js → diagram-GF46GFSD-B1qab2Ah.js} +1 -1
- package/web/assets/{diagram-QXG6HAR7-DYeQHxGU.js → diagram-QXG6HAR7-BSCHGzzT.js} +1 -1
- package/web/assets/{diagram-WEQXMOUZ-DYGU4T0y.js → diagram-WEQXMOUZ-DHtknmNT.js} +1 -1
- package/web/assets/{erDiagram-L5TCEMPS-bN3wlP2A.js → erDiagram-L5TCEMPS-Db-IYTmm.js} +1 -1
- package/web/assets/{flowDiagram-H6V6AXG4-YACVtF3-.js → flowDiagram-H6V6AXG4-BHDoyVoW.js} +1 -1
- package/web/assets/{index-BhnAdWTt.js → index-BR0IhgbR.js} +10 -10
- package/web/assets/{infoDiagram-3YFTVSEB-BWBzD28-.js → infoDiagram-3YFTVSEB-6h8wbWEe.js} +1 -1
- package/web/assets/{ishikawaDiagram-BNXS4ZKH-B8qYT-j9.js → ishikawaDiagram-BNXS4ZKH-Dx2OkPk1.js} +1 -1
- package/web/assets/{kanban-definition-75IXJCU3-BeoPr5Tl.js → kanban-definition-75IXJCU3-CIIEZfqV.js} +1 -1
- package/web/assets/{mindmap-definition-2TDM6QVE-CdLLN_so.js → mindmap-definition-2TDM6QVE-DUAqydRq.js} +1 -1
- package/web/assets/{pieDiagram-CU6KROY3-DEd2a_k_.js → pieDiagram-CU6KROY3-BntYuYZa.js} +1 -1
- package/web/assets/{requirementDiagram-JXO7QTGE-QNeTo5C_.js → requirementDiagram-JXO7QTGE-QCD6I29n.js} +1 -1
- package/web/assets/{sequenceDiagram-VS2MUI6T-BHC7q7yJ.js → sequenceDiagram-VS2MUI6T-DScFwLz2.js} +1 -1
- package/web/assets/{stateDiagram-7D4R322I-KONnc2Px.js → stateDiagram-7D4R322I-AkRAm6Hl.js} +1 -1
- package/web/assets/{stateDiagram-v2-36443NZ5-C2QfuMlu.js → stateDiagram-v2-36443NZ5-BCK1vigR.js} +1 -1
- package/web/assets/{timeline-definition-O6YCAMPW-D4t4NJx1.js → timeline-definition-O6YCAMPW-BvpIVXjX.js} +1 -1
- package/web/assets/{vennDiagram-MWXL3ELB-6bctC9Yg.js → vennDiagram-MWXL3ELB-BYGWk6dK.js} +1 -1
- package/web/assets/{wardleyDiagram-CUQ6CDDI-BPZYNTvC.js → wardleyDiagram-CUQ6CDDI-Dk1z7H2T.js} +1 -1
- package/web/assets/{xychartDiagram-N2JHSOCM-lBI9O6DW.js → xychartDiagram-N2JHSOCM-2N6NCSWN.js} +1 -1
- package/web/index.html +1 -1
- package/dist/_shared/scope-resolution/shadow/aggregate.d.ts +0 -63
- package/dist/_shared/scope-resolution/shadow/aggregate.d.ts.map +0 -1
- package/dist/_shared/scope-resolution/shadow/aggregate.js +0 -122
- package/dist/_shared/scope-resolution/shadow/aggregate.js.map +0 -1
- package/dist/_shared/scope-resolution/shadow/diff.d.ts +0 -59
- package/dist/_shared/scope-resolution/shadow/diff.d.ts.map +0 -1
- package/dist/_shared/scope-resolution/shadow/diff.js +0 -79
- package/dist/_shared/scope-resolution/shadow/diff.js.map +0 -1
- package/dist/core/ingestion/ast-cache.d.ts +0 -26
- package/dist/core/ingestion/ast-cache.js +0 -48
- package/dist/core/ingestion/heritage-extractors/configs/go.d.ts +0 -13
- package/dist/core/ingestion/heritage-extractors/configs/go.js +0 -20
- package/dist/core/ingestion/heritage-extractors/configs/ruby.d.ts +0 -18
- package/dist/core/ingestion/heritage-extractors/configs/ruby.js +0 -65
- package/dist/core/ingestion/heritage-extractors/generic.d.ts +0 -23
- package/dist/core/ingestion/heritage-extractors/generic.js +0 -47
- package/dist/core/ingestion/heritage-processor.d.ts +0 -54
- package/dist/core/ingestion/heritage-processor.js +0 -367
- package/dist/core/ingestion/heritage-types.d.ts +0 -73
- package/dist/core/ingestion/heritage-types.js +0 -2
- package/dist/core/ingestion/import-processor.d.ts +0 -23
- package/dist/core/ingestion/import-processor.js +0 -377
- package/dist/core/ingestion/model/heritage-map.d.ts +0 -105
- package/dist/core/ingestion/model/heritage-map.js +0 -294
- package/dist/core/ingestion/model/resolution-context.d.ts +0 -93
- package/dist/core/ingestion/model/resolution-context.js +0 -337
- package/dist/core/ingestion/named-bindings/csharp.d.ts +0 -3
- package/dist/core/ingestion/named-bindings/csharp.js +0 -37
- package/dist/core/ingestion/named-bindings/java.d.ts +0 -3
- package/dist/core/ingestion/named-bindings/java.js +0 -29
- package/dist/core/ingestion/named-bindings/kotlin.d.ts +0 -3
- package/dist/core/ingestion/named-bindings/kotlin.js +0 -36
- package/dist/core/ingestion/named-bindings/php.d.ts +0 -3
- package/dist/core/ingestion/named-bindings/php.js +0 -61
- package/dist/core/ingestion/named-bindings/python.d.ts +0 -3
- package/dist/core/ingestion/named-bindings/python.js +0 -49
- package/dist/core/ingestion/named-bindings/rust.d.ts +0 -3
- package/dist/core/ingestion/named-bindings/rust.js +0 -66
- package/dist/core/ingestion/named-bindings/types.d.ts +0 -16
- package/dist/core/ingestion/named-bindings/types.js +0 -6
- package/dist/core/ingestion/named-bindings/typescript.d.ts +0 -3
- package/dist/core/ingestion/named-bindings/typescript.js +0 -58
- package/dist/core/ingestion/pipeline-phases/cross-file-impl.d.ts +0 -17
- package/dist/core/ingestion/pipeline-phases/cross-file-impl.js +0 -209
- package/dist/core/ingestion/pipeline-phases/orm-extraction.d.ts +0 -22
- package/dist/core/ingestion/pipeline-phases/orm-extraction.js +0 -92
- package/dist/core/ingestion/pipeline-phases/wildcard-synthesis.d.ts +0 -70
- package/dist/core/ingestion/pipeline-phases/wildcard-synthesis.js +0 -312
- package/dist/core/ingestion/registry-primary-flag.d.ts +0 -89
- package/dist/core/ingestion/registry-primary-flag.js +0 -122
- package/dist/core/ingestion/shadow-harness.d.ts +0 -113
- package/dist/core/ingestion/shadow-harness.js +0 -148
- package/dist/core/ingestion/utils/ruby-self-call.d.ts +0 -52
- package/dist/core/ingestion/utils/ruby-self-call.js +0 -59
- package/scripts/ci-list-migrated-languages.ts +0 -24
- package/scripts/run-parity.ts +0 -128
|
@@ -129,32 +129,32 @@ const EXCLUDED_PARA_NAMES = new Set([
|
|
|
129
129
|
const RE_DIVISION = /\b(IDENTIFICATION|ENVIRONMENT|DATA|PROCEDURE)\s+DIVISION\b/i;
|
|
130
130
|
const RE_SECTION = /\b(WORKING-STORAGE|LINKAGE|FILE|LOCAL-STORAGE|SCREEN|INPUT-OUTPUT|CONFIGURATION)\s+SECTION\b/i;
|
|
131
131
|
// IDENTIFICATION DIVISION
|
|
132
|
-
const RE_PROGRAM_ID = /\bPROGRAM-ID\.\s*([A-
|
|
133
|
-
const RE_END_PROGRAM = /\bEND\s+PROGRAM\s+([A-
|
|
132
|
+
const RE_PROGRAM_ID = /\bPROGRAM-ID\.\s*([A-Z0-9][A-Z0-9-]*)(?:\s+IS\s+COMMON)?/i;
|
|
133
|
+
const RE_END_PROGRAM = /\bEND\s+PROGRAM\s+([A-Z0-9][A-Z0-9-]*)\s*\./i;
|
|
134
134
|
const RE_AUTHOR = /^\s+AUTHOR\.\s*(.+)/i;
|
|
135
135
|
const RE_DATE_WRITTEN = /^\s+DATE-WRITTEN\.\s*(.+)/i;
|
|
136
136
|
const RE_DATE_COMPILED = /^\s+DATE-COMPILED\.\s*(.+)/i;
|
|
137
137
|
const RE_INSTALLATION = /^\s+INSTALLATION\.\s*(.+)/i;
|
|
138
138
|
// ENVIRONMENT DIVISION — SELECT
|
|
139
|
-
const RE_SELECT_START = /\bSELECT\s+(?:OPTIONAL\s+)?([A-
|
|
139
|
+
const RE_SELECT_START = /\bSELECT\s+(?:OPTIONAL\s+)?([A-Z0-9][A-Z0-9-]+)/i;
|
|
140
140
|
// DATA DIVISION
|
|
141
141
|
// ^\s* (not ^\s+) to support both fixed-format (indented) and free-format (trimmed)
|
|
142
|
-
const RE_FD = /^\s*(?:FD|SD|RD)\s+([A-
|
|
143
|
-
const RE_DATA_ITEM = /^\s*(\d{1,2})\s+([A-
|
|
144
|
-
const RE_ANONYMOUS_REDEFINES = /^\s*(\d{1,2})\s+REDEFINES\s+([A-
|
|
145
|
-
const RE_88_LEVEL = /^\s*88\s+([A-
|
|
142
|
+
const RE_FD = /^\s*(?:FD|SD|RD)\s+([A-Z0-9][A-Z0-9-]+)/i;
|
|
143
|
+
const RE_DATA_ITEM = /^\s*(\d{1,2})\s+([A-Z0-9][A-Z0-9-]+)\s*(.*)/i;
|
|
144
|
+
const RE_ANONYMOUS_REDEFINES = /^\s*(\d{1,2})\s+REDEFINES\s+([A-Z0-9][A-Z0-9-]+)/i;
|
|
145
|
+
const RE_88_LEVEL = /^\s*88\s+([A-Z0-9][A-Z0-9-]+)\s+VALUES?\s+(?:ARE\s+)?(.+)/i;
|
|
146
146
|
// PROCEDURE DIVISION
|
|
147
147
|
// These patterns support both fixed-format (7 leading spaces) and free-format (any indentation)
|
|
148
|
-
const RE_PROC_SECTION = /^\s*([A-
|
|
149
|
-
const RE_PROC_PARAGRAPH = /^\s*([A-
|
|
150
|
-
const RE_PERFORM = /\bPERFORM\s+([A-
|
|
148
|
+
const RE_PROC_SECTION = /^\s*([A-Z0-9][A-Z0-9-]+)\s+SECTION(?:\s+\d+)?\.\s*$/i;
|
|
149
|
+
const RE_PROC_PARAGRAPH = /^\s*([A-Z0-9][A-Z0-9-]+)\.\s*$/i;
|
|
150
|
+
const RE_PERFORM = /\bPERFORM\s+([A-Z0-9][A-Z0-9-]+)(?:\s+(?:THRU|THROUGH)\s+([A-Z0-9][A-Z0-9-]+))?/gi;
|
|
151
151
|
// ALL DIVISIONS
|
|
152
152
|
// Both double-quoted ("PROG") and single-quoted ('PROG') targets are valid COBOL.
|
|
153
153
|
// Use separate alternation groups so quotes must match (prevents "PROG' false-matches).
|
|
154
154
|
const RE_CALL = /\bCALL\s+(?:"([^"]+)"|'([^']+)')/gi;
|
|
155
155
|
// Dynamic CALL via data item (no quotes): CALL WS-PROGRAM-NAME
|
|
156
|
-
const RE_CALL_DYNAMIC = /(?<![A-Z0-9-])\bCALL\s+([A-
|
|
157
|
-
const RE_COPY_UNQUOTED = /\bCOPY\s+([A-
|
|
156
|
+
const RE_CALL_DYNAMIC = /(?<![A-Z0-9-])\bCALL\s+([A-Z0-9][A-Z0-9-]+)(?=\s|\.|$)/gi;
|
|
157
|
+
const RE_COPY_UNQUOTED = /\bCOPY\s+([A-Z0-9][A-Z0-9-]+)(?:\s|\.)/i;
|
|
158
158
|
const RE_COPY_QUOTED = /\bCOPY\s+(?:"([^"]+)"|'([^']+)')(?:\s|\.)/i;
|
|
159
159
|
// EXEC blocks
|
|
160
160
|
const RE_EXEC_SQL_START = /\bEXEC\s+SQL\b/i;
|
|
@@ -162,25 +162,25 @@ const RE_EXEC_CICS_START = /\bEXEC\s+CICS\b/i;
|
|
|
162
162
|
const RE_END_EXEC = /\bEND-EXEC\b/i;
|
|
163
163
|
// GO TO — control flow transfer (same graph semantics as PERFORM)
|
|
164
164
|
// GO TO — captures first target; GO TO p1 p2 p3 DEPENDING ON x handled below
|
|
165
|
-
const RE_GOTO = /\bGO\s+TO\s+([A-
|
|
165
|
+
const RE_GOTO = /\bGO\s+TO\s+([A-Z0-9][A-Z0-9-]+(?:\s+[A-Z0-9][A-Z0-9-]+)*?)(?:\s+DEPENDING\s+ON\s+[A-Z0-9][A-Z0-9-]+)?(?:\s*\.|$)/i;
|
|
166
166
|
// SORT/MERGE file references
|
|
167
|
-
const RE_SORT = /\bSORT\s+([A-
|
|
168
|
-
const RE_MERGE = /\bMERGE\s+([A-
|
|
167
|
+
const RE_SORT = /\bSORT\s+([A-Z0-9][A-Z0-9-]+)/i;
|
|
168
|
+
const RE_MERGE = /\bMERGE\s+([A-Z0-9][A-Z0-9-]+)/i;
|
|
169
169
|
// SEARCH — table access
|
|
170
|
-
const RE_SEARCH = /\bSEARCH\s+(?:ALL\s+)?([A-
|
|
170
|
+
const RE_SEARCH = /\bSEARCH\s+(?:ALL\s+)?([A-Z0-9][A-Z0-9-]+)/i;
|
|
171
171
|
// CANCEL — program lifecycle
|
|
172
172
|
const RE_CANCEL = /\bCANCEL\s+(?:"([^"]+)"|'([^']+)')/gi;
|
|
173
|
-
const RE_CANCEL_DYNAMIC = /(?<![A-Z0-9-])\bCANCEL\s+([A-
|
|
173
|
+
const RE_CANCEL_DYNAMIC = /(?<![A-Z0-9-])\bCANCEL\s+([A-Z0-9][A-Z0-9-]+)(?=\s|\.|$)/gi;
|
|
174
174
|
// Level 66 RENAMES
|
|
175
|
-
const RE_66_LEVEL = /^\s*66\s+([A-
|
|
175
|
+
const RE_66_LEVEL = /^\s*66\s+([A-Z0-9][A-Z0-9-]+)\s+RENAMES\s+([A-Z0-9][A-Z0-9-]+)/i;
|
|
176
176
|
// DECLARATIVES boundary and USE AFTER EXCEPTION
|
|
177
177
|
const RE_DECLARATIVES_START = /^\s*DECLARATIVES\s*\.\s*$/i;
|
|
178
178
|
const RE_DECLARATIVES_END = /^\s*END\s+DECLARATIVES\s*\.\s*$/i;
|
|
179
|
-
const RE_USE_AFTER = /\bUSE\s+(?:AFTER\s+)?(?:STANDARD\s+)?(?:EXCEPTION|ERROR)\s+ON\s+([A-
|
|
179
|
+
const RE_USE_AFTER = /\bUSE\s+(?:AFTER\s+)?(?:STANDARD\s+)?(?:EXCEPTION|ERROR)\s+ON\s+([A-Z0-9][A-Z0-9-]+|INPUT|OUTPUT|I-O|EXTEND)\b/i;
|
|
180
180
|
// SET statement (condition, index)
|
|
181
181
|
//
|
|
182
182
|
// Catastrophic-backtracking note (CodeQL js/redos): the previous shape
|
|
183
|
-
// `((?:[A-
|
|
183
|
+
// `((?:[A-Z0-9][A-Z0-9-]+(?:\s+OF\s+[A-Z0-9][A-Z0-9-]+)?\s+)+)TO\s+TRUE`
|
|
184
184
|
// nested `\s+` quantifiers across alternations and was exponential on
|
|
185
185
|
// inputs like "SET a OF a OF a ... TO TRUE". Replaced with a lazy
|
|
186
186
|
// dot-match bounded by the explicit `\s+TO\s+TRUE` suffix — `.+?` is
|
|
@@ -191,7 +191,7 @@ const RE_USE_AFTER = /\bUSE\s+(?:AFTER\s+)?(?:STANDARD\s+)?(?:EXCEPTION|ERROR)\s
|
|
|
191
191
|
// pathological-input timing assertion exercises the production regex
|
|
192
192
|
// instead of an inline copy that drifts.
|
|
193
193
|
export const RE_SET_TO_TRUE = /\bSET\s+(.+?)\s+TO\s+TRUE\b/i;
|
|
194
|
-
export const RE_SET_INDEX = /\bSET\s+(.+?)\s+(TO|UP\s+BY|DOWN\s+BY)\s+(\d+|[A-
|
|
194
|
+
export const RE_SET_INDEX = /\bSET\s+(.+?)\s+(TO|UP\s+BY|DOWN\s+BY)\s+(\d+|[A-Z0-9][A-Z0-9-]+)/i;
|
|
195
195
|
// INITIALIZE statement — data reset (captures targets before REPLACING/WITH clause)
|
|
196
196
|
const RE_INITIALIZE = /\bINITIALIZE\s+([\s\S]*?)(?=\bREPLACING\b|\bWITH\b|\.\s*$|$)/i;
|
|
197
197
|
const INITIALIZE_CLAUSE_KEYWORDS = new Set([
|
|
@@ -213,7 +213,7 @@ const RE_PROC_USING = /\bPROCEDURE\s+DIVISION\s+USING\s+([\s\S]*?)(?:\.|$)/i;
|
|
|
213
213
|
// ENTRY point
|
|
214
214
|
const RE_ENTRY = /\bENTRY\s+(?:"([^"]+)"|'([^']+)')(?:\s+USING\s+([\s\S]*?))?(?:\.|$)/i;
|
|
215
215
|
// MOVE statement — captures everything after TO for multi-target extraction
|
|
216
|
-
const RE_MOVE = /\bMOVE\s+((?:CORRESPONDING|CORR)\s+)?([A-
|
|
216
|
+
const RE_MOVE = /\bMOVE\s+((?:CORRESPONDING|CORR)\s+)?([A-Z0-9][A-Z0-9-]+(?:\([^)]*\))*)\s+TO\s+(.+)/i;
|
|
217
217
|
const MOVE_SKIP = new Set([
|
|
218
218
|
'SPACES',
|
|
219
219
|
'ZEROS',
|
|
@@ -251,7 +251,7 @@ function extractMoveTargets(afterTo) {
|
|
|
251
251
|
skipNext = true;
|
|
252
252
|
continue;
|
|
253
253
|
}
|
|
254
|
-
if (/^[A-
|
|
254
|
+
if (/^[A-Z0-9][A-Z0-9-]+$/i.test(token) && !MOVE_SKIP.has(token.toUpperCase())) {
|
|
255
255
|
targets.push(token);
|
|
256
256
|
}
|
|
257
257
|
}
|
|
@@ -375,12 +375,12 @@ function parseDataItemClauses(rest) {
|
|
|
375
375
|
}
|
|
376
376
|
}
|
|
377
377
|
// REDEFINES <name>
|
|
378
|
-
const redefMatch = text.match(/\bREDEFINES\s+([A-
|
|
378
|
+
const redefMatch = text.match(/\bREDEFINES\s+([A-Z0-9][A-Z0-9-]+)/i);
|
|
379
379
|
if (redefMatch) {
|
|
380
380
|
result.redefines = redefMatch[1];
|
|
381
381
|
}
|
|
382
382
|
// OCCURS <n> [TO <m>] [TIMES] [DEPENDING ON <field>]
|
|
383
|
-
const occursMatch = text.match(/\bOCCURS\s+(\d+)(?:\s+TO\s+(\d+))?\s*(?:TIMES\s*)?(?:DEPENDING\s+ON\s+([A-
|
|
383
|
+
const occursMatch = text.match(/\bOCCURS\s+(\d+)(?:\s+TO\s+(\d+))?\s*(?:TIMES\s*)?(?:DEPENDING\s+ON\s+([A-Z0-9][A-Z0-9-]+(?:\s*\([^)]*\))?))?/i);
|
|
384
384
|
if (occursMatch) {
|
|
385
385
|
result.occurs = parseInt(occursMatch[1], 10);
|
|
386
386
|
if (occursMatch[3]) {
|
|
@@ -421,7 +421,7 @@ function parseDataItemClauses(rest) {
|
|
|
421
421
|
}
|
|
422
422
|
else {
|
|
423
423
|
// Try figurative constant or identifier
|
|
424
|
-
const identMatch = afterValue.match(/^([A-
|
|
424
|
+
const identMatch = afterValue.match(/^([A-Z0-9][A-Z0-9-]*)/i);
|
|
425
425
|
if (identMatch)
|
|
426
426
|
result.value = identMatch[1].toUpperCase();
|
|
427
427
|
}
|
|
@@ -467,7 +467,7 @@ function parseConditionValues(valuesStr) {
|
|
|
467
467
|
function parseSelectStatement(stmt, startLine) {
|
|
468
468
|
// Normalize whitespace
|
|
469
469
|
const text = stmt.replace(/\s+/g, ' ').trim();
|
|
470
|
-
const nameMatch = text.match(/^SELECT\s+(?:OPTIONAL\s+)?([A-
|
|
470
|
+
const nameMatch = text.match(/^SELECT\s+(?:OPTIONAL\s+)?([A-Z0-9][A-Z0-9-]+)/i);
|
|
471
471
|
if (!nameMatch)
|
|
472
472
|
return null;
|
|
473
473
|
const result = {
|
|
@@ -475,7 +475,7 @@ function parseSelectStatement(stmt, startLine) {
|
|
|
475
475
|
assignTo: '',
|
|
476
476
|
line: startLine,
|
|
477
477
|
};
|
|
478
|
-
const assignMatch = text.match(/\bASSIGN\s+(?:TO\s+)?("([^"]+)"|([A-
|
|
478
|
+
const assignMatch = text.match(/\bASSIGN\s+(?:TO\s+)?("([^"]+)"|([A-Z0-9][A-Z0-9-]*))/i);
|
|
479
479
|
if (assignMatch) {
|
|
480
480
|
result.assignTo = assignMatch[2] || assignMatch[3] || '';
|
|
481
481
|
}
|
|
@@ -487,19 +487,19 @@ function parseSelectStatement(stmt, startLine) {
|
|
|
487
487
|
if (accessMatch) {
|
|
488
488
|
result.access = accessMatch[1].toUpperCase();
|
|
489
489
|
}
|
|
490
|
-
const keyMatch = text.match(/\bRECORD\s+KEY\s+(?:IS\s+)?([A-
|
|
490
|
+
const keyMatch = text.match(/\bRECORD\s+KEY\s+(?:IS\s+)?([A-Z0-9][A-Z0-9-]+)/i);
|
|
491
491
|
if (keyMatch) {
|
|
492
492
|
result.recordKey = keyMatch[1];
|
|
493
493
|
}
|
|
494
494
|
// ALTERNATE RECORD KEY
|
|
495
|
-
const altKeyMatches = text.matchAll(/\bALTERNATE\s+RECORD\s+KEY\s+(?:IS\s+)?([A-
|
|
495
|
+
const altKeyMatches = text.matchAll(/\bALTERNATE\s+RECORD\s+KEY\s+(?:IS\s+)?([A-Z0-9][A-Z0-9-]+)/gi);
|
|
496
496
|
const alternateKeys = [];
|
|
497
497
|
for (const m of altKeyMatches)
|
|
498
498
|
alternateKeys.push(m[1]);
|
|
499
499
|
if (alternateKeys.length > 0)
|
|
500
500
|
result.alternateKeys = alternateKeys;
|
|
501
501
|
// FILE STATUS IS / STATUS IS
|
|
502
|
-
const statusMatch = text.match(/\b(?:FILE\s+)?STATUS\s+(?:IS\s+)?([A-
|
|
502
|
+
const statusMatch = text.match(/\b(?:FILE\s+)?STATUS\s+(?:IS\s+)?([A-Z0-9][A-Z0-9-]+)/i);
|
|
503
503
|
if (statusMatch) {
|
|
504
504
|
result.fileStatus = statusMatch[1];
|
|
505
505
|
}
|
|
@@ -508,11 +508,12 @@ function parseSelectStatement(stmt, startLine) {
|
|
|
508
508
|
return result;
|
|
509
509
|
}
|
|
510
510
|
function parseExecSqlBlock(block, line) {
|
|
511
|
-
// Strip EXEC SQL ... END-EXEC wrapper
|
|
511
|
+
// Strip EXEC SQL ... END-EXEC wrapper and trailing period
|
|
512
512
|
const body = block
|
|
513
513
|
.replace(/\bEXEC\s+SQL\b/i, '')
|
|
514
514
|
.replace(/\bEND-EXEC\b/i, '')
|
|
515
515
|
.replace(/\s+/g, ' ')
|
|
516
|
+
.replace(/\.\s*$/, '')
|
|
516
517
|
.trim();
|
|
517
518
|
// Determine operation from first SQL keyword
|
|
518
519
|
const firstWord = body.split(/\s+/)[0]?.toUpperCase() || '';
|
|
@@ -539,18 +540,24 @@ function parseExecSqlBlock(block, line) {
|
|
|
539
540
|
// Extract table names from FROM, INTO (INSERT), UPDATE, DELETE FROM, JOIN
|
|
540
541
|
const tables = [];
|
|
541
542
|
const tablePatterns = [
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
/\
|
|
543
|
+
// FROM table1 [AS alias], table2 [AS alias] … — handle comma-separated
|
|
544
|
+
// lists with optional AS keyword, terminated by SQL clause keywords
|
|
545
|
+
// (WHERE, JOIN, GROUP, ON, ORDER, HAVING, UNION, SET, INTO, VALUES, FETCH, FOR, LIMIT, OFFSET, WITH).
|
|
546
|
+
/\bFROM\s+([A-Z0-9][A-Z0-9_]+(?:\s+(?:AS\s+)?[A-Z0-9][A-Z0-9_]*)?(?:\s*,\s*[A-Z0-9][A-Z0-9_]+(?:\s+(?:AS\s+)?[A-Z0-9][A-Z0-9_]*)?)*)(?:\s+(?:WHERE|JOIN|GROUP|ON|ORDER|HAVING|UNION|SET|INTO|VALUES|FETCH|FOR|LIMIT|OFFSET|WITH)\b|$)/gi,
|
|
547
|
+
/\bINSERT\s+INTO\s+([A-Z0-9][A-Z0-9_]+)/gi,
|
|
548
|
+
/\bUPDATE\s+([A-Z0-9][A-Z0-9_]+)/gi,
|
|
549
|
+
/\bJOIN\s+([A-Z0-9][A-Z0-9_]+)/gi,
|
|
546
550
|
];
|
|
547
551
|
for (const re of tablePatterns) {
|
|
548
552
|
let m;
|
|
549
553
|
while ((m = re.exec(body)) !== null) {
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
+
// Split comma-separated table list and strip aliases
|
|
555
|
+
const names = m[1].split(',').map((n) => n.trim().split(/\s+/)[0].toUpperCase());
|
|
556
|
+
for (const name of names) {
|
|
557
|
+
// Skip host variables and SQL keywords
|
|
558
|
+
if (!name.startsWith(':') && !tables.includes(name)) {
|
|
559
|
+
tables.push(name);
|
|
560
|
+
}
|
|
554
561
|
}
|
|
555
562
|
}
|
|
556
563
|
}
|
|
@@ -563,7 +570,7 @@ function parseExecSqlBlock(block, line) {
|
|
|
563
570
|
}
|
|
564
571
|
// Extract host variables: :VARIABLE-NAME (strip the colon)
|
|
565
572
|
const hostVariables = [];
|
|
566
|
-
const hostRe = /:([A-
|
|
573
|
+
const hostRe = /:([A-Z0-9][A-Z0-9-]+)/gi;
|
|
567
574
|
let hm;
|
|
568
575
|
while ((hm = hostRe.exec(body)) !== null) {
|
|
569
576
|
const name = hm[1];
|
|
@@ -615,40 +622,40 @@ function parseExecCicsBlock(block, line) {
|
|
|
615
622
|
}
|
|
616
623
|
const result = { line, command };
|
|
617
624
|
// MAP name: MAP('name') or MAP("name") or MAP(IDENTIFIER)
|
|
618
|
-
const mapMatch = body.match(/\bMAP\s*\(\s*(?:['"]([^'"]+)['"]|([A-
|
|
625
|
+
const mapMatch = body.match(/\bMAP\s*\(\s*(?:['"]([^'"]+)['"]|([A-Z0-9][A-Z0-9-]+))\s*\)/i);
|
|
619
626
|
if (mapMatch)
|
|
620
627
|
result.mapName = mapMatch[1] ?? mapMatch[2];
|
|
621
628
|
// PROGRAM name: PROGRAM('name') or PROGRAM("name") or PROGRAM(VARIABLE)
|
|
622
|
-
const progMatch = body.match(/\bPROGRAM\s*\(\s*(?:['"]([^'"]+)['"]|([A-
|
|
629
|
+
const progMatch = body.match(/\bPROGRAM\s*\(\s*(?:['"]([^'"]+)['"]|([A-Z0-9][A-Z0-9-]+))\s*\)/i);
|
|
623
630
|
if (progMatch) {
|
|
624
631
|
result.programName = progMatch[1] ?? progMatch[2];
|
|
625
632
|
result.programIsLiteral = !!progMatch[1];
|
|
626
633
|
}
|
|
627
634
|
// TRANSID: TRANSID('name') or TRANSID("name") or TRANSID(VARIABLE)
|
|
628
|
-
const transMatch = body.match(/\bTRANSID\s*\(\s*(?:['"]([^'"]+)['"]|([A-
|
|
635
|
+
const transMatch = body.match(/\bTRANSID\s*\(\s*(?:['"]([^'"]+)['"]|([A-Z0-9][A-Z0-9-]+))\s*\)/i);
|
|
629
636
|
if (transMatch)
|
|
630
637
|
result.transId = transMatch[1] ?? transMatch[2];
|
|
631
638
|
// FILE/DATASET: FILE('name') or DATASET('name') or FILE(VARIABLE)
|
|
632
639
|
// Used in CICS READ, WRITE, REWRITE, DELETE, STARTBR, READNEXT, READPREV, ENDBR
|
|
633
|
-
const fileMatch = body.match(/\b(?:FILE|DATASET)\s*\(\s*(?:['"]([^'"]+)['"]|([A-
|
|
640
|
+
const fileMatch = body.match(/\b(?:FILE|DATASET)\s*\(\s*(?:['"]([^'"]+)['"]|([A-Z0-9][A-Z0-9-]+))\s*\)/i);
|
|
634
641
|
if (fileMatch) {
|
|
635
642
|
result.fileName = fileMatch[1] ?? fileMatch[2];
|
|
636
643
|
result.fileIsLiteral = !!fileMatch[1];
|
|
637
644
|
}
|
|
638
645
|
// QUEUE: QUEUE('name') — used in WRITEQ/READQ TS/TD
|
|
639
|
-
const queueMatch = body.match(/\bQUEUE\s*\(\s*(?:['"]([^'"]+)['"]|([A-
|
|
646
|
+
const queueMatch = body.match(/\bQUEUE\s*\(\s*(?:['"]([^'"]+)['"]|([A-Z0-9][A-Z0-9-]+))\s*\)/i);
|
|
640
647
|
if (queueMatch)
|
|
641
648
|
result.queueName = queueMatch[1] ?? queueMatch[2];
|
|
642
649
|
// HANDLE ABEND LABEL(paragraph-name) — error handler target
|
|
643
|
-
const labelMatch = body.match(/\bLABEL\s*\(\s*([A-
|
|
650
|
+
const labelMatch = body.match(/\bLABEL\s*\(\s*([A-Z0-9][A-Z0-9-]+)\s*\)/i);
|
|
644
651
|
if (labelMatch)
|
|
645
652
|
result.labelName = labelMatch[1];
|
|
646
653
|
// INTO(data-area) — data target (READ INTO, RECEIVE INTO, RETRIEVE INTO, READQ INTO)
|
|
647
|
-
const intoMatch = body.match(/\bINTO\s*\(\s*([A-
|
|
654
|
+
const intoMatch = body.match(/\bINTO\s*\(\s*([A-Z0-9][A-Z0-9-]+)\s*\)/i);
|
|
648
655
|
if (intoMatch)
|
|
649
656
|
result.intoField = intoMatch[1];
|
|
650
657
|
// FROM(data-area) — data source (WRITE FROM, SEND FROM, WRITEQ FROM, START FROM)
|
|
651
|
-
const fromMatch = body.match(/\bFROM\s*\(\s*([A-
|
|
658
|
+
const fromMatch = body.match(/\bFROM\s*\(\s*([A-Z0-9][A-Z0-9-]+)\s*\)/i);
|
|
652
659
|
if (fromMatch)
|
|
653
660
|
result.fromField = fromMatch[1];
|
|
654
661
|
return result;
|
|
@@ -667,16 +674,16 @@ function parseExecDliBlock(block, line) {
|
|
|
667
674
|
const pcbMatch = body.match(/\bUSING\s+PCB\s*\(\s*(\d+)\s*\)/i);
|
|
668
675
|
if (pcbMatch)
|
|
669
676
|
result.pcbNumber = parseInt(pcbMatch[1], 10);
|
|
670
|
-
const segMatch = body.match(/\bSEGMENT\s*\(\s*([A-
|
|
677
|
+
const segMatch = body.match(/\bSEGMENT\s*\(\s*([A-Z0-9][A-Z0-9-]*)\s*\)/i);
|
|
671
678
|
if (segMatch)
|
|
672
679
|
result.segmentName = segMatch[1];
|
|
673
|
-
const intoMatch = body.match(/\bINTO\s*\(\s*([A-
|
|
680
|
+
const intoMatch = body.match(/\bINTO\s*\(\s*([A-Z0-9][A-Z0-9-]+)\s*\)/i);
|
|
674
681
|
if (intoMatch)
|
|
675
682
|
result.intoField = intoMatch[1];
|
|
676
|
-
const fromMatch = body.match(/\bFROM\s*\(\s*([A-
|
|
683
|
+
const fromMatch = body.match(/\bFROM\s*\(\s*([A-Z0-9][A-Z0-9-]+)\s*\)/i);
|
|
677
684
|
if (fromMatch)
|
|
678
685
|
result.fromField = fromMatch[1];
|
|
679
|
-
const psbMatch = body.match(/\bPSB\s*\(\s*([A-
|
|
686
|
+
const psbMatch = body.match(/\bPSB\s*\(\s*([A-Z0-9][A-Z0-9-]+)\s*\)/i);
|
|
680
687
|
if (psbMatch)
|
|
681
688
|
result.psbName = psbMatch[1];
|
|
682
689
|
return result;
|
|
@@ -717,6 +724,7 @@ export function extractCobolSymbolsWithRegex(content, _filePath) {
|
|
|
717
724
|
sets: [],
|
|
718
725
|
inspects: [],
|
|
719
726
|
initializes: [],
|
|
727
|
+
arithmeticOps: [],
|
|
720
728
|
};
|
|
721
729
|
// --- State ---
|
|
722
730
|
let currentDivision = null;
|
|
@@ -1105,7 +1113,7 @@ export function extractCobolSymbolsWithRegex(content, _filePath) {
|
|
|
1105
1113
|
}
|
|
1106
1114
|
}
|
|
1107
1115
|
else if (currentDivision === 'procedure' &&
|
|
1108
|
-
/(?<![A-Z0-9-])\bCALL\s+(?:"[^"]+"|'[^']+'|[A-
|
|
1116
|
+
/(?<![A-Z0-9-])\bCALL\s+(?:"[^"]+"|'[^']+'|[A-Z0-9][A-Z0-9-]+)/i.test(line)) {
|
|
1109
1117
|
// Check if this is a complete single-line CALL (ends with period or END-CALL)
|
|
1110
1118
|
if (/\.\s*$/.test(line) || /\bEND-CALL\b/i.test(line)) {
|
|
1111
1119
|
// Single-line CALL — extract immediately via flushCallAccum
|
|
@@ -1231,7 +1239,7 @@ export function extractCobolSymbolsWithRegex(content, _filePath) {
|
|
|
1231
1239
|
.trim()
|
|
1232
1240
|
.split(/\s+/)
|
|
1233
1241
|
.map((f) => f.replace(/\.$/, ''))
|
|
1234
|
-
.filter((f) => /^[A-
|
|
1242
|
+
.filter((f) => /^[A-Z0-9][A-Z0-9-]+$/i.test(f) && !SORT_CLAUSE_NOISE.has(f.toUpperCase())));
|
|
1235
1243
|
}
|
|
1236
1244
|
if (givingIdx >= 0) {
|
|
1237
1245
|
const givingText = fullSort.substring(givingIdx + 7);
|
|
@@ -1239,12 +1247,12 @@ export function extractCobolSymbolsWithRegex(content, _filePath) {
|
|
|
1239
1247
|
.trim()
|
|
1240
1248
|
.split(/\s+/)
|
|
1241
1249
|
.map((f) => f.replace(/\.$/, ''))
|
|
1242
|
-
.filter((f) => /^[A-
|
|
1250
|
+
.filter((f) => /^[A-Z0-9][A-Z0-9-]+$/i.test(f) && !SORT_CLAUSE_NOISE.has(f.toUpperCase())));
|
|
1243
1251
|
}
|
|
1244
1252
|
// INPUT PROCEDURE IS / OUTPUT PROCEDURE IS → control-flow targets (like PERFORM)
|
|
1245
1253
|
// Supports optional THRU/THROUGH range: INPUT PROCEDURE IS proc-start THRU proc-end
|
|
1246
|
-
const inputProcMatch = fullSort.match(/\bINPUT\s+PROCEDURE\s+(?:IS\s+)?([A-
|
|
1247
|
-
const outputProcMatch = fullSort.match(/\bOUTPUT\s+PROCEDURE\s+(?:IS\s+)?([A-
|
|
1254
|
+
const inputProcMatch = fullSort.match(/\bINPUT\s+PROCEDURE\s+(?:IS\s+)?([A-Z0-9][A-Z0-9-]+)(?:\s+(?:THRU|THROUGH)\s+([A-Z0-9][A-Z0-9-]+))?/i);
|
|
1255
|
+
const outputProcMatch = fullSort.match(/\bOUTPUT\s+PROCEDURE\s+(?:IS\s+)?([A-Z0-9][A-Z0-9-]+)(?:\s+(?:THRU|THROUGH)\s+([A-Z0-9][A-Z0-9-]+))?/i);
|
|
1248
1256
|
if (inputProcMatch) {
|
|
1249
1257
|
result.performs.push({
|
|
1250
1258
|
caller: currentParagraph,
|
|
@@ -1269,7 +1277,7 @@ export function extractCobolSymbolsWithRegex(content, _filePath) {
|
|
|
1269
1277
|
if (inspectAccum === null)
|
|
1270
1278
|
return;
|
|
1271
1279
|
const text = inspectAccum;
|
|
1272
|
-
const fieldMatch = text.match(/\bINSPECT\s+([A-
|
|
1280
|
+
const fieldMatch = text.match(/\bINSPECT\s+([A-Z0-9][A-Z0-9-]+)/i);
|
|
1273
1281
|
if (!fieldMatch) {
|
|
1274
1282
|
inspectAccum = null;
|
|
1275
1283
|
return;
|
|
@@ -1277,7 +1285,7 @@ export function extractCobolSymbolsWithRegex(content, _filePath) {
|
|
|
1277
1285
|
const counters = [];
|
|
1278
1286
|
const tallySection = text.match(/\bTALLYING\b([\s\S]+?)(?:\bREPLACING\b|\bCONVERTING\b|\.\s*$)/i);
|
|
1279
1287
|
if (tallySection) {
|
|
1280
|
-
const counterRe = /([A-
|
|
1288
|
+
const counterRe = /([A-Z0-9][A-Z0-9-]+)\s+FOR\b/gi;
|
|
1281
1289
|
let cm;
|
|
1282
1290
|
while ((cm = counterRe.exec(tallySection[1])) !== null) {
|
|
1283
1291
|
counters.push(cm[1]);
|
|
@@ -1322,9 +1330,9 @@ export function extractCobolSymbolsWithRegex(content, _filePath) {
|
|
|
1322
1330
|
.split(/\s+/)
|
|
1323
1331
|
.filter((s) => s.length > 0 &&
|
|
1324
1332
|
!CALL_USING_FILTER.has(s.toUpperCase()) &&
|
|
1325
|
-
/^[A-
|
|
1333
|
+
/^[A-Z0-9][A-Z0-9-]+$/i.test(s))
|
|
1326
1334
|
: undefined;
|
|
1327
|
-
const retMatch = afterCall.match(/\bRETURNING\s+([A-
|
|
1335
|
+
const retMatch = afterCall.match(/\bRETURNING\s+([A-Z0-9][A-Z0-9-]+)/i);
|
|
1328
1336
|
const returning = retMatch ? retMatch[1] : undefined;
|
|
1329
1337
|
result.calls.push({
|
|
1330
1338
|
target: callTarget,
|
|
@@ -1345,9 +1353,9 @@ export function extractCobolSymbolsWithRegex(content, _filePath) {
|
|
|
1345
1353
|
.split(/\s+/)
|
|
1346
1354
|
.filter((s) => s.length > 0 &&
|
|
1347
1355
|
!CALL_USING_FILTER.has(s.toUpperCase()) &&
|
|
1348
|
-
/^[A-
|
|
1356
|
+
/^[A-Z0-9][A-Z0-9-]+$/i.test(s))
|
|
1349
1357
|
: undefined;
|
|
1350
|
-
const dynRetMatch = afterDynCall.match(/\bRETURNING\s+([A-
|
|
1358
|
+
const dynRetMatch = afterDynCall.match(/\bRETURNING\s+([A-Z0-9][A-Z0-9-]+)/i);
|
|
1351
1359
|
const dynReturning = dynRetMatch ? dynRetMatch[1] : undefined;
|
|
1352
1360
|
result.calls.push({
|
|
1353
1361
|
target: dynCallMatch[1],
|
|
@@ -1548,11 +1556,14 @@ export function extractCobolSymbolsWithRegex(content, _filePath) {
|
|
|
1548
1556
|
const target = perfMatch[1];
|
|
1549
1557
|
// Skip COBOL inline-perform keywords that are not paragraph names
|
|
1550
1558
|
if (!PERFORM_KEYWORD_SKIP.has(target.toUpperCase())) {
|
|
1551
|
-
// Also check for "PERFORM identifier TIMES" — the identifier is a
|
|
1552
|
-
// data item count, not a paragraph name (fundamental regex ambiguity).
|
|
1553
1559
|
const matchEnd = perfMatch.index + perfMatch[0].length;
|
|
1554
1560
|
const afterTarget = line.substring(matchEnd).trim();
|
|
1555
|
-
|
|
1561
|
+
// Check for inline PERFORM ... TIMES pattern where the target IS
|
|
1562
|
+
// the counter variable itself (e.g., PERFORM WS-COUNT TIMES).
|
|
1563
|
+
// Out-of-line PERFORM target count TIMES (e.g., PERFORM 2000-PROCESS 3 TIMES)
|
|
1564
|
+
// IS a real paragraph call — do NOT suppress it.
|
|
1565
|
+
const hasTimesClause = /^\s*TIMES\b/i.test(afterTarget);
|
|
1566
|
+
if (!hasTimesClause) {
|
|
1556
1567
|
result.performs.push({
|
|
1557
1568
|
caller: currentParagraph,
|
|
1558
1569
|
target,
|
|
@@ -1588,7 +1599,7 @@ export function extractCobolSymbolsWithRegex(content, _filePath) {
|
|
|
1588
1599
|
const isCorresponding = !!moveMatch[1];
|
|
1589
1600
|
// MOVE CORRESPONDING is always single-target per COBOL standard
|
|
1590
1601
|
const targets = isCorresponding
|
|
1591
|
-
? [moveMatch[3].replace(/\..*$/, '').trim().split(/\s+/)[0]].filter((t) => /^[A-
|
|
1602
|
+
? [moveMatch[3].replace(/\..*$/, '').trim().split(/\s+/)[0]].filter((t) => /^[A-Z0-9][A-Z0-9-]+$/i.test(t))
|
|
1592
1603
|
: extractMoveTargets(moveMatch[3]);
|
|
1593
1604
|
if (targets.length > 0) {
|
|
1594
1605
|
result.moves.push({
|
|
@@ -1601,13 +1612,156 @@ export function extractCobolSymbolsWithRegex(content, _filePath) {
|
|
|
1601
1612
|
}
|
|
1602
1613
|
}
|
|
1603
1614
|
}
|
|
1615
|
+
// Arithmetic statements — COMPUTE, ADD, SUBTRACT, MULTIPLY, DIVIDE
|
|
1616
|
+
// All extract target (written) and source operands (read) for ACCESSES edges
|
|
1617
|
+
// Mask quoted strings before matching to avoid false positives from
|
|
1618
|
+
// arithmetic keywords inside string literals (e.g., DISPLAY "COMPUTE").
|
|
1619
|
+
const lineForArith = line.replace(/"[^"]*"/g, ' ').replace(/'[^']*'/g, ' ');
|
|
1620
|
+
const arithMatch = lineForArith.match(/\b(COMPUTE|ADD|SUBTRACT|MULTIPLY|DIVIDE)\s+(.+)/i);
|
|
1621
|
+
if (arithMatch) {
|
|
1622
|
+
const verb = arithMatch[1].toUpperCase();
|
|
1623
|
+
const rest = arithMatch[2].replace(/\..*$/, '').trim();
|
|
1624
|
+
let target = '';
|
|
1625
|
+
const sources = [];
|
|
1626
|
+
let givingTarget;
|
|
1627
|
+
switch (verb) {
|
|
1628
|
+
case 'COMPUTE': {
|
|
1629
|
+
// COMPUTE target = expression
|
|
1630
|
+
const eqIdx = rest.indexOf('=');
|
|
1631
|
+
if (eqIdx > 0) {
|
|
1632
|
+
target = rest.substring(0, eqIdx).trim().split(/\s+/)[0] || '';
|
|
1633
|
+
const expr = rest.substring(eqIdx + 1).trim();
|
|
1634
|
+
// Extract identifiers from expression (skip literals and operators)
|
|
1635
|
+
const idRe = /[A-Z0-9][A-Z0-9-]*/gi;
|
|
1636
|
+
let idMatch;
|
|
1637
|
+
while ((idMatch = idRe.exec(expr)) !== null) {
|
|
1638
|
+
const name = idMatch[0];
|
|
1639
|
+
if (!/^(?:AND|OR|NOT|IN|OF|BY|TO|FROM|DIVIDED|INTO|GIVING|TIMES|PLUS|MINUS|MULTIPLIED)$/i.test(name)) {
|
|
1640
|
+
if (!sources.includes(name))
|
|
1641
|
+
sources.push(name);
|
|
1642
|
+
}
|
|
1643
|
+
}
|
|
1644
|
+
}
|
|
1645
|
+
break;
|
|
1646
|
+
}
|
|
1647
|
+
case 'ADD': {
|
|
1648
|
+
// ADD a TO b [GIVING c] — target is after TO or GIVING.
|
|
1649
|
+
// If no TO, try GIVING directly (ADD a GIVING b).
|
|
1650
|
+
const addGiving = rest.match(/\bTO\s+([A-Z0-9][A-Z0-9-]+)(?:\s+GIVING\s+([A-Z0-9][A-Z0-9-]+))?/i);
|
|
1651
|
+
if (addGiving) {
|
|
1652
|
+
target = addGiving[2] ?? addGiving[1];
|
|
1653
|
+
if (addGiving[2])
|
|
1654
|
+
givingTarget = addGiving[2];
|
|
1655
|
+
// Everything before TO is sources
|
|
1656
|
+
const beforeTo = rest.substring(0, rest.toUpperCase().indexOf(' TO '));
|
|
1657
|
+
beforeTo.replace(/\b([A-Z0-9][A-Z0-9-]+)\b/gi, (m) => {
|
|
1658
|
+
if (!/^(?:ADD|CORRESPONDING|CORR)$/i.test(m) && !sources.includes(m)) {
|
|
1659
|
+
sources.push(m);
|
|
1660
|
+
}
|
|
1661
|
+
return m;
|
|
1662
|
+
});
|
|
1663
|
+
// Non-GIVING ADD A TO B: the TO operand (B) is both read and written
|
|
1664
|
+
// (the existing value is read, added, then stored back). Add B as a
|
|
1665
|
+
// source so both ACCESSES edges are created.
|
|
1666
|
+
if (!addGiving[2]) {
|
|
1667
|
+
if (!sources.includes(target))
|
|
1668
|
+
sources.push(target);
|
|
1669
|
+
}
|
|
1670
|
+
}
|
|
1671
|
+
else {
|
|
1672
|
+
// No TO — try GIVING directly: ADD a GIVING b
|
|
1673
|
+
const addOnlyGiving = rest.match(/\bGIVING\s+([A-Z0-9][A-Z0-9-]+)/i);
|
|
1674
|
+
if (addOnlyGiving) {
|
|
1675
|
+
target = addOnlyGiving[1];
|
|
1676
|
+
givingTarget = addOnlyGiving[1];
|
|
1677
|
+
// Everything before GIVING is sources
|
|
1678
|
+
const beforeGiving = rest.substring(0, rest.toUpperCase().indexOf(' GIVING '));
|
|
1679
|
+
beforeGiving.replace(/\b([A-Z0-9][A-Z0-9-]+)\b/gi, (m) => {
|
|
1680
|
+
if (!/^(?:ADD|CORRESPONDING|CORR)$/i.test(m) && !sources.includes(m)) {
|
|
1681
|
+
sources.push(m);
|
|
1682
|
+
}
|
|
1683
|
+
return m;
|
|
1684
|
+
});
|
|
1685
|
+
}
|
|
1686
|
+
}
|
|
1687
|
+
break;
|
|
1688
|
+
}
|
|
1689
|
+
case 'SUBTRACT': {
|
|
1690
|
+
// SUBTRACT a FROM b [GIVING c] — target is after FROM or GIVING
|
|
1691
|
+
const subGiving = rest.match(/\bFROM\s+([A-Z0-9][A-Z0-9-]+)(?:\s+GIVING\s+([A-Z0-9][A-Z0-9-]+))?/i);
|
|
1692
|
+
if (subGiving) {
|
|
1693
|
+
target = subGiving[2] ?? subGiving[1];
|
|
1694
|
+
if (subGiving[2])
|
|
1695
|
+
givingTarget = subGiving[2];
|
|
1696
|
+
const beforeFrom = rest.substring(0, rest.toUpperCase().indexOf(' FROM '));
|
|
1697
|
+
beforeFrom.replace(/\b([A-Z0-9][A-Z0-9-]+)\b/gi, (m) => {
|
|
1698
|
+
if (!/^(?:SUBTRACT|CORRESPONDING|CORR)$/i.test(m) && !sources.includes(m)) {
|
|
1699
|
+
sources.push(m);
|
|
1700
|
+
}
|
|
1701
|
+
return m;
|
|
1702
|
+
});
|
|
1703
|
+
}
|
|
1704
|
+
break;
|
|
1705
|
+
}
|
|
1706
|
+
case 'MULTIPLY': {
|
|
1707
|
+
// MULTIPLY a BY b [GIVING c] — target is after BY or GIVING
|
|
1708
|
+
const mulGiving = rest.match(/\bBY\s+([A-Z0-9][A-Z0-9-]+)(?:\s+GIVING\s+([A-Z0-9][A-Z0-9-]+))?/i);
|
|
1709
|
+
if (mulGiving) {
|
|
1710
|
+
target = mulGiving[2] ?? mulGiving[1];
|
|
1711
|
+
if (mulGiving[2])
|
|
1712
|
+
givingTarget = mulGiving[2];
|
|
1713
|
+
const beforeBy = rest.substring(0, rest.toUpperCase().indexOf(' BY '));
|
|
1714
|
+
beforeBy.replace(/\b([A-Z0-9][A-Z0-9-]+)\b/gi, (m) => {
|
|
1715
|
+
if (!/^(?:MULTIPLY|CORRESPONDING|CORR)$/i.test(m) && !sources.includes(m)) {
|
|
1716
|
+
sources.push(m);
|
|
1717
|
+
}
|
|
1718
|
+
return m;
|
|
1719
|
+
});
|
|
1720
|
+
}
|
|
1721
|
+
break;
|
|
1722
|
+
}
|
|
1723
|
+
case 'DIVIDE': {
|
|
1724
|
+
// DIVIDE a INTO b [GIVING c] or DIVIDE a BY b [GIVING c]
|
|
1725
|
+
const divInto = rest.match(/\bINTO\s+([A-Z0-9][A-Z0-9-]+)(?:\s+GIVING\s+([A-Z0-9][A-Z0-9-]+))?/i);
|
|
1726
|
+
const divBy = !divInto
|
|
1727
|
+
? rest.match(/\bBY\s+([A-Z0-9][A-Z0-9-]+)(?:\s+GIVING\s+([A-Z0-9][A-Z0-9-]+))?/i)
|
|
1728
|
+
: null;
|
|
1729
|
+
const divMatch = divInto ?? divBy;
|
|
1730
|
+
if (divMatch) {
|
|
1731
|
+
target = divMatch[2] ?? divMatch[1];
|
|
1732
|
+
if (divMatch[2])
|
|
1733
|
+
givingTarget = divMatch[2];
|
|
1734
|
+
const beforeKeyword = divInto
|
|
1735
|
+
? rest.substring(0, rest.toUpperCase().indexOf(' INTO '))
|
|
1736
|
+
: rest.substring(0, rest.toUpperCase().indexOf(' BY '));
|
|
1737
|
+
beforeKeyword.replace(/\b([A-Z0-9][A-Z0-9-]+)\b/gi, (m) => {
|
|
1738
|
+
if (!/^(?:DIVIDE|CORRESPONDING|CORR)$/i.test(m) && !sources.includes(m)) {
|
|
1739
|
+
sources.push(m);
|
|
1740
|
+
}
|
|
1741
|
+
return m;
|
|
1742
|
+
});
|
|
1743
|
+
}
|
|
1744
|
+
break;
|
|
1745
|
+
}
|
|
1746
|
+
}
|
|
1747
|
+
if (target) {
|
|
1748
|
+
result.arithmeticOps.push({
|
|
1749
|
+
verb,
|
|
1750
|
+
target,
|
|
1751
|
+
sources,
|
|
1752
|
+
line: lineNum,
|
|
1753
|
+
caller: currentParagraph,
|
|
1754
|
+
givingTarget,
|
|
1755
|
+
});
|
|
1756
|
+
}
|
|
1757
|
+
}
|
|
1604
1758
|
// GO TO — control flow transfer (handles GO TO p1 p2 p3 DEPENDING ON x)
|
|
1605
1759
|
const gotoMatch = line.match(RE_GOTO);
|
|
1606
1760
|
if (gotoMatch) {
|
|
1607
1761
|
const targets = gotoMatch[1]
|
|
1608
1762
|
.trim()
|
|
1609
1763
|
.split(/\s+/)
|
|
1610
|
-
.filter((t) => /^[A-
|
|
1764
|
+
.filter((t) => /^[A-Z0-9][A-Z0-9-]+$/i.test(t));
|
|
1611
1765
|
for (const target of targets) {
|
|
1612
1766
|
result.gotos.push({ caller: currentParagraph, target, line: lineNum });
|
|
1613
1767
|
}
|
|
@@ -1654,7 +1808,7 @@ export function extractCobolSymbolsWithRegex(content, _filePath) {
|
|
|
1654
1808
|
}
|
|
1655
1809
|
}
|
|
1656
1810
|
}
|
|
1657
|
-
const inspectMatch = line.match(/\bINSPECT\s+([A-
|
|
1811
|
+
const inspectMatch = line.match(/\bINSPECT\s+([A-Z0-9][A-Z0-9-]+)/i);
|
|
1658
1812
|
if (inspectMatch && inspectAccum === null) {
|
|
1659
1813
|
inspectAccum = line;
|
|
1660
1814
|
inspectStartLine = lineNum;
|
|
@@ -1685,7 +1839,7 @@ export function extractCobolSymbolsWithRegex(content, _filePath) {
|
|
|
1685
1839
|
const targets = setTrueMatch[1]
|
|
1686
1840
|
.trim()
|
|
1687
1841
|
.split(/\s+/)
|
|
1688
|
-
.filter((t) => /^[A-
|
|
1842
|
+
.filter((t) => /^[A-Z0-9][A-Z0-9-]+$/i.test(t) && t.toUpperCase() !== 'OF');
|
|
1689
1843
|
if (targets.length > 0) {
|
|
1690
1844
|
result.sets.push({ targets, form: 'to-true', line: lineNum, caller: currentParagraph });
|
|
1691
1845
|
}
|
|
@@ -1696,7 +1850,7 @@ export function extractCobolSymbolsWithRegex(content, _filePath) {
|
|
|
1696
1850
|
const targets = setIdxMatch[1]
|
|
1697
1851
|
.trim()
|
|
1698
1852
|
.split(/\s+/)
|
|
1699
|
-
.filter((t) => /^[A-
|
|
1853
|
+
.filter((t) => /^[A-Z0-9][A-Z0-9-]+$/i.test(t));
|
|
1700
1854
|
const mode = setIdxMatch[2].toUpperCase();
|
|
1701
1855
|
const form = mode === 'TO'
|
|
1702
1856
|
? 'to-value'
|
|
@@ -1718,7 +1872,7 @@ export function extractCobolSymbolsWithRegex(content, _filePath) {
|
|
|
1718
1872
|
const targets = initMatch[1]
|
|
1719
1873
|
.trim()
|
|
1720
1874
|
.split(/\s+/)
|
|
1721
|
-
.filter((t) => /^[A-
|
|
1875
|
+
.filter((t) => /^[A-Z0-9][A-Z0-9-]+$/i.test(t) && !INITIALIZE_CLAUSE_KEYWORDS.has(t.toUpperCase()));
|
|
1722
1876
|
for (const target of targets) {
|
|
1723
1877
|
result.initializes.push({ target, line: lineNum, caller: currentParagraph });
|
|
1724
1878
|
}
|