@aroman22/codegraph-vba-darwin-arm64 1.5.2 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/codegraph +5 -0
- package/lib/dist/bin/codegraph.d.ts +1 -1
- package/lib/dist/bin/codegraph.d.ts.map +1 -1
- package/lib/dist/bin/codegraph.js +307 -81
- package/lib/dist/bin/codegraph.js.map +1 -1
- package/lib/dist/bin/command-supervision.d.ts +38 -1
- package/lib/dist/bin/command-supervision.d.ts.map +1 -1
- package/lib/dist/bin/command-supervision.js +22 -3
- package/lib/dist/bin/command-supervision.js.map +1 -1
- package/lib/dist/db/index.d.ts +84 -5
- package/lib/dist/db/index.d.ts.map +1 -1
- package/lib/dist/db/index.js +209 -12
- package/lib/dist/db/index.js.map +1 -1
- package/lib/dist/db/migrations.d.ts +1 -1
- package/lib/dist/db/migrations.d.ts.map +1 -1
- package/lib/dist/db/migrations.js +80 -3
- package/lib/dist/db/migrations.js.map +1 -1
- package/lib/dist/db/queries.d.ts +116 -4
- package/lib/dist/db/queries.d.ts.map +1 -1
- package/lib/dist/db/queries.js +294 -7
- package/lib/dist/db/queries.js.map +1 -1
- package/lib/dist/db/schema.sql +43 -1
- package/lib/dist/db/wal-valve.d.ts +106 -0
- package/lib/dist/db/wal-valve.d.ts.map +1 -0
- package/lib/dist/db/wal-valve.js +208 -0
- package/lib/dist/db/wal-valve.js.map +1 -0
- package/lib/dist/directory.d.ts +9 -5
- package/lib/dist/directory.d.ts.map +1 -1
- package/lib/dist/directory.js +210 -19
- package/lib/dist/directory.js.map +1 -1
- package/lib/dist/extraction/cfml-extractor.d.ts +107 -0
- package/lib/dist/extraction/cfml-extractor.d.ts.map +1 -0
- package/lib/dist/extraction/cfml-extractor.js +494 -0
- package/lib/dist/extraction/cfml-extractor.js.map +1 -0
- package/lib/dist/extraction/grammars.d.ts +25 -1
- package/lib/dist/extraction/grammars.d.ts.map +1 -1
- package/lib/dist/extraction/grammars.js +177 -23
- package/lib/dist/extraction/grammars.js.map +1 -1
- package/lib/dist/extraction/index.d.ts +47 -2
- package/lib/dist/extraction/index.d.ts.map +1 -1
- package/lib/dist/extraction/index.js +568 -51
- package/lib/dist/extraction/index.js.map +1 -1
- package/lib/dist/extraction/languages/arkts.d.ts +3 -0
- package/lib/dist/extraction/languages/arkts.d.ts.map +1 -0
- package/lib/dist/extraction/languages/arkts.js +127 -0
- package/lib/dist/extraction/languages/arkts.js.map +1 -0
- package/lib/dist/extraction/languages/c-cpp.d.ts +98 -0
- package/lib/dist/extraction/languages/c-cpp.d.ts.map +1 -1
- package/lib/dist/extraction/languages/c-cpp.js +563 -1
- package/lib/dist/extraction/languages/c-cpp.js.map +1 -1
- package/lib/dist/extraction/languages/cfquery.d.ts +12 -0
- package/lib/dist/extraction/languages/cfquery.d.ts.map +1 -0
- package/lib/dist/extraction/languages/cfquery.js +28 -0
- package/lib/dist/extraction/languages/cfquery.js.map +1 -0
- package/lib/dist/extraction/languages/cfscript.d.ts +3 -0
- package/lib/dist/extraction/languages/cfscript.d.ts.map +1 -0
- package/lib/dist/extraction/languages/cfscript.js +73 -0
- package/lib/dist/extraction/languages/cfscript.js.map +1 -0
- package/lib/dist/extraction/languages/cobol.d.ts +33 -0
- package/lib/dist/extraction/languages/cobol.d.ts.map +1 -0
- package/lib/dist/extraction/languages/cobol.js +499 -0
- package/lib/dist/extraction/languages/cobol.js.map +1 -0
- package/lib/dist/extraction/languages/erlang.d.ts +3 -0
- package/lib/dist/extraction/languages/erlang.d.ts.map +1 -0
- package/lib/dist/extraction/languages/erlang.js +350 -0
- package/lib/dist/extraction/languages/erlang.js.map +1 -0
- package/lib/dist/extraction/languages/index.d.ts.map +1 -1
- package/lib/dist/extraction/languages/index.js +18 -0
- package/lib/dist/extraction/languages/index.js.map +1 -1
- package/lib/dist/extraction/languages/nix.d.ts +3 -0
- package/lib/dist/extraction/languages/nix.d.ts.map +1 -0
- package/lib/dist/extraction/languages/nix.js +294 -0
- package/lib/dist/extraction/languages/nix.js.map +1 -0
- package/lib/dist/extraction/languages/solidity.d.ts +3 -0
- package/lib/dist/extraction/languages/solidity.d.ts.map +1 -0
- package/lib/dist/extraction/languages/solidity.js +293 -0
- package/lib/dist/extraction/languages/solidity.js.map +1 -0
- package/lib/dist/extraction/languages/terraform.d.ts +3 -0
- package/lib/dist/extraction/languages/terraform.d.ts.map +1 -0
- package/lib/dist/extraction/languages/terraform.js +641 -0
- package/lib/dist/extraction/languages/terraform.js.map +1 -0
- package/lib/dist/extraction/languages/vbnet.d.ts +11 -0
- package/lib/dist/extraction/languages/vbnet.d.ts.map +1 -0
- package/lib/dist/extraction/languages/vbnet.js +141 -0
- package/lib/dist/extraction/languages/vbnet.js.map +1 -0
- package/lib/dist/extraction/mybatis-extractor.d.ts +30 -10
- package/lib/dist/extraction/mybatis-extractor.d.ts.map +1 -1
- package/lib/dist/extraction/mybatis-extractor.js +140 -38
- package/lib/dist/extraction/mybatis-extractor.js.map +1 -1
- package/lib/dist/extraction/parse-pool.d.ts +28 -1
- package/lib/dist/extraction/parse-pool.d.ts.map +1 -1
- package/lib/dist/extraction/parse-pool.js +76 -7
- package/lib/dist/extraction/parse-pool.js.map +1 -1
- package/lib/dist/extraction/parse-worker.js +11 -4
- package/lib/dist/extraction/parse-worker.js.map +1 -1
- package/lib/dist/extraction/tree-sitter-helpers.d.ts.map +1 -1
- package/lib/dist/extraction/tree-sitter-helpers.js +1 -0
- package/lib/dist/extraction/tree-sitter-helpers.js.map +1 -1
- package/lib/dist/extraction/tree-sitter-types.d.ts +20 -1
- package/lib/dist/extraction/tree-sitter-types.d.ts.map +1 -1
- package/lib/dist/extraction/tree-sitter.d.ts +60 -1
- package/lib/dist/extraction/tree-sitter.d.ts.map +1 -1
- package/lib/dist/extraction/tree-sitter.js +905 -20
- package/lib/dist/extraction/tree-sitter.js.map +1 -1
- package/lib/dist/extraction/vba/call-sweep.d.ts +3 -0
- package/lib/dist/extraction/vba/call-sweep.d.ts.map +1 -0
- package/lib/dist/extraction/vba/call-sweep.js +206 -0
- package/lib/dist/extraction/vba/call-sweep.js.map +1 -0
- package/lib/dist/extraction/vba/calls.d.ts +55 -0
- package/lib/dist/extraction/vba/calls.d.ts.map +1 -0
- package/lib/dist/extraction/vba/calls.js +439 -0
- package/lib/dist/extraction/vba/calls.js.map +1 -0
- package/lib/dist/extraction/vba/constants.d.ts +42 -0
- package/lib/dist/extraction/vba/constants.d.ts.map +1 -0
- package/lib/dist/extraction/vba/constants.js +112 -0
- package/lib/dist/extraction/vba/constants.js.map +1 -0
- package/lib/dist/extraction/vba/context.d.ts +175 -0
- package/lib/dist/extraction/vba/context.d.ts.map +1 -0
- package/lib/dist/extraction/vba/context.js +268 -0
- package/lib/dist/extraction/vba/context.js.map +1 -0
- package/lib/dist/extraction/vba/controls.d.ts +24 -0
- package/lib/dist/extraction/vba/controls.d.ts.map +1 -0
- package/lib/dist/extraction/vba/controls.js +89 -0
- package/lib/dist/extraction/vba/controls.js.map +1 -0
- package/lib/dist/extraction/vba/declarations.d.ts +3 -0
- package/lib/dist/extraction/vba/declarations.d.ts.map +1 -0
- package/lib/dist/extraction/vba/declarations.js +154 -0
- package/lib/dist/extraction/vba/declarations.js.map +1 -0
- package/lib/dist/extraction/vba/dims.d.ts +3 -0
- package/lib/dist/extraction/vba/dims.d.ts.map +1 -0
- package/lib/dist/extraction/vba/dims.js +186 -0
- package/lib/dist/extraction/vba/dims.js.map +1 -0
- package/lib/dist/extraction/vba/docmd.d.ts +16 -0
- package/lib/dist/extraction/vba/docmd.d.ts.map +1 -0
- package/lib/dist/extraction/vba/docmd.js +179 -0
- package/lib/dist/extraction/vba/docmd.js.map +1 -0
- package/lib/dist/extraction/vba/enums-consts.d.ts +15 -0
- package/lib/dist/extraction/vba/enums-consts.d.ts.map +1 -0
- package/lib/dist/extraction/vba/enums-consts.js +178 -0
- package/lib/dist/extraction/vba/enums-consts.js.map +1 -0
- package/lib/dist/extraction/vba/implements.d.ts +3 -0
- package/lib/dist/extraction/vba/implements.d.ts.map +1 -0
- package/lib/dist/extraction/vba/implements.js +52 -0
- package/lib/dist/extraction/vba/implements.js.map +1 -0
- package/lib/dist/extraction/vba/procedures.d.ts +3 -0
- package/lib/dist/extraction/vba/procedures.d.ts.map +1 -0
- package/lib/dist/extraction/vba/procedures.js +239 -0
- package/lib/dist/extraction/vba/procedures.js.map +1 -0
- package/lib/dist/extraction/vba/sql-wrapper.d.ts +17 -0
- package/lib/dist/extraction/vba/sql-wrapper.d.ts.map +1 -0
- package/lib/dist/extraction/vba/sql-wrapper.js +212 -0
- package/lib/dist/extraction/vba/sql-wrapper.js.map +1 -0
- package/lib/dist/extraction/vba/tempvars.d.ts +10 -0
- package/lib/dist/extraction/vba/tempvars.d.ts.map +1 -0
- package/lib/dist/extraction/vba/tempvars.js +138 -0
- package/lib/dist/extraction/vba/tempvars.js.map +1 -0
- package/lib/dist/extraction/vba/text-utils.d.ts +73 -0
- package/lib/dist/extraction/vba/text-utils.d.ts.map +1 -0
- package/lib/dist/extraction/vba/text-utils.js +195 -0
- package/lib/dist/extraction/vba/text-utils.js.map +1 -0
- package/lib/dist/extraction/vba-extractor.d.ts +3 -951
- package/lib/dist/extraction/vba-extractor.d.ts.map +1 -1
- package/lib/dist/extraction/vba-extractor.js +46 -2934
- package/lib/dist/extraction/vba-extractor.js.map +1 -1
- package/lib/dist/extraction/vba-preprocess.d.ts +1 -1
- package/lib/dist/extraction/vba-preprocess.d.ts.map +1 -1
- package/lib/dist/extraction/vba-preprocess.js +300 -88
- package/lib/dist/extraction/vba-preprocess.js.map +1 -1
- package/lib/dist/extraction/wasm/tree-sitter-arkts.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-cfml.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-cfquery.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-cfscript.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-cobol.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-erlang.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-nix.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-terraform.wasm +0 -0
- package/lib/dist/extraction/wasm/tree-sitter-vbnet.wasm +0 -0
- package/lib/dist/graph/traversal.d.ts.map +1 -1
- package/lib/dist/graph/traversal.js +76 -17
- package/lib/dist/graph/traversal.js.map +1 -1
- package/lib/dist/index.d.ts +81 -1
- package/lib/dist/index.d.ts.map +1 -1
- package/lib/dist/index.js +460 -10
- package/lib/dist/index.js.map +1 -1
- package/lib/dist/installer/index.d.ts +42 -0
- package/lib/dist/installer/index.d.ts.map +1 -1
- package/lib/dist/installer/index.js +97 -2
- package/lib/dist/installer/index.js.map +1 -1
- package/lib/dist/mcp/daemon.d.ts +35 -3
- package/lib/dist/mcp/daemon.d.ts.map +1 -1
- package/lib/dist/mcp/daemon.js +101 -9
- package/lib/dist/mcp/daemon.js.map +1 -1
- package/lib/dist/mcp/dynamic-boundaries.d.ts.map +1 -1
- package/lib/dist/mcp/dynamic-boundaries.js +2 -1
- package/lib/dist/mcp/dynamic-boundaries.js.map +1 -1
- package/lib/dist/mcp/early-ppid.d.ts +26 -0
- package/lib/dist/mcp/early-ppid.d.ts.map +1 -0
- package/lib/dist/mcp/early-ppid.js +29 -0
- package/lib/dist/mcp/early-ppid.js.map +1 -0
- package/lib/dist/mcp/index.d.ts.map +1 -1
- package/lib/dist/mcp/index.js +29 -4
- package/lib/dist/mcp/index.js.map +1 -1
- package/lib/dist/mcp/liveness-watchdog.d.ts +18 -1
- package/lib/dist/mcp/liveness-watchdog.d.ts.map +1 -1
- package/lib/dist/mcp/liveness-watchdog.js +73 -13
- package/lib/dist/mcp/liveness-watchdog.js.map +1 -1
- package/lib/dist/mcp/proxy.d.ts.map +1 -1
- package/lib/dist/mcp/proxy.js +30 -4
- package/lib/dist/mcp/proxy.js.map +1 -1
- package/lib/dist/mcp/query-pool.d.ts +14 -0
- package/lib/dist/mcp/query-pool.d.ts.map +1 -1
- package/lib/dist/mcp/query-pool.js +18 -0
- package/lib/dist/mcp/query-pool.js.map +1 -1
- package/lib/dist/mcp/session.d.ts +14 -0
- package/lib/dist/mcp/session.d.ts.map +1 -1
- package/lib/dist/mcp/session.js +28 -1
- package/lib/dist/mcp/session.js.map +1 -1
- package/lib/dist/mcp/startup-handshake.d.ts +44 -0
- package/lib/dist/mcp/startup-handshake.d.ts.map +1 -0
- package/lib/dist/mcp/startup-handshake.js +73 -0
- package/lib/dist/mcp/startup-handshake.js.map +1 -0
- package/lib/dist/mcp/tools.d.ts +22 -0
- package/lib/dist/mcp/tools.d.ts.map +1 -1
- package/lib/dist/mcp/tools.js +289 -23
- package/lib/dist/mcp/tools.js.map +1 -1
- package/lib/dist/mcp/transport.d.ts.map +1 -1
- package/lib/dist/mcp/transport.js +18 -0
- package/lib/dist/mcp/transport.js.map +1 -1
- package/lib/dist/project-config.d.ts +44 -0
- package/lib/dist/project-config.d.ts.map +1 -1
- package/lib/dist/project-config.js +151 -2
- package/lib/dist/project-config.js.map +1 -1
- package/lib/dist/resolution/c-fnptr-synthesizer.d.ts +2 -1
- package/lib/dist/resolution/c-fnptr-synthesizer.d.ts.map +1 -1
- package/lib/dist/resolution/c-fnptr-synthesizer.js +170 -146
- package/lib/dist/resolution/c-fnptr-synthesizer.js.map +1 -1
- package/lib/dist/resolution/callback-synthesizer.d.ts +1 -1
- package/lib/dist/resolution/callback-synthesizer.d.ts.map +1 -1
- package/lib/dist/resolution/callback-synthesizer.js +1109 -97
- package/lib/dist/resolution/callback-synthesizer.js.map +1 -1
- package/lib/dist/resolution/cooperative-yield.d.ts +32 -0
- package/lib/dist/resolution/cooperative-yield.d.ts.map +1 -0
- package/lib/dist/resolution/cooperative-yield.js +42 -0
- package/lib/dist/resolution/cooperative-yield.js.map +1 -0
- package/lib/dist/resolution/frameworks/cics.d.ts +20 -0
- package/lib/dist/resolution/frameworks/cics.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/cics.js +90 -0
- package/lib/dist/resolution/frameworks/cics.js.map +1 -0
- package/lib/dist/resolution/frameworks/index.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/index.js +6 -0
- package/lib/dist/resolution/frameworks/index.js.map +1 -1
- package/lib/dist/resolution/frameworks/java.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/java.js +14 -6
- package/lib/dist/resolution/frameworks/java.js.map +1 -1
- package/lib/dist/resolution/frameworks/terraform.d.ts +38 -0
- package/lib/dist/resolution/frameworks/terraform.d.ts.map +1 -0
- package/lib/dist/resolution/frameworks/terraform.js +277 -0
- package/lib/dist/resolution/frameworks/terraform.js.map +1 -0
- package/lib/dist/resolution/goframe-synthesizer.d.ts +2 -1
- package/lib/dist/resolution/goframe-synthesizer.d.ts.map +1 -1
- package/lib/dist/resolution/goframe-synthesizer.js +8 -3
- package/lib/dist/resolution/goframe-synthesizer.js.map +1 -1
- package/lib/dist/resolution/import-resolver.d.ts +7 -0
- package/lib/dist/resolution/import-resolver.d.ts.map +1 -1
- package/lib/dist/resolution/import-resolver.js +129 -4
- package/lib/dist/resolution/import-resolver.js.map +1 -1
- package/lib/dist/resolution/index.d.ts +64 -2
- package/lib/dist/resolution/index.d.ts.map +1 -1
- package/lib/dist/resolution/index.js +476 -58
- package/lib/dist/resolution/index.js.map +1 -1
- package/lib/dist/resolution/name-matcher.d.ts +22 -3
- package/lib/dist/resolution/name-matcher.d.ts.map +1 -1
- package/lib/dist/resolution/name-matcher.js +613 -39
- package/lib/dist/resolution/name-matcher.js.map +1 -1
- package/lib/dist/resolution/strip-comments.d.ts +1 -1
- package/lib/dist/resolution/strip-comments.d.ts.map +1 -1
- package/lib/dist/resolution/strip-comments.js +49 -0
- package/lib/dist/resolution/strip-comments.js.map +1 -1
- package/lib/dist/resolution/types.d.ts +29 -0
- package/lib/dist/resolution/types.d.ts.map +1 -1
- package/lib/dist/resolution/workspace-packages.d.ts +10 -0
- package/lib/dist/resolution/workspace-packages.d.ts.map +1 -1
- package/lib/dist/resolution/workspace-packages.js +142 -4
- package/lib/dist/resolution/workspace-packages.js.map +1 -1
- package/lib/dist/search/identifier-segments.d.ts +60 -0
- package/lib/dist/search/identifier-segments.d.ts.map +1 -0
- package/lib/dist/search/identifier-segments.js +176 -0
- package/lib/dist/search/identifier-segments.js.map +1 -0
- package/lib/dist/sync/git-hooks.d.ts.map +1 -1
- package/lib/dist/sync/git-hooks.js +2 -0
- package/lib/dist/sync/git-hooks.js.map +1 -1
- package/lib/dist/sync/watcher.d.ts +10 -5
- package/lib/dist/sync/watcher.d.ts.map +1 -1
- package/lib/dist/sync/watcher.js +51 -14
- package/lib/dist/sync/watcher.js.map +1 -1
- package/lib/dist/sync/worktree.d.ts +9 -0
- package/lib/dist/sync/worktree.d.ts.map +1 -1
- package/lib/dist/sync/worktree.js +45 -0
- package/lib/dist/sync/worktree.js.map +1 -1
- package/lib/dist/types.d.ts +25 -2
- package/lib/dist/types.d.ts.map +1 -1
- package/lib/dist/types.js +10 -0
- package/lib/dist/types.js.map +1 -1
- package/lib/dist/upgrade/index.d.ts +32 -0
- package/lib/dist/upgrade/index.d.ts.map +1 -1
- package/lib/dist/upgrade/index.js +163 -14
- package/lib/dist/upgrade/index.js.map +1 -1
- package/lib/dist/upgrade/remove-binary.d.ts +87 -0
- package/lib/dist/upgrade/remove-binary.d.ts.map +1 -0
- package/lib/dist/upgrade/remove-binary.js +289 -0
- package/lib/dist/upgrade/remove-binary.js.map +1 -0
- package/lib/dist/upgrade/update-check.d.ts +92 -0
- package/lib/dist/upgrade/update-check.d.ts.map +1 -0
- package/lib/dist/upgrade/update-check.js +258 -0
- package/lib/dist/upgrade/update-check.js.map +1 -0
- package/lib/node_modules/.modules.yaml +1 -1
- package/lib/node_modules/.pnpm-workspace-state-v1.json +1 -1
- package/lib/package.json +1 -1
- package/package.json +1 -1
- package/lib/dist/reasoning/config.d.ts +0 -45
- package/lib/dist/reasoning/config.d.ts.map +0 -1
- package/lib/dist/reasoning/config.js +0 -171
- package/lib/dist/reasoning/config.js.map +0 -1
- package/lib/dist/reasoning/credentials.d.ts +0 -5
- package/lib/dist/reasoning/credentials.d.ts.map +0 -1
- package/lib/dist/reasoning/credentials.js +0 -83
- package/lib/dist/reasoning/credentials.js.map +0 -1
- package/lib/dist/reasoning/login.d.ts +0 -21
- package/lib/dist/reasoning/login.d.ts.map +0 -1
- package/lib/dist/reasoning/login.js +0 -85
- package/lib/dist/reasoning/login.js.map +0 -1
- package/lib/dist/reasoning/reasoner.d.ts +0 -43
- package/lib/dist/reasoning/reasoner.d.ts.map +0 -1
- package/lib/dist/reasoning/reasoner.js +0 -308
- package/lib/dist/reasoning/reasoner.js.map +0 -1
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sweepEventsTypesAndDeclares = sweepEventsTypesAndDeclares;
|
|
4
|
+
const tree_sitter_helpers_1 = require("../tree-sitter-helpers");
|
|
5
|
+
const text_utils_1 = require("./text-utils");
|
|
6
|
+
/** `[visibility] Event <Name>(...)` custom event declaration. */
|
|
7
|
+
const EVENT_DECL_RE = /^\s*((?:Public|Private|Friend)\s+)?Event\s+(\p{L}[\p{L}\p{N}_]*)\b/iu;
|
|
8
|
+
/** `[visibility] Type <Name>` user-defined type block start. */
|
|
9
|
+
const TYPE_START_RE = /^\s*((?:Public|Private|Friend)\s+)?Type\s+(\p{L}[\p{L}\p{N}_]*)\b/iu;
|
|
10
|
+
/** `End Type` user-defined type block end. */
|
|
11
|
+
const TYPE_END_RE = /^\s*End\s+Type\b/iu;
|
|
12
|
+
/** `<MemberName> As <Type>` inside a user-defined type block. */
|
|
13
|
+
const TYPE_MEMBER_RE = /^\s*(\p{L}[\p{L}\p{N}_]*)\s*(?:\([^)]*\))?\s+As\s+(.+?)\s*$/iu;
|
|
14
|
+
/** `[visibility] Declare [PtrSafe] Sub|Function <Name> Lib "dll" [Alias "x"] ...` */
|
|
15
|
+
const DLL_DECLARE_RE = /^\s*((?:Public|Private)\s+)?Declare\s+(PtrSafe\s+)?(Sub|Function)\s+(\p{L}[\p{L}\p{N}_]*)\s+Lib\s+"([^"]+)"(?:\s+Alias\s+"([^"]+)")?/iu;
|
|
16
|
+
function sweepEventsTypesAndDeclares(ctx, src) {
|
|
17
|
+
const lines = src.split('\n');
|
|
18
|
+
let count = 0;
|
|
19
|
+
let currentType = null;
|
|
20
|
+
for (let i = 0; i < lines.length; i++) {
|
|
21
|
+
const line = lines[i] ?? '';
|
|
22
|
+
const lineNum = i + 1;
|
|
23
|
+
if (currentType) {
|
|
24
|
+
if (TYPE_END_RE.test(line)) {
|
|
25
|
+
currentType = null;
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
const member = TYPE_MEMBER_RE.exec(line);
|
|
29
|
+
if (member) {
|
|
30
|
+
const memberName = member[1] ?? '';
|
|
31
|
+
const memberType = (member[2] ?? '').trim();
|
|
32
|
+
if (!memberName)
|
|
33
|
+
continue;
|
|
34
|
+
const memberId = (0, tree_sitter_helpers_1.generateNodeId)(ctx.filePath, 'type_member', memberName, lineNum);
|
|
35
|
+
ctx.nodes.push({
|
|
36
|
+
id: memberId,
|
|
37
|
+
kind: 'type_member',
|
|
38
|
+
name: memberName,
|
|
39
|
+
qualifiedName: `${currentType.name}.${memberName}`,
|
|
40
|
+
filePath: ctx.filePath,
|
|
41
|
+
language: 'vba',
|
|
42
|
+
startLine: lineNum,
|
|
43
|
+
endLine: lineNum,
|
|
44
|
+
startColumn: 0,
|
|
45
|
+
endColumn: line.length,
|
|
46
|
+
metadata: { memberType },
|
|
47
|
+
updatedAt: Date.now(),
|
|
48
|
+
});
|
|
49
|
+
ctx.edges.push({
|
|
50
|
+
source: currentType.id,
|
|
51
|
+
target: memberId,
|
|
52
|
+
kind: 'type-member',
|
|
53
|
+
provenance: 'parser',
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
const eventDecl = EVENT_DECL_RE.exec(line);
|
|
59
|
+
if (eventDecl) {
|
|
60
|
+
const visibility = (0, text_utils_1.foldVisibility)(eventDecl[1] ?? '');
|
|
61
|
+
const name = eventDecl[2] ?? '';
|
|
62
|
+
if (!name)
|
|
63
|
+
continue;
|
|
64
|
+
const eventId = (0, tree_sitter_helpers_1.generateNodeId)(ctx.filePath, 'event', name, lineNum);
|
|
65
|
+
const eventNode = {
|
|
66
|
+
id: eventId,
|
|
67
|
+
kind: 'event',
|
|
68
|
+
name,
|
|
69
|
+
signature: line.trim(),
|
|
70
|
+
qualifiedName: ctx.classNamePrefix ? `${ctx.classNamePrefix}.${name}` : name,
|
|
71
|
+
filePath: ctx.filePath,
|
|
72
|
+
language: 'vba',
|
|
73
|
+
startLine: lineNum,
|
|
74
|
+
endLine: lineNum,
|
|
75
|
+
startColumn: 0,
|
|
76
|
+
endColumn: line.length,
|
|
77
|
+
visibility,
|
|
78
|
+
updatedAt: Date.now(),
|
|
79
|
+
};
|
|
80
|
+
ctx.nodes.push(eventNode);
|
|
81
|
+
ctx.localEvents.set(name.toLowerCase(), eventNode);
|
|
82
|
+
ctx.pushContainsFromModule(eventId);
|
|
83
|
+
count++;
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
const typeStart = TYPE_START_RE.exec(line);
|
|
87
|
+
if (typeStart) {
|
|
88
|
+
const visibility = (0, text_utils_1.foldVisibility)(typeStart[1] ?? '');
|
|
89
|
+
const name = typeStart[2] ?? '';
|
|
90
|
+
if (!name)
|
|
91
|
+
continue;
|
|
92
|
+
const typeId = (0, tree_sitter_helpers_1.generateNodeId)(ctx.filePath, 'type', name, lineNum);
|
|
93
|
+
ctx.nodes.push({
|
|
94
|
+
id: typeId,
|
|
95
|
+
kind: 'type',
|
|
96
|
+
name,
|
|
97
|
+
qualifiedName: ctx.classNamePrefix ? `${ctx.classNamePrefix}.${name}` : name,
|
|
98
|
+
filePath: ctx.filePath,
|
|
99
|
+
language: 'vba',
|
|
100
|
+
startLine: lineNum,
|
|
101
|
+
endLine: lineNum,
|
|
102
|
+
startColumn: 0,
|
|
103
|
+
endColumn: line.length,
|
|
104
|
+
visibility,
|
|
105
|
+
updatedAt: Date.now(),
|
|
106
|
+
});
|
|
107
|
+
ctx.pushContainsFromModule(typeId);
|
|
108
|
+
currentType = { id: typeId, name };
|
|
109
|
+
count++;
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
const declaration = DLL_DECLARE_RE.exec(line);
|
|
113
|
+
if (declaration) {
|
|
114
|
+
const visibility = (0, text_utils_1.foldVisibility)(declaration[1] ?? '');
|
|
115
|
+
const ptrSafe = !!declaration[2];
|
|
116
|
+
const declareKind = (declaration[3] ?? '').toLowerCase();
|
|
117
|
+
const name = declaration[4] ?? '';
|
|
118
|
+
const dll = declaration[5] ?? '';
|
|
119
|
+
const aliasName = declaration[6] ?? undefined;
|
|
120
|
+
if (!name)
|
|
121
|
+
continue;
|
|
122
|
+
const declareId = (0, tree_sitter_helpers_1.generateNodeId)(ctx.filePath, 'declare', name, lineNum);
|
|
123
|
+
const declareNode = {
|
|
124
|
+
id: declareId,
|
|
125
|
+
kind: 'declare',
|
|
126
|
+
name,
|
|
127
|
+
qualifiedName: ctx.classNamePrefix ? `${ctx.classNamePrefix}.${name}` : name,
|
|
128
|
+
filePath: ctx.filePath,
|
|
129
|
+
language: 'vba',
|
|
130
|
+
startLine: lineNum,
|
|
131
|
+
endLine: lineNum,
|
|
132
|
+
startColumn: 0,
|
|
133
|
+
endColumn: line.length,
|
|
134
|
+
visibility,
|
|
135
|
+
metadata: {
|
|
136
|
+
isDeclare: true,
|
|
137
|
+
dll,
|
|
138
|
+
declareKind,
|
|
139
|
+
ptrSafe,
|
|
140
|
+
...(aliasName ? { aliasName } : {}),
|
|
141
|
+
},
|
|
142
|
+
updatedAt: Date.now(),
|
|
143
|
+
};
|
|
144
|
+
ctx.nodes.push(declareNode);
|
|
145
|
+
if (!ctx.functionNodeByName.has(name)) {
|
|
146
|
+
ctx.functionNodeByName.set(name, declareNode);
|
|
147
|
+
}
|
|
148
|
+
ctx.pushContainsFromModule(declareId);
|
|
149
|
+
count++;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
return count;
|
|
153
|
+
}
|
|
154
|
+
//# sourceMappingURL=declarations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"declarations.js","sourceRoot":"","sources":["../../../src/extraction/vba/declarations.ts"],"names":[],"mappings":";;AA+BA,kEA2IC;AAlKD,gEAAwD;AACxD,6CAA8C;AAG9C,iEAAiE;AACjE,MAAM,aAAa,GACjB,sEAAsE,CAAC;AAEzE,gEAAgE;AAChE,MAAM,aAAa,GACjB,qEAAqE,CAAC;AAExE,8CAA8C;AAC9C,MAAM,WAAW,GAAG,oBAAoB,CAAC;AAEzC,iEAAiE;AACjE,MAAM,cAAc,GAClB,+DAA+D,CAAC;AAElE,qFAAqF;AACrF,MAAM,cAAc,GAClB,wIAAwI,CAAC;AAE3I,SAAgB,2BAA2B,CAAC,GAAwB,EAAE,GAAW;IAC/E,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC9B,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,IAAI,WAAW,GAAwC,IAAI,CAAC;IAE5D,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACtC,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QAC5B,MAAM,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC;QAEtB,IAAI,WAAW,EAAE,CAAC;YAChB,IAAI,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;gBAC3B,WAAW,GAAG,IAAI,CAAC;gBACnB,SAAS;YACX,CAAC;YACD,MAAM,MAAM,GAAG,cAAc,CAAC,IAAI,CAAC,IAA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|
+
{"version":3,"file":"dims.d.ts","sourceRoot":"","sources":["../../../src/extraction/vba/dims.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAqEhD,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,mBAAmB,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CA4HpF"}
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sweepDimsAndWithEvents = sweepDimsAndWithEvents;
|
|
4
|
+
const tree_sitter_helpers_1 = require("../tree-sitter-helpers");
|
|
5
|
+
const constants_1 = require("./constants");
|
|
6
|
+
/**
|
|
7
|
+
* Check that a line is a variable declaration and NOT a Sub/Function/
|
|
8
|
+
* Property/Const/WithEvents header (those have their own sweeps).
|
|
9
|
+
* Fix 1+3 (Issues #1,#3): replaced the old single-match DIM_QUAL_RE /
|
|
10
|
+
* DIM_UNQUAL_RE pair with a prefix-check + global scan that handles
|
|
11
|
+
* `As New <Type>`, multi-variable `Dim a As Foo, b As Bar`, and all
|
|
12
|
+
* visibility keywords in one pass.
|
|
13
|
+
* Issue #47: now also accepts `Global` (module-level typed instance) and
|
|
14
|
+
* `Static` (procedure-local retention modifier) so they emit the same
|
|
15
|
+
* `references` edge and `localVarTypeMap` registration as their `Dim`
|
|
16
|
+
* siblings today. The negative lookahead is unchanged: `Const` is still
|
|
17
|
+
* routed to `sweepEnumsAndConsts`.
|
|
18
|
+
*/
|
|
19
|
+
const DIM_DECL_PREFIX_RE = /^\s*(?:Dim|Private|Public|Global|Static)\s+(?!(?:Function|Sub|Property|Const|WithEvents)\b)/i;
|
|
20
|
+
/**
|
|
21
|
+
* Globally scan all `identifier As [New] TypePart1[.TypePart2]` on a
|
|
22
|
+
* variable declaration line. Run with /g after confirming DIM_DECL_PREFIX_RE.
|
|
23
|
+
*
|
|
24
|
+
* Groups: (1) variable name, (2) bracketed outer type, (3) unbracketed
|
|
25
|
+
* outer type, (4) bracketed inner type (if qualified), (5) unbracketed
|
|
26
|
+
* inner type. The variable name is always bare (`Dim` cannot declare a
|
|
27
|
+
* bracketed variable). The TYPE position accepts BOTH bracketed names
|
|
28
|
+
* with spaces (e.g. `[Clase Con Espacios]`) and bare identifiers — the
|
|
29
|
+
* bracketed capture wins when present. Only one of (2)/(3) and one of
|
|
30
|
+
* (4)/(5) is ever populated per match.
|
|
31
|
+
* `(?:New\s+)?` consumes the VBA auto-instantiation keyword so it is
|
|
32
|
+
* never captured as the type name (Fix 1).
|
|
33
|
+
*
|
|
34
|
+
* Issue #54: extends the type alternative to accept `[Name With Spaces]`
|
|
35
|
+
* so `Dim x As [Clase Con Espacios]` emits a `references` edge to
|
|
36
|
+
* `Clase Con Espacios` (brackets unwrapped). The unwrap is applied in
|
|
37
|
+
* the sweep loop by picking the bracketed capture group when present.
|
|
38
|
+
*/
|
|
39
|
+
const DIM_ALL_VARS_RE = /\b(\p{L}[\p{L}\p{N}_]*)\s+As\s+(?:New\s+)?(?:\[([^\]]+)\]|(\p{L}[\p{L}\p{N}_]*))(?:\.(?:\[([^\]]+)\]|(\p{L}[\p{L}\p{N}_]*)))?/giu;
|
|
40
|
+
/**
|
|
41
|
+
* Bare-declared variable capture for the `Dim|Private|Public|Global|Static`
|
|
42
|
+
* prefix. Captures (1) the variable name. Used to register bare `Dim x`
|
|
43
|
+
* (no `As` clause) and explicit-primitive `Dim x As Long|String|...`
|
|
44
|
+
* declarations into `localVarTypeMap` so the type tracking is consistent
|
|
45
|
+
* across all three Dim shapes:
|
|
46
|
+
*
|
|
47
|
+
* `Dim x` → outer = 'variant' (VBA default)
|
|
48
|
+
* `Dim x As Variant` → outer = 'variant' (PRIMITIVE_TYPES member)
|
|
49
|
+
* `Dim x As Long` → outer = 'long' (PRIMITIVE_TYPES member)
|
|
50
|
+
* `Dim x As Foo` → outer = 'foo' (project class — non-primitive)
|
|
51
|
+
*
|
|
52
|
+
* Antigravity audit Task 3: the previous `DIM_ALL_VARS_RE` only matched
|
|
53
|
+
* the `... As <Type>` form, so a bare `Dim x` was invisible to
|
|
54
|
+
* `isLocalProjectClassVar` / `scanCallSites` and `x.Method(1)` produced
|
|
55
|
+
* a dead-end `calls` edge to a stub named `x.Method` that no resolver
|
|
56
|
+
* could repoint. Registering bare Dim with `outer = 'variant'` closes
|
|
57
|
+
* the gate, so `scanCallSites` skips ONLY when the receiver is mapped
|
|
58
|
+
* as a primitive — leaving the "undeclared receiver → stub → resolver
|
|
59
|
+
* repoints" path intact for cross-module qualified calls like
|
|
60
|
+
* `modUtils.Foo(1)` (`modUtils` is not in `localVarTypeMap`).
|
|
61
|
+
*/
|
|
62
|
+
const BARE_DIM_VAR_RE = /^\s*(?:Dim|Private|Public|Global|Static)\s+(\p{L}[\p{L}\p{N}_]*)\s*(?:,|$|\b)/iu;
|
|
63
|
+
/** `WithEvents m_X As Form_Foo` — Dim/Private/Public/Global/Static prefix is optional. */
|
|
64
|
+
const WITHEVENTS_RE = /^\s*(?:(?:Dim|Private|Public|Global|Static)\s+)?WithEvents\s+\p{L}[\p{L}\p{N}_]*\s+As\s+(\p{L}[\p{L}\p{N}_]*)/iu;
|
|
65
|
+
function sweepDimsAndWithEvents(ctx, src) {
|
|
66
|
+
const lines = src.split('\n');
|
|
67
|
+
let count = 0;
|
|
68
|
+
for (let i = 0; i < lines.length; i++) {
|
|
69
|
+
const line = lines[i] ?? '';
|
|
70
|
+
const lineNum = i + 1;
|
|
71
|
+
// Fix 1 + Fix 3 (Issues #1, #3): replace the old single-match
|
|
72
|
+
// DIM_QUAL_RE / DIM_UNQUAL_RE pair with a global scan that handles
|
|
73
|
+
// `As New <Type>`, multi-variable `Dim a As Foo, b As Bar`, and
|
|
74
|
+
// qualified `Dim x As Foo.Bar` in a single pass.
|
|
75
|
+
if (DIM_DECL_PREFIX_RE.test(line)) {
|
|
76
|
+
DIM_ALL_VARS_RE.lastIndex = 0;
|
|
77
|
+
let m;
|
|
78
|
+
while ((m = DIM_ALL_VARS_RE.exec(line)) !== null) {
|
|
79
|
+
const varName = m[1] ?? '';
|
|
80
|
+
// Issue #54: DIM_ALL_VARS_RE groups (2) and (3) are alternative
|
|
81
|
+
// captures for the same outer-type position — the bracketed
|
|
82
|
+
// alternative wins when present, the bare one otherwise. The
|
|
83
|
+
// captured value is already unwrapped (the `[...]` is consumed
|
|
84
|
+
// by the regex, group (2) holds the inner content). Same shape
|
|
85
|
+
// for the inner type at groups (4)/(5).
|
|
86
|
+
const outerType = m[2] ?? m[3] ?? '';
|
|
87
|
+
const innerType = m[4] ?? m[5] ?? '';
|
|
88
|
+
// Fix 2 (Issue #2): populate the local var type map so that
|
|
89
|
+
// `sweepCallsAndSql` can gate qualified statement-form calls.
|
|
90
|
+
if (varName && outerType) {
|
|
91
|
+
ctx.localVarTypeMap.set(varName.toLowerCase(), {
|
|
92
|
+
outer: outerType,
|
|
93
|
+
qualified: !!innerType,
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
if (innerType) {
|
|
97
|
+
// Qualified form (`Dim x As Foo.Bar`) — emit reference to the
|
|
98
|
+
// outer type `Foo` (same behaviour as the old DIM_QUAL_RE path).
|
|
99
|
+
if (outerType) {
|
|
100
|
+
ctx.emitReference(outerType, lineNum, 0, 'vba-name-resolution');
|
|
101
|
+
count++;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
// Unqualified form (`Dim x As SomeType`, `Dim x As New SomeType`)
|
|
106
|
+
// — emit reference only when the type is not a primitive or keyword.
|
|
107
|
+
if (outerType && !constants_1.PRIMITIVE_TYPES.has(outerType.toLowerCase())) {
|
|
108
|
+
ctx.emitReference(outerType, lineNum, 0, 'vba-name-resolution');
|
|
109
|
+
count++;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
// Antigravity audit Task 3: bare `Dim x` (no `As` clause) and
|
|
114
|
+
// explicit-primitive `Dim x As <primitive>` declarations must
|
|
115
|
+
// still register `x` in `localVarTypeMap` so the qualified-call
|
|
116
|
+
// site scan in `scanCallSites` can gate the dead-end stub that
|
|
117
|
+
// no resolver could ever repoint.
|
|
118
|
+
//
|
|
119
|
+
// Captures the FIRST variable name only. Multi-variable bare
|
|
120
|
+
// Dim (e.g. `Dim a, b, c` without an `As` clause) is rare in
|
|
121
|
+
// real Dysflow fixtures and is intentionally NOT tracked here —
|
|
122
|
+
// those bare variables fall back to the undeclared-receiver
|
|
123
|
+
// path, which is the conservative choice. Skip if the typed-form
|
|
124
|
+
// loop already populated the entry.
|
|
125
|
+
const bm = BARE_DIM_VAR_RE.exec(line);
|
|
126
|
+
if (bm) {
|
|
127
|
+
const varName = bm[1] ?? '';
|
|
128
|
+
if (varName) {
|
|
129
|
+
const key = varName.toLowerCase();
|
|
130
|
+
if (!ctx.localVarTypeMap.has(key)) {
|
|
131
|
+
// Look for an `As <Type>` continuation on the same line so the
|
|
132
|
+
// outer type matches the existing typed-form behaviour. If
|
|
133
|
+
// absent, the variable is implicit `Variant` per VBA semantics.
|
|
134
|
+
const asRe = /\bAs\s+(\p{L}[\p{L}\p{N}_]*)/iu;
|
|
135
|
+
const asMatch = asRe.exec(line);
|
|
136
|
+
const outer = asMatch ? (asMatch[1] ?? '').toLowerCase() : 'variant';
|
|
137
|
+
ctx.localVarTypeMap.set(key, {
|
|
138
|
+
outer,
|
|
139
|
+
qualified: false,
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
// WithEvents declarations — handled by their own regex; also populate
|
|
146
|
+
// the local var type map for completeness.
|
|
147
|
+
const weMatch = WITHEVENTS_RE.exec(line);
|
|
148
|
+
if (weMatch) {
|
|
149
|
+
const formType = weMatch[1] ?? '';
|
|
150
|
+
if (formType) {
|
|
151
|
+
// Extract the variable name from the WithEvents line for the map.
|
|
152
|
+
const weVarM = /^\s*(?:(?:Dim|Private|Public|Global|Static)\s+)?WithEvents\s+(\p{L}[\p{L}\p{N}_]*)/iu.exec(line);
|
|
153
|
+
const weVarName = weVarM?.[1] ?? '';
|
|
154
|
+
if (weVarName) {
|
|
155
|
+
ctx.localVarTypeMap.set(weVarName.toLowerCase(), {
|
|
156
|
+
outer: formType,
|
|
157
|
+
qualified: false,
|
|
158
|
+
withEvents: true,
|
|
159
|
+
variableName: weVarName,
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
ctx.emitReference(formType, lineNum, 0, 'vba-withevents');
|
|
163
|
+
const targetId = (0, tree_sitter_helpers_1.generateNodeId)(ctx.filePath, 'class', formType, 0);
|
|
164
|
+
const subscriberEdge = {
|
|
165
|
+
source: ctx.moduleOrClassNode?.id ?? '',
|
|
166
|
+
target: targetId,
|
|
167
|
+
kind: 'subscribes-event',
|
|
168
|
+
provenance: 'heuristic',
|
|
169
|
+
metadata: {
|
|
170
|
+
synthesizedBy: 'vba-withevents',
|
|
171
|
+
variableName: weVarName || undefined,
|
|
172
|
+
},
|
|
173
|
+
line: lineNum,
|
|
174
|
+
column: 0,
|
|
175
|
+
};
|
|
176
|
+
ctx.edges.push(subscriberEdge);
|
|
177
|
+
if (!ctx.moduleOrClassNode) {
|
|
178
|
+
ctx.pendingModuleOrClassSource.push(subscriberEdge);
|
|
179
|
+
}
|
|
180
|
+
count++;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
return count;
|
|
185
|
+
}
|
|
186
|
+
//# sourceMappingURL=dims.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dims.js","sourceRoot":"","sources":["../../../src/extraction/vba/dims.ts"],"names":[],"mappings":";;AA8EA,wDA4HC;AAnMD,gEAAwD;AACxD,2CAA8C;AAG9C;;;;;;;;;;;;GAYG;AACH,MAAM,kBAAkB,GACtB,8FAA8F,CAAC;AAEjG;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,eAAe,GACnB,kIAAkI,CAAC;AAErI;;;;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BACpE,MAAM,cAAc,GAAS;oBAC3B,MAAM,EAAE,GAAG,CAAC,iBAAiB,EAAE,EAAE,IAAI,EAAE;oBACvC,MAAM,EAAE,QAAQ;oBAChB,IAAI,EAAE,kBAAkB;oBACxB,UAAU,EAAE,WAAW;oBACvB,QAAQ,EAAE;wBACR,aAAa,EAAE,gBAAgB;wBAC/B,YAAY,EAAE,SAAS,IAAI,SAAS;qBACrC;oBACD,IAAI,EAAE,OAAO;oBACb,MAAM,EAAE,CAAC;iBACV,CAAC;gBACF,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;gBAC/B,IAAI,CAAC,GAAG,CAAC,iBAAiB,EAAE,CAAC;oBAC3B,GAAG,CAAC,0BAA0B,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;gBACtD,CAAC;gBACD,KAAK,EAAE,CAAC;YACV,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { VbaExtractorContext, ProcInfo } from './context';
|
|
2
|
+
/**
|
|
3
|
+
* B4 (hueco 6) extended by Issue #48: scan one line of VBA source for
|
|
4
|
+
* `DoCmd.OpenX "Target"` calls where X ∈ {Form, Report}. For each match emit
|
|
5
|
+
* a cached stub node (form-layout / report-layout) and an
|
|
6
|
+
* `opens-form` / `opens-report` heuristic edge from the calling Sub.
|
|
7
|
+
*/
|
|
8
|
+
export declare function scanDoCmdOpenCalls(ctx: VbaExtractorContext, line: string, caller: ProcInfo, lineNum: number): void;
|
|
9
|
+
/**
|
|
10
|
+
* Issue #48: scan one line of VBA source for `DoCmd.OpenQuery "X"` calls.
|
|
11
|
+
* Each match emits ONE `UnresolvedReference` (NOT a stub + edge) so the
|
|
12
|
+
* resolver binds to the REAL `query` node that `SqlQueryExtractor`
|
|
13
|
+
* produces for `queries/<Name>.sql`, tagged `synthesizedBy: 'vba-opens-query'`.
|
|
14
|
+
*/
|
|
15
|
+
export declare function scanDoCmdOpenQuery(ctx: VbaExtractorContext, line: string, caller: ProcInfo, lineNum: number): void;
|
|
16
|
+
//# sourceMappingURL=docmd.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docmd.d.ts","sourceRoot":"","sources":["../../../src/extraction/vba/docmd.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AA2E1D;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,mBAAmB,EACxB,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,QAAQ,EAChB,OAAO,EAAE,MAAM,GACd,IAAI,CAoBN;AAmED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,mBAAmB,EACxB,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,QAAQ,EAChB,OAAO,EAAE,MAAM,GACd,IAAI,CAsBN"}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.scanDoCmdOpenCalls = scanDoCmdOpenCalls;
|
|
4
|
+
exports.scanDoCmdOpenQuery = scanDoCmdOpenQuery;
|
|
5
|
+
/**
|
|
6
|
+
* `DoCmd.OpenForm` / `DoCmd.OpenReport` / `DoCmd.OpenQuery` modelling
|
|
7
|
+
* (hueco 6 / issues #48, #52). OpenForm/OpenReport emit a synthetic
|
|
8
|
+
* form-layout/report-layout stub + `opens-form`/`opens-report` edge; OpenQuery
|
|
9
|
+
* emits an `UnresolvedReference` the resolver binds to the real `query` node.
|
|
10
|
+
*
|
|
11
|
+
* `DoCmd` is in `RUNTIME_RECEIVER_BLACKLIST`, so these methods are skipped by
|
|
12
|
+
* the generic call-site scan and handled here with their own emission path.
|
|
13
|
+
*/
|
|
14
|
+
const tree_sitter_helpers_1 = require("../tree-sitter-helpers");
|
|
15
|
+
const text_utils_1 = require("./text-utils");
|
|
16
|
+
/**
|
|
17
|
+
* `DoCmd.OpenForm "<FormName>"` modelling regex — B4 (hueco 6). Captures the
|
|
18
|
+
* first argument (group 1) as either a `"literal"` or a bare identifier; the
|
|
19
|
+
* trailing positional args (`acNormal`, `acFormEdit`, …) are NOT captured.
|
|
20
|
+
*/
|
|
21
|
+
const OPEN_FORM_ARG_RE = /\bDoCmd\.OpenForm\s+("(?:(?:[^"]|"")*)"|\p{L}[\p{L}\p{N}_]*)/gu;
|
|
22
|
+
/**
|
|
23
|
+
* Issue #48: `DoCmd.OpenReport "<ReportName>"` modelling regex — sibling
|
|
24
|
+
* of `OPEN_FORM_ARG_RE`. Same literal-or-bare-id argument capture and same
|
|
25
|
+
* trailing positional-args drop.
|
|
26
|
+
*/
|
|
27
|
+
const OPEN_REPORT_ARG_RE = /\bDoCmd\.OpenReport\s+("(?:(?:[^"]|"")*)"|\p{L}[\p{L}\p{N}_]*)/gu;
|
|
28
|
+
/**
|
|
29
|
+
* Issue #48: `DoCmd.OpenQuery "<QueryName>"` modelling regex. Emits an
|
|
30
|
+
* `UnresolvedReference` (NOT a stub + edge) so the resolver binds to the
|
|
31
|
+
* REAL `query` node `SqlQueryExtractor` emits for `queries/<Name>.sql`.
|
|
32
|
+
*/
|
|
33
|
+
const OPEN_QUERY_ARG_RE = /\bDoCmd\.OpenQuery\s+("(?:(?:[^"]|"")*)"|\p{L}[\p{L}\p{N}_]*)/gu;
|
|
34
|
+
/**
|
|
35
|
+
* Issue #48 dispatch table — shared literal-or-Const argument resolution
|
|
36
|
+
* for `DoCmd.OpenForm` and `DoCmd.OpenReport`. Each entry carries everything
|
|
37
|
+
* `scanDoCmdOpenCalls` + `emitOpensStubEdge` need to share the pipeline
|
|
38
|
+
* between methods while keeping the per-method names distinct.
|
|
39
|
+
*
|
|
40
|
+
* OpenQuery is intentionally NOT in this dispatch — it emits an
|
|
41
|
+
* `UnresolvedReference` (not a stub + edge). See `scanDoCmdOpenQuery`.
|
|
42
|
+
*/
|
|
43
|
+
const DOCMD_OPEN_DISPATCH = [
|
|
44
|
+
{
|
|
45
|
+
method: 'OpenForm',
|
|
46
|
+
re: OPEN_FORM_ARG_RE,
|
|
47
|
+
edgeKind: 'opens-form',
|
|
48
|
+
stubKind: 'form-layout',
|
|
49
|
+
syntheticPrefix: 'synthetic:opensFormStub',
|
|
50
|
+
syntheticExtension: '.form.txt',
|
|
51
|
+
moduleNamePrefix: 'Form_',
|
|
52
|
+
cacheKey: 'OpenForm',
|
|
53
|
+
metadataTargetKey: 'targetFormName',
|
|
54
|
+
synthesizedBy: 'vba-opens-form',
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
method: 'OpenReport',
|
|
58
|
+
re: OPEN_REPORT_ARG_RE,
|
|
59
|
+
edgeKind: 'opens-report',
|
|
60
|
+
stubKind: 'report-layout',
|
|
61
|
+
syntheticPrefix: 'synthetic:opensReportStub',
|
|
62
|
+
syntheticExtension: '.report.txt',
|
|
63
|
+
moduleNamePrefix: 'Report_',
|
|
64
|
+
cacheKey: 'OpenReport',
|
|
65
|
+
metadataTargetKey: 'targetReportName',
|
|
66
|
+
synthesizedBy: 'vba-opens-report',
|
|
67
|
+
},
|
|
68
|
+
];
|
|
69
|
+
/**
|
|
70
|
+
* B4 (hueco 6) extended by Issue #48: scan one line of VBA source for
|
|
71
|
+
* `DoCmd.OpenX "Target"` calls where X ∈ {Form, Report}. For each match emit
|
|
72
|
+
* a cached stub node (form-layout / report-layout) and an
|
|
73
|
+
* `opens-form` / `opens-report` heuristic edge from the calling Sub.
|
|
74
|
+
*/
|
|
75
|
+
function scanDoCmdOpenCalls(ctx, line, caller, lineNum) {
|
|
76
|
+
for (const dispatch of DOCMD_OPEN_DISPATCH) {
|
|
77
|
+
// Each regex has /g so we MUST reset `lastIndex` before use; cloning
|
|
78
|
+
// the regex is the simplest way to avoid leaking state across lines
|
|
79
|
+
// AND across dispatch iterations.
|
|
80
|
+
const localRe = new RegExp(dispatch.re.source, dispatch.re.flags);
|
|
81
|
+
let m;
|
|
82
|
+
while ((m = localRe.exec(line)) !== null) {
|
|
83
|
+
const rawArg = (m[1] ?? '').trim();
|
|
84
|
+
// Issue #52: const lookup is now per-proc-bucket with module
|
|
85
|
+
// fallback (see `resolveLocalConst`). Two procs declaring the
|
|
86
|
+
// same Const name with different values no longer collide —
|
|
87
|
+
// each call site uses the value visible at its own scope.
|
|
88
|
+
const targetName = rawArg.startsWith('"')
|
|
89
|
+
? (0, text_utils_1.unwrapVbaStringLiteral)(rawArg)
|
|
90
|
+
: (ctx.resolveLocalConst(rawArg) ?? rawArg);
|
|
91
|
+
if (!targetName)
|
|
92
|
+
continue;
|
|
93
|
+
emitOpensStubEdge(ctx, dispatch, caller, targetName, lineNum, m.index);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* B4 (hueco 6) extended by Issue #48: emit a stub `form-layout` /
|
|
99
|
+
* `report-layout` node for `targetName` (cached per dispatch entry so
|
|
100
|
+
* duplicates collapse and OpenForm/OpenReport de-dup buckets stay
|
|
101
|
+
* disjoint) and a single `opens-form` / `opens-report` heuristic edge
|
|
102
|
+
* from `caller` to that stub.
|
|
103
|
+
*/
|
|
104
|
+
function emitOpensStubEdge(ctx, dispatch, caller, targetName, lineNum, column) {
|
|
105
|
+
const key = `${dispatch.cacheKey}:${targetName.toLowerCase()}`;
|
|
106
|
+
let stubId = ctx.opensStubIdsByKey.get(key);
|
|
107
|
+
if (!stubId) {
|
|
108
|
+
// Synthetic file path keeps the stub's id deterministic AND
|
|
109
|
+
// disambiguates it from any real `.form.txt` / `.report.txt`
|
|
110
|
+
// indexed later. The directory prefix is intentionally not a real
|
|
111
|
+
// filesystem path — it just namespaces the id space. The file
|
|
112
|
+
// extension DOES mirror the real form/report file extension so a
|
|
113
|
+
// reader of the synthetic path can tell the stub's intent at a glance.
|
|
114
|
+
const syntheticFilePath = `${dispatch.syntheticPrefix}/${targetName}${dispatch.syntheticExtension}`;
|
|
115
|
+
stubId = (0, tree_sitter_helpers_1.generateNodeId)(syntheticFilePath, dispatch.stubKind, targetName, 0);
|
|
116
|
+
ctx.opensStubIdsByKey.set(key, stubId);
|
|
117
|
+
ctx.nodes.push({
|
|
118
|
+
id: stubId,
|
|
119
|
+
kind: dispatch.stubKind,
|
|
120
|
+
name: targetName,
|
|
121
|
+
// Convention: form module names in Access are `Form_<Name>` and
|
|
122
|
+
// report module names are `Report_<Name>`. We follow the same
|
|
123
|
+
// convention in the synthetic stub's qualifiedName so cross-file
|
|
124
|
+
// lookups can find it consistently.
|
|
125
|
+
qualifiedName: `${dispatch.moduleNamePrefix}${targetName}`,
|
|
126
|
+
filePath: syntheticFilePath,
|
|
127
|
+
language: 'vba',
|
|
128
|
+
startLine: lineNum,
|
|
129
|
+
endLine: lineNum,
|
|
130
|
+
startColumn: 0,
|
|
131
|
+
endColumn: 0,
|
|
132
|
+
metadata: { stub: true },
|
|
133
|
+
updatedAt: Date.now(),
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
ctx.edges.push({
|
|
137
|
+
source: ctx.findOrCreateFunctionNodeId(caller),
|
|
138
|
+
target: stubId,
|
|
139
|
+
kind: dispatch.edgeKind,
|
|
140
|
+
provenance: 'heuristic',
|
|
141
|
+
metadata: {
|
|
142
|
+
synthesizedBy: dispatch.synthesizedBy,
|
|
143
|
+
[dispatch.metadataTargetKey]: targetName,
|
|
144
|
+
},
|
|
145
|
+
line: lineNum,
|
|
146
|
+
column,
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Issue #48: scan one line of VBA source for `DoCmd.OpenQuery "X"` calls.
|
|
151
|
+
* Each match emits ONE `UnresolvedReference` (NOT a stub + edge) so the
|
|
152
|
+
* resolver binds to the REAL `query` node that `SqlQueryExtractor`
|
|
153
|
+
* produces for `queries/<Name>.sql`, tagged `synthesizedBy: 'vba-opens-query'`.
|
|
154
|
+
*/
|
|
155
|
+
function scanDoCmdOpenQuery(ctx, line, caller, lineNum) {
|
|
156
|
+
const localRe = new RegExp(OPEN_QUERY_ARG_RE.source, OPEN_QUERY_ARG_RE.flags);
|
|
157
|
+
let m;
|
|
158
|
+
while ((m = localRe.exec(line)) !== null) {
|
|
159
|
+
const rawArg = (m[1] ?? '').trim();
|
|
160
|
+
// Issue #52: same per-proc-with-module-fallback lookup as
|
|
161
|
+
// `scanDoCmdOpenCalls`.
|
|
162
|
+
const targetName = rawArg.startsWith('"')
|
|
163
|
+
? (0, text_utils_1.unwrapVbaStringLiteral)(rawArg)
|
|
164
|
+
: (ctx.resolveLocalConst(rawArg) ?? rawArg);
|
|
165
|
+
if (!targetName)
|
|
166
|
+
continue;
|
|
167
|
+
ctx.unresolvedReferences.push({
|
|
168
|
+
fromNodeId: ctx.findOrCreateFunctionNodeId(caller),
|
|
169
|
+
referenceName: targetName,
|
|
170
|
+
referenceKind: 'references',
|
|
171
|
+
line: lineNum,
|
|
172
|
+
column: m.index,
|
|
173
|
+
filePath: ctx.filePath,
|
|
174
|
+
language: 'vba',
|
|
175
|
+
metadata: { synthesizedBy: 'vba-opens-query' },
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
//# sourceMappingURL=docmd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docmd.js","sourceRoot":"","sources":["../../../src/extraction/vba/docmd.ts"],"names":[],"mappings":";;AA4FA,gDAyBC;AAyED,gDA2BC;AAzND;;;;;;;;GAQG;AACH,gEAAwD;AACxD,6CAAsD;AAGtD;;;;GAIG;AACH,MAAM,gBAAgB,GACpB,gEAAgE,CAAC;AAEnE;;;;GAIG;AACH,MAAM,kBAAkB,GACtB,kEAAkE,CAAC;AAErE;;;;GAIG;AACH,MAAM,iBAAiB,GACrB,iEAAiE,CAAC;AAepE;;;;;;;;GAQG;AACH,MAAM,mBAAmB,GAAqC;IAC5D;QACE,MAAM,EAAE,UAAU;QAClB,EAAE,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AC;QAC9C,IAAI,CAAC,UAAU;YAAE,SAAS;QAC1B,GAAG,CAAC,oBAAoB,CAAC,IAAI,CAAC;YAC5B,UAAU,EAAE,GAAG,CAAC,0BAA0B,CAAC,MAAM,CAAC;YAClD,aAAa,EAAE,UAAU;YACzB,aAAa,EAAE,YAAY;YAC3B,IAAI,EAAE,OAAO;YACb,MAAM,EAAE,CAAC,CAAC,KAAK;YACf,QAAQ,EAAE,GAAG,CAAC,QAAQ;YACtB,QAAQ,EAAE,KAAK;YACf,QAAQ,EAAE,EAAE,aAAa,EAAE,iBAAiB,EAAE;SAC/C,CAAC,CAAC;IACL,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { VbaExtractorContext } from './context';
|
|
2
|
+
/**
|
|
3
|
+
* Walk the (uncommented, line-joined) source and emit:
|
|
4
|
+
* - one `enum` node per `Enum <Name>` block, with one `enum_member` node
|
|
5
|
+
* per member and a `contains` edge enum→member;
|
|
6
|
+
* - one `constant` node per name declared on a `Const` line (multi-name
|
|
7
|
+
* lines emit one node per name);
|
|
8
|
+
* - a `contains` edge from the module/class node to each enum and constant
|
|
9
|
+
* (held in `pendingModuleOrClassSource` until the module node exists).
|
|
10
|
+
*
|
|
11
|
+
* Returns the number of top-level symbols (enums + constants) emitted so
|
|
12
|
+
* the caller can flip `hasAnySymbols`.
|
|
13
|
+
*/
|
|
14
|
+
export declare function sweepEnumsAndConsts(ctx: VbaExtractorContext, src: string): number;
|
|
15
|
+
//# sourceMappingURL=enums-consts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enums-consts.d.ts","sourceRoot":"","sources":["../../../src/extraction/vba/enums-consts.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAqBhD;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,mBAAmB,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAuJjF"}
|