@aroman22/codegraph-vba-darwin-arm64 1.15.0 → 1.16.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/lib/dist/bin/codegraph.js +13 -7
- package/lib/dist/bin/codegraph.js.map +1 -1
- package/lib/dist/bin/daemon-release.d.ts +7 -0
- package/lib/dist/bin/daemon-release.d.ts.map +1 -0
- package/lib/dist/bin/daemon-release.js +18 -0
- package/lib/dist/bin/daemon-release.js.map +1 -0
- package/lib/dist/db/queries.d.ts +30 -0
- package/lib/dist/db/queries.d.ts.map +1 -1
- package/lib/dist/db/queries.js +51 -1
- package/lib/dist/db/queries.js.map +1 -1
- package/lib/dist/extraction/access-erd-extractor.d.ts +57 -0
- package/lib/dist/extraction/access-erd-extractor.d.ts.map +1 -0
- package/lib/dist/extraction/access-erd-extractor.js +389 -0
- package/lib/dist/extraction/access-erd-extractor.js.map +1 -0
- package/lib/dist/extraction/extraction-version.d.ts +1 -1
- package/lib/dist/extraction/extraction-version.js +1 -1
- package/lib/dist/extraction/grammars.d.ts +20 -0
- package/lib/dist/extraction/grammars.d.ts.map +1 -1
- package/lib/dist/extraction/grammars.js +34 -0
- package/lib/dist/extraction/grammars.js.map +1 -1
- package/lib/dist/extraction/index.d.ts +1 -0
- package/lib/dist/extraction/index.d.ts.map +1 -1
- package/lib/dist/extraction/index.js +371 -351
- package/lib/dist/extraction/index.js.map +1 -1
- package/lib/dist/extraction/parse-pool.d.ts +8 -3
- package/lib/dist/extraction/parse-pool.d.ts.map +1 -1
- package/lib/dist/extraction/parse-pool.js +1 -2
- package/lib/dist/extraction/parse-pool.js.map +1 -1
- package/lib/dist/extraction/parse-worker.js +7 -6
- package/lib/dist/extraction/parse-worker.js.map +1 -1
- package/lib/dist/extraction/sql-query-extractor.d.ts +16 -14
- package/lib/dist/extraction/sql-query-extractor.d.ts.map +1 -1
- package/lib/dist/extraction/sql-query-extractor.js +43 -31
- package/lib/dist/extraction/sql-query-extractor.js.map +1 -1
- package/lib/dist/extraction/sql-table-scan.d.ts +184 -0
- package/lib/dist/extraction/sql-table-scan.d.ts.map +1 -0
- package/lib/dist/extraction/sql-table-scan.js +288 -0
- package/lib/dist/extraction/sql-table-scan.js.map +1 -0
- package/lib/dist/extraction/tree-sitter.d.ts +10 -1
- package/lib/dist/extraction/tree-sitter.d.ts.map +1 -1
- package/lib/dist/extraction/tree-sitter.js +34 -3
- package/lib/dist/extraction/tree-sitter.js.map +1 -1
- package/lib/dist/extraction/vba/call-sweep.d.ts +2 -7
- package/lib/dist/extraction/vba/call-sweep.d.ts.map +1 -1
- package/lib/dist/extraction/vba/call-sweep.js +144 -90
- package/lib/dist/extraction/vba/call-sweep.js.map +1 -1
- package/lib/dist/extraction/vba/calls.d.ts +24 -4
- package/lib/dist/extraction/vba/calls.d.ts.map +1 -1
- package/lib/dist/extraction/vba/calls.js +42 -12
- package/lib/dist/extraction/vba/calls.js.map +1 -1
- package/lib/dist/extraction/vba/constants.d.ts +7 -14
- package/lib/dist/extraction/vba/constants.d.ts.map +1 -1
- package/lib/dist/extraction/vba/constants.js +8 -36
- package/lib/dist/extraction/vba/constants.js.map +1 -1
- package/lib/dist/extraction/vba/context.d.ts +443 -7
- package/lib/dist/extraction/vba/context.d.ts.map +1 -1
- package/lib/dist/extraction/vba/context.js +325 -29
- package/lib/dist/extraction/vba/context.js.map +1 -1
- package/lib/dist/extraction/vba/controls.d.ts +18 -1
- package/lib/dist/extraction/vba/controls.d.ts.map +1 -1
- package/lib/dist/extraction/vba/controls.js +99 -27
- package/lib/dist/extraction/vba/controls.js.map +1 -1
- package/lib/dist/extraction/vba/declarations.d.ts +1 -6
- package/lib/dist/extraction/vba/declarations.d.ts.map +1 -1
- package/lib/dist/extraction/vba/declarations.js +5 -39
- package/lib/dist/extraction/vba/declarations.js.map +1 -1
- package/lib/dist/extraction/vba/dims.d.ts +11 -7
- package/lib/dist/extraction/vba/dims.d.ts.map +1 -1
- package/lib/dist/extraction/vba/dims.js +265 -29
- package/lib/dist/extraction/vba/dims.js.map +1 -1
- package/lib/dist/extraction/vba/docmd.d.ts +29 -2
- package/lib/dist/extraction/vba/docmd.d.ts.map +1 -1
- package/lib/dist/extraction/vba/docmd.js +297 -18
- package/lib/dist/extraction/vba/docmd.js.map +1 -1
- package/lib/dist/extraction/vba/enums-consts.d.ts +7 -14
- package/lib/dist/extraction/vba/enums-consts.d.ts.map +1 -1
- package/lib/dist/extraction/vba/enums-consts.js +11 -45
- package/lib/dist/extraction/vba/enums-consts.js.map +1 -1
- package/lib/dist/extraction/vba/error-channel.d.ts +57 -0
- package/lib/dist/extraction/vba/error-channel.d.ts.map +1 -0
- package/lib/dist/extraction/vba/error-channel.js +128 -0
- package/lib/dist/extraction/vba/error-channel.js.map +1 -0
- package/lib/dist/extraction/vba/errors.d.ts +64 -0
- package/lib/dist/extraction/vba/errors.d.ts.map +1 -0
- package/lib/dist/extraction/vba/errors.js +775 -0
- package/lib/dist/extraction/vba/errors.js.map +1 -0
- package/lib/dist/extraction/vba/filesystem-statements.d.ts +23 -0
- package/lib/dist/extraction/vba/filesystem-statements.d.ts.map +1 -0
- package/lib/dist/extraction/vba/filesystem-statements.js +70 -0
- package/lib/dist/extraction/vba/filesystem-statements.js.map +1 -0
- package/lib/dist/extraction/vba/implements.d.ts +1 -6
- package/lib/dist/extraction/vba/implements.d.ts.map +1 -1
- package/lib/dist/extraction/vba/implements.js +1 -22
- package/lib/dist/extraction/vba/implements.js.map +1 -1
- package/lib/dist/extraction/vba/labels.d.ts +26 -0
- package/lib/dist/extraction/vba/labels.d.ts.map +1 -0
- package/lib/dist/extraction/vba/labels.js +180 -0
- package/lib/dist/extraction/vba/labels.js.map +1 -0
- package/lib/dist/extraction/vba/module-vars.d.ts +36 -0
- package/lib/dist/extraction/vba/module-vars.d.ts.map +1 -0
- package/lib/dist/extraction/vba/module-vars.js +145 -0
- package/lib/dist/extraction/vba/module-vars.js.map +1 -0
- package/lib/dist/extraction/vba/options.d.ts +88 -0
- package/lib/dist/extraction/vba/options.d.ts.map +1 -0
- package/lib/dist/extraction/vba/options.js +39 -0
- package/lib/dist/extraction/vba/options.js.map +1 -0
- package/lib/dist/extraction/vba/parameters.d.ts +35 -0
- package/lib/dist/extraction/vba/parameters.d.ts.map +1 -0
- package/lib/dist/extraction/vba/parameters.js +110 -0
- package/lib/dist/extraction/vba/parameters.js.map +1 -0
- package/lib/dist/extraction/vba/procedures.d.ts +1 -9
- package/lib/dist/extraction/vba/procedures.d.ts.map +1 -1
- package/lib/dist/extraction/vba/procedures.js +174 -112
- package/lib/dist/extraction/vba/procedures.js.map +1 -1
- package/lib/dist/extraction/vba/rules.d.ts +10 -5
- package/lib/dist/extraction/vba/rules.d.ts.map +1 -1
- package/lib/dist/extraction/vba/rules.js +19 -0
- package/lib/dist/extraction/vba/rules.js.map +1 -1
- package/lib/dist/extraction/vba/runtime-objects.d.ts +59 -0
- package/lib/dist/extraction/vba/runtime-objects.d.ts.map +1 -0
- package/lib/dist/extraction/vba/runtime-objects.js +106 -0
- package/lib/dist/extraction/vba/runtime-objects.js.map +1 -0
- package/lib/dist/extraction/vba/signature.d.ts +57 -0
- package/lib/dist/extraction/vba/signature.d.ts.map +1 -0
- package/lib/dist/extraction/vba/signature.js +164 -0
- package/lib/dist/extraction/vba/signature.js.map +1 -0
- package/lib/dist/extraction/vba/sql-wrapper.d.ts +76 -3
- package/lib/dist/extraction/vba/sql-wrapper.d.ts.map +1 -1
- package/lib/dist/extraction/vba/sql-wrapper.js +725 -151
- package/lib/dist/extraction/vba/sql-wrapper.js.map +1 -1
- package/lib/dist/extraction/vba/tempvars.d.ts.map +1 -1
- package/lib/dist/extraction/vba/tempvars.js +4 -0
- package/lib/dist/extraction/vba/tempvars.js.map +1 -1
- package/lib/dist/extraction/vba/text-utils.d.ts +62 -2
- package/lib/dist/extraction/vba/text-utils.d.ts.map +1 -1
- package/lib/dist/extraction/vba/text-utils.js +84 -6
- package/lib/dist/extraction/vba/text-utils.js.map +1 -1
- package/lib/dist/extraction/vba-extractor.d.ts +18 -1
- package/lib/dist/extraction/vba-extractor.d.ts.map +1 -1
- package/lib/dist/extraction/vba-extractor.js +111 -16
- package/lib/dist/extraction/vba-extractor.js.map +1 -1
- package/lib/dist/extraction/vba-form-extractor.d.ts +28 -14
- package/lib/dist/extraction/vba-form-extractor.d.ts.map +1 -1
- package/lib/dist/extraction/vba-form-extractor.js +56 -21
- package/lib/dist/extraction/vba-form-extractor.js.map +1 -1
- package/lib/dist/extraction/vba-preprocess.d.ts +89 -3
- package/lib/dist/extraction/vba-preprocess.d.ts.map +1 -1
- package/lib/dist/extraction/vba-preprocess.js +221 -57
- package/lib/dist/extraction/vba-preprocess.js.map +1 -1
- package/lib/dist/extraction/vba-source.d.ts +0 -10
- package/lib/dist/extraction/vba-source.d.ts.map +1 -1
- package/lib/dist/extraction/vba-source.js +0 -13
- package/lib/dist/extraction/vba-source.js.map +1 -1
- package/lib/dist/extraction/vba-test-manifest-extractor.d.ts +0 -6
- package/lib/dist/extraction/vba-test-manifest-extractor.d.ts.map +1 -1
- package/lib/dist/extraction/vba-test-manifest-extractor.js +0 -1
- package/lib/dist/extraction/vba-test-manifest-extractor.js.map +1 -1
- package/lib/dist/index.d.ts.map +1 -1
- package/lib/dist/index.js +9 -0
- package/lib/dist/index.js.map +1 -1
- package/lib/dist/mcp/daemon-manager.d.ts.map +1 -1
- package/lib/dist/mcp/daemon-manager.js +7 -3
- package/lib/dist/mcp/daemon-manager.js.map +1 -1
- package/lib/dist/mcp/daemon-paths.d.ts +6 -0
- package/lib/dist/mcp/daemon-paths.d.ts.map +1 -1
- package/lib/dist/mcp/daemon-paths.js +15 -0
- package/lib/dist/mcp/daemon-paths.js.map +1 -1
- package/lib/dist/mcp/daemon-registry.d.ts +82 -7
- package/lib/dist/mcp/daemon-registry.d.ts.map +1 -1
- package/lib/dist/mcp/daemon-registry.js +557 -45
- package/lib/dist/mcp/daemon-registry.js.map +1 -1
- package/lib/dist/mcp/daemon-watchdog.d.ts +12 -0
- package/lib/dist/mcp/daemon-watchdog.d.ts.map +1 -1
- package/lib/dist/mcp/daemon-watchdog.js +37 -7
- package/lib/dist/mcp/daemon-watchdog.js.map +1 -1
- package/lib/dist/mcp/daemon.d.ts +20 -1
- package/lib/dist/mcp/daemon.d.ts.map +1 -1
- package/lib/dist/mcp/daemon.js +123 -30
- package/lib/dist/mcp/daemon.js.map +1 -1
- package/lib/dist/mcp/index.d.ts.map +1 -1
- package/lib/dist/mcp/index.js +13 -2
- package/lib/dist/mcp/index.js.map +1 -1
- package/lib/dist/mcp/proxy.d.ts +32 -0
- package/lib/dist/mcp/proxy.d.ts.map +1 -1
- package/lib/dist/mcp/proxy.js +163 -31
- package/lib/dist/mcp/proxy.js.map +1 -1
- package/lib/dist/mcp/tools.d.ts.map +1 -1
- package/lib/dist/mcp/tools.js +29 -1
- package/lib/dist/mcp/tools.js.map +1 -1
- package/lib/dist/project-config.d.ts +43 -2
- package/lib/dist/project-config.d.ts.map +1 -1
- package/lib/dist/project-config.js +86 -2
- package/lib/dist/project-config.js.map +1 -1
- package/lib/dist/resolution/index.d.ts +47 -2
- package/lib/dist/resolution/index.d.ts.map +1 -1
- package/lib/dist/resolution/index.js +160 -5
- package/lib/dist/resolution/index.js.map +1 -1
- package/lib/dist/resolution/name-matcher.d.ts +25 -0
- package/lib/dist/resolution/name-matcher.d.ts.map +1 -1
- package/lib/dist/resolution/name-matcher.js +59 -0
- package/lib/dist/resolution/name-matcher.js.map +1 -1
- package/lib/dist/resolution/vba-runtime-objects.d.ts +11 -11
- package/lib/dist/resolution/vba-runtime-objects.d.ts.map +1 -1
- package/lib/dist/resolution/vba-runtime-objects.js +18 -38
- package/lib/dist/resolution/vba-runtime-objects.js.map +1 -1
- package/lib/dist/types.d.ts +13 -5
- package/lib/dist/types.d.ts.map +1 -1
- package/lib/dist/types.js +17 -0
- package/lib/dist/types.js.map +1 -1
- package/lib/node_modules/.modules.yaml +1 -1
- package/lib/node_modules/.pnpm-workspace-state-v1.json +1 -1
- package/lib/package.json +2 -1
- package/package.json +1 -1
|
@@ -2,11 +2,23 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.scanDoCmdOpenCalls = scanDoCmdOpenCalls;
|
|
4
4
|
exports.scanDoCmdOpenQuery = scanDoCmdOpenQuery;
|
|
5
|
+
exports.scanDoCmdCloseCalls = scanDoCmdCloseCalls;
|
|
6
|
+
exports.scanDoCmdObjectCalls = scanDoCmdObjectCalls;
|
|
5
7
|
/**
|
|
6
|
-
* `DoCmd
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
8
|
+
* `DoCmd.<Verb>` modelling (hueco 6 / issues #48, #52, #254).
|
|
9
|
+
*
|
|
10
|
+
* Four shapes live here:
|
|
11
|
+
* 1. `OpenForm` / `OpenReport` — a synthetic form-layout/report-layout stub
|
|
12
|
+
* plus an `opens-form` / `opens-report` edge.
|
|
13
|
+
* 2. `OpenQuery` — an `UnresolvedReference` the resolver binds to the real
|
|
14
|
+
* `query` node emitted for `queries/<Name>.sql`.
|
|
15
|
+
* 3. Issue #254: every OTHER `DoCmd` verb that names an Access object in a
|
|
16
|
+
* positional argument (`RunMacro`, `TransferSpreadsheet`, `OutputTo`, …).
|
|
17
|
+
* These emit an `UnresolvedReference` and NEVER a node — see
|
|
18
|
+
* `DOCMD_OBJECT_DISPATCH`.
|
|
19
|
+
* 4. Issue #246: `DoCmd.Close acForm|acReport, "<Name>"` — a `references`
|
|
20
|
+
* edge to the SAME stub shape (1) creates, so the form's open/close
|
|
21
|
+
* lifecycle converges on one node. See `scanDoCmdCloseCalls`.
|
|
10
22
|
*
|
|
11
23
|
* `DoCmd` is in `RUNTIME_RECEIVER_BLACKLIST`, so these methods are skipped by
|
|
12
24
|
* the generic call-site scan and handled here with their own emission path.
|
|
@@ -31,6 +43,29 @@ const OPEN_REPORT_ARG_RE = /\bDoCmd\.OpenReport\s+("(?:(?:[^"]|"")*)"|\p{L}[\p{L
|
|
|
31
43
|
* REAL `query` node `SqlQueryExtractor` emits for `queries/<Name>.sql`.
|
|
32
44
|
*/
|
|
33
45
|
const OPEN_QUERY_ARG_RE = /\bDoCmd\.OpenQuery\s+("(?:(?:[^"]|"")*)"|\p{L}[\p{L}\p{N}_]*)/gu;
|
|
46
|
+
/**
|
|
47
|
+
* Issue #246: `DoCmd.Close acForm|acReport, "<Name>"` modelling regex.
|
|
48
|
+
*
|
|
49
|
+
* Group 1 is the object-type constant, group 2 the STRING LITERAL naming the
|
|
50
|
+
* object. Both the bare (`DoCmd.Close acForm, "X"`) and the parenthesised
|
|
51
|
+
* (`DoCmd.Close(acForm, "X")`) call forms match; trailing positional
|
|
52
|
+
* arguments (`acSaveNo`, ...) are not captured.
|
|
53
|
+
*
|
|
54
|
+
* A string literal is the ONLY accepted second-argument shape, deliberately:
|
|
55
|
+
* - a bare `DoCmd.Close` closes "the active object", which is a runtime
|
|
56
|
+
* value and not a name;
|
|
57
|
+
* - `Me.Name`, or any other variable, holds a name only known at runtime.
|
|
58
|
+
* Both are skipped SILENTLY -- a guessed close target is worse than none.
|
|
59
|
+
* Object types other than `acForm` / `acReport` (`acTable`, `acQuery`, ...)
|
|
60
|
+
* have no stub shape to converge on, so they are skipped too.
|
|
61
|
+
*
|
|
62
|
+
* The trailing lookahead requires the literal to be the WHOLE argument: a
|
|
63
|
+
* concatenation such as `"Form" & strSufijo` names a form only known at
|
|
64
|
+
* runtime, and taking its literal prefix would emit a target that does not
|
|
65
|
+
* exist. The argument therefore has to end at the next comma, the closing
|
|
66
|
+
* paren, a VBA statement separator, or the end of the line.
|
|
67
|
+
*/
|
|
68
|
+
const CLOSE_ARG_RE = /\bDoCmd\.Close[ \t]*\(?[ \t]*(acForm|acReport)\b[ \t]*,[ \t]*("(?:(?:[^"]|"")*)")(?=[ \t]*(?:$|[,):]))/giu;
|
|
34
69
|
/**
|
|
35
70
|
* Issue #48 dispatch table — shared literal-or-Const argument resolution
|
|
36
71
|
* for `DoCmd.OpenForm` and `DoCmd.OpenReport`. Each entry carries everything
|
|
@@ -72,7 +107,7 @@ const DOCMD_OPEN_DISPATCH = [
|
|
|
72
107
|
* a cached stub node (form-layout / report-layout) and an
|
|
73
108
|
* `opens-form` / `opens-report` heuristic edge from the calling Sub.
|
|
74
109
|
*/
|
|
75
|
-
function scanDoCmdOpenCalls(ctx, line, caller, lineNum) {
|
|
110
|
+
function scanDoCmdOpenCalls(ctx, line, maskedLine, caller, lineNum) {
|
|
76
111
|
for (const dispatch of DOCMD_OPEN_DISPATCH) {
|
|
77
112
|
// Each regex has /g so we MUST reset `lastIndex` before use; cloning
|
|
78
113
|
// the regex is the simplest way to avoid leaking state across lines
|
|
@@ -80,6 +115,8 @@ function scanDoCmdOpenCalls(ctx, line, caller, lineNum) {
|
|
|
80
115
|
const localRe = new RegExp(dispatch.re.source, dispatch.re.flags);
|
|
81
116
|
let m;
|
|
82
117
|
while ((m = localRe.exec(line)) !== null) {
|
|
118
|
+
if (maskedLine.slice(m.index, m.index + 5).toLowerCase() !== 'docmd')
|
|
119
|
+
continue;
|
|
83
120
|
const rawArg = (m[1] ?? '').trim();
|
|
84
121
|
// Issue #52: const lookup is now per-proc-bucket with module
|
|
85
122
|
// fallback (see `resolveLocalConst`). Two procs declaring the
|
|
@@ -102,6 +139,30 @@ function scanDoCmdOpenCalls(ctx, line, caller, lineNum) {
|
|
|
102
139
|
* from `caller` to that stub.
|
|
103
140
|
*/
|
|
104
141
|
function emitOpensStubEdge(ctx, dispatch, caller, targetName, lineNum, column) {
|
|
142
|
+
const stubId = resolveOpensStubId(ctx, dispatch, targetName, lineNum);
|
|
143
|
+
ctx.edges.push({
|
|
144
|
+
source: ctx.findOrCreateFunctionNodeId(caller),
|
|
145
|
+
target: stubId,
|
|
146
|
+
kind: dispatch.edgeKind,
|
|
147
|
+
provenance: 'heuristic',
|
|
148
|
+
metadata: {
|
|
149
|
+
synthesizedBy: dispatch.synthesizedBy,
|
|
150
|
+
[dispatch.metadataTargetKey]: targetName,
|
|
151
|
+
},
|
|
152
|
+
line: lineNum,
|
|
153
|
+
column,
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Issue #246: the stub half of `emitOpensStubEdge`, lifted out so
|
|
158
|
+
* `scanDoCmdCloseCalls` can point at the SAME node instead of minting a
|
|
159
|
+
* second stub shape for the same form. The cache key is unchanged
|
|
160
|
+
* (`<OpenForm|OpenReport>:<lowercased name>`), which is precisely what makes
|
|
161
|
+
* an `OpenForm "X"` and a `DoCmd.Close acForm, "X"` converge on one node.
|
|
162
|
+
*
|
|
163
|
+
* Returns the id of the cached (or freshly created) stub node.
|
|
164
|
+
*/
|
|
165
|
+
function resolveOpensStubId(ctx, dispatch, targetName, lineNum) {
|
|
105
166
|
const key = `${dispatch.cacheKey}:${targetName.toLowerCase()}`;
|
|
106
167
|
let stubId = ctx.opensStubIdsByKey.get(key);
|
|
107
168
|
if (!stubId) {
|
|
@@ -133,18 +194,7 @@ function emitOpensStubEdge(ctx, dispatch, caller, targetName, lineNum, column) {
|
|
|
133
194
|
updatedAt: Date.now(),
|
|
134
195
|
});
|
|
135
196
|
}
|
|
136
|
-
|
|
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
|
-
});
|
|
197
|
+
return stubId;
|
|
148
198
|
}
|
|
149
199
|
/**
|
|
150
200
|
* Issue #48: scan one line of VBA source for `DoCmd.OpenQuery "X"` calls.
|
|
@@ -152,10 +202,12 @@ function emitOpensStubEdge(ctx, dispatch, caller, targetName, lineNum, column) {
|
|
|
152
202
|
* resolver binds to the REAL `query` node that `SqlQueryExtractor`
|
|
153
203
|
* produces for `queries/<Name>.sql`, tagged `synthesizedBy: 'vba-opens-query'`.
|
|
154
204
|
*/
|
|
155
|
-
function scanDoCmdOpenQuery(ctx, line, caller, lineNum) {
|
|
205
|
+
function scanDoCmdOpenQuery(ctx, line, maskedLine, caller, lineNum) {
|
|
156
206
|
const localRe = new RegExp(OPEN_QUERY_ARG_RE.source, OPEN_QUERY_ARG_RE.flags);
|
|
157
207
|
let m;
|
|
158
208
|
while ((m = localRe.exec(line)) !== null) {
|
|
209
|
+
if (maskedLine.slice(m.index, m.index + 5).toLowerCase() !== 'docmd')
|
|
210
|
+
continue;
|
|
159
211
|
const rawArg = (m[1] ?? '').trim();
|
|
160
212
|
// Issue #52: same per-proc-with-module-fallback lookup as
|
|
161
213
|
// `scanDoCmdOpenCalls`.
|
|
@@ -176,4 +228,231 @@ function scanDoCmdOpenQuery(ctx, line, caller, lineNum) {
|
|
|
176
228
|
});
|
|
177
229
|
}
|
|
178
230
|
}
|
|
231
|
+
/**
|
|
232
|
+
* Issue #246 (task T4): scan one line of VBA source for
|
|
233
|
+
* `DoCmd.Close acForm|acReport, "<Name>"`.
|
|
234
|
+
*
|
|
235
|
+
* Each match emits ONE `references` edge -- not a new edge kind -- from the
|
|
236
|
+
* calling procedure to the very same `form-layout` / `report-layout` stub
|
|
237
|
+
* that `opens-form` / `opens-report` already point at, by reusing
|
|
238
|
+
* `resolveOpensStubId`'s cache. A form that is both opened and closed
|
|
239
|
+
* therefore ends up with ONE node carrying two distinct edges.
|
|
240
|
+
*
|
|
241
|
+
* The edge carries `synthesizedBy: 'vba-closes-form'` for both object types
|
|
242
|
+
* (one tag for the whole verb keeps every close edge queryable as a set) and
|
|
243
|
+
* `targetFormName` as its single name key, for the same reason. If a
|
|
244
|
+
* first-class `closes-form` edge kind is ever wanted, that tag is the seam.
|
|
245
|
+
*/
|
|
246
|
+
function scanDoCmdCloseCalls(ctx, line, maskedLine, caller, lineNum) {
|
|
247
|
+
// The shared regex carries /g, so clone it before use to keep `lastIndex`
|
|
248
|
+
// from leaking across lines.
|
|
249
|
+
const localRe = new RegExp(CLOSE_ARG_RE.source, CLOSE_ARG_RE.flags);
|
|
250
|
+
let m;
|
|
251
|
+
while ((m = localRe.exec(line)) !== null) {
|
|
252
|
+
// `maskedLine` has string CONTENT blanked out, so this rejects a
|
|
253
|
+
// `DoCmd.Close ...` that only appears inside a string literal. The target
|
|
254
|
+
// name itself lives inside a literal, which is why the match runs on the
|
|
255
|
+
// original `line`.
|
|
256
|
+
if (maskedLine.slice(m.index, m.index + 5).toLowerCase() !== 'docmd')
|
|
257
|
+
continue;
|
|
258
|
+
const cacheKey = (m[1] ?? '').toLowerCase() === 'acreport' ? 'OpenReport' : 'OpenForm';
|
|
259
|
+
const dispatch = DOCMD_OPEN_DISPATCH.find((d) => d.cacheKey === cacheKey);
|
|
260
|
+
if (!dispatch)
|
|
261
|
+
continue;
|
|
262
|
+
const targetName = (0, text_utils_1.unwrapVbaStringLiteral)((m[2] ?? '').trim());
|
|
263
|
+
if (!targetName)
|
|
264
|
+
continue;
|
|
265
|
+
ctx.edges.push({
|
|
266
|
+
source: ctx.findOrCreateFunctionNodeId(caller),
|
|
267
|
+
// Same cache, same key shape, same node as `opens-form` -- never a
|
|
268
|
+
// second stub for the same form.
|
|
269
|
+
target: resolveOpensStubId(ctx, dispatch, targetName, lineNum),
|
|
270
|
+
kind: 'references',
|
|
271
|
+
provenance: 'heuristic',
|
|
272
|
+
metadata: {
|
|
273
|
+
synthesizedBy: 'vba-closes-form',
|
|
274
|
+
targetFormName: targetName,
|
|
275
|
+
},
|
|
276
|
+
line: lineNum,
|
|
277
|
+
column: m.index,
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* Issue #254 dispatch table — verb, argument position, provenance tag.
|
|
283
|
+
*
|
|
284
|
+
* Argument positions follow the documented Access `DoCmd` signatures:
|
|
285
|
+
* RunMacro MacroName, RepeatCount, RepeatExpression
|
|
286
|
+
* OpenTable TableName, View, DataMode
|
|
287
|
+
* ApplyFilter FilterName, WhereCondition, ControlName
|
|
288
|
+
* CopyObject DestinationDatabase, NewName, SourceObjectType, SourceObjectName
|
|
289
|
+
* DeleteObject ObjectType, ObjectName
|
|
290
|
+
* Rename NewName, ObjectType, OldName
|
|
291
|
+
* SelectObject ObjectType, ObjectName, InDatabaseWindow
|
|
292
|
+
* BrowseTo ObjectType, ObjectName, PathToSubformControl, …
|
|
293
|
+
* OutputTo ObjectType, ObjectName, OutputFormat, OutputFile, …
|
|
294
|
+
* SendObject ObjectType, ObjectName, OutputFormat, To, …
|
|
295
|
+
* TransferSpreadsheet TransferType, SpreadsheetType, TableName, FileName, …
|
|
296
|
+
* TransferText TransferType, SpecificationName, TableName, FileName, …
|
|
297
|
+
* TransferDatabase TransferType, DatabaseType, DatabaseName, ObjectType, Source, Destination, …
|
|
298
|
+
*/
|
|
299
|
+
const DOCMD_OBJECT_DISPATCH = [
|
|
300
|
+
{ method: 'RunMacro', argIndex: 0, synthesizedBy: 'vba-runs-macro' },
|
|
301
|
+
{ method: 'OpenTable', argIndex: 0, synthesizedBy: 'vba-opens-table' },
|
|
302
|
+
{ method: 'ApplyFilter', argIndex: 0, synthesizedBy: 'vba-applies-filter' },
|
|
303
|
+
{ method: 'CopyObject', argIndex: 3, synthesizedBy: 'vba-copies-object' },
|
|
304
|
+
{ method: 'DeleteObject', argIndex: 1, synthesizedBy: 'vba-deletes-object' },
|
|
305
|
+
{ method: 'Rename', argIndex: 2, synthesizedBy: 'vba-renames-object' },
|
|
306
|
+
{ method: 'SelectObject', argIndex: 1, synthesizedBy: 'vba-selects-object' },
|
|
307
|
+
{ method: 'BrowseTo', argIndex: 1, synthesizedBy: 'vba-browses-to' },
|
|
308
|
+
{ method: 'OutputTo', argIndex: 1, synthesizedBy: 'vba-outputs-to' },
|
|
309
|
+
{ method: 'SendObject', argIndex: 1, synthesizedBy: 'vba-sends-object' },
|
|
310
|
+
{
|
|
311
|
+
method: 'TransferSpreadsheet',
|
|
312
|
+
argIndex: 2,
|
|
313
|
+
synthesizedBy: 'vba-transfers-spreadsheet',
|
|
314
|
+
},
|
|
315
|
+
{ method: 'TransferText', argIndex: 2, synthesizedBy: 'vba-transfers-text' },
|
|
316
|
+
{
|
|
317
|
+
method: 'TransferDatabase',
|
|
318
|
+
argIndex: 4,
|
|
319
|
+
synthesizedBy: 'vba-transfers-database',
|
|
320
|
+
},
|
|
321
|
+
];
|
|
322
|
+
/**
|
|
323
|
+
* One regex per dispatch row, built once at module load. It matches only the
|
|
324
|
+
* `DoCmd.<Verb>` head plus the optional opening paren — the argument list is
|
|
325
|
+
* split by `splitDoCmdArguments`, because a positional lookup through a list
|
|
326
|
+
* that mixes literals, intrinsic constants and omitted arguments is not
|
|
327
|
+
* something a regex should be asked to do.
|
|
328
|
+
*/
|
|
329
|
+
const DOCMD_OBJECT_HEAD_RES = DOCMD_OBJECT_DISPATCH.map((d) => new RegExp(`\\bDoCmd\\.${d.method}\\b[ \\t]*\\(?[ \\t]*`, 'giu'));
|
|
330
|
+
/**
|
|
331
|
+
* Split a `DoCmd` argument list into its top-level arguments, in source order.
|
|
332
|
+
*
|
|
333
|
+
* `text` is the remainder of the line AFTER the `DoCmd.<Verb>` head. Commas
|
|
334
|
+
* inside a string literal or inside a nested paren/bracket group do not split;
|
|
335
|
+
* an omitted argument (`DoCmd.CopyObject , "X", …`) yields an empty string so
|
|
336
|
+
* the positions of the arguments that ARE present stay correct.
|
|
337
|
+
*
|
|
338
|
+
* The scan stops at the first top-level `)` (closing the parenthesised call
|
|
339
|
+
* form), `:` (VBA statement separator) or a comment quote — comments are
|
|
340
|
+
* already stripped upstream, so that last one is defence in depth.
|
|
341
|
+
*/
|
|
342
|
+
function splitDoCmdArguments(text) {
|
|
343
|
+
const args = [];
|
|
344
|
+
let current = '';
|
|
345
|
+
let depth = 0;
|
|
346
|
+
let inString = false;
|
|
347
|
+
for (let i = 0; i < text.length; i++) {
|
|
348
|
+
const ch = text[i] ?? '';
|
|
349
|
+
if (inString) {
|
|
350
|
+
current += ch;
|
|
351
|
+
if (ch === '"') {
|
|
352
|
+
if (text[i + 1] === '"') {
|
|
353
|
+
current += '"';
|
|
354
|
+
i++;
|
|
355
|
+
}
|
|
356
|
+
else {
|
|
357
|
+
inString = false;
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
continue;
|
|
361
|
+
}
|
|
362
|
+
if (ch === '"') {
|
|
363
|
+
inString = true;
|
|
364
|
+
current += ch;
|
|
365
|
+
continue;
|
|
366
|
+
}
|
|
367
|
+
if (ch === '(' || ch === '[') {
|
|
368
|
+
depth++;
|
|
369
|
+
current += ch;
|
|
370
|
+
continue;
|
|
371
|
+
}
|
|
372
|
+
if (ch === ')' || ch === ']') {
|
|
373
|
+
if (depth === 0)
|
|
374
|
+
break;
|
|
375
|
+
depth--;
|
|
376
|
+
current += ch;
|
|
377
|
+
continue;
|
|
378
|
+
}
|
|
379
|
+
if (depth === 0 && (ch === "'" || ch === ':'))
|
|
380
|
+
break;
|
|
381
|
+
if (depth === 0 && ch === ',') {
|
|
382
|
+
args.push(current.trim());
|
|
383
|
+
current = '';
|
|
384
|
+
continue;
|
|
385
|
+
}
|
|
386
|
+
current += ch;
|
|
387
|
+
}
|
|
388
|
+
args.push(current.trim());
|
|
389
|
+
return args;
|
|
390
|
+
}
|
|
391
|
+
/**
|
|
392
|
+
* Resolve one `DoCmd` object argument to the name it denotes, or `null` when
|
|
393
|
+
* it denotes nothing we can know statically.
|
|
394
|
+
*
|
|
395
|
+
* A `"literal"` is taken verbatim. A bare identifier is resolved through the
|
|
396
|
+
* per-proc-then-module `Const` lookup (Issue #52) — a `Const` holding a string
|
|
397
|
+
* literal IS a static name. Anything else (an undeclared variable, a
|
|
398
|
+
* concatenation, a function call) resolves to `null` and the call site stays
|
|
399
|
+
* SILENT. This is deliberately stricter than the `OpenForm`/`OpenReport`
|
|
400
|
+
* bare-identifier fallback: a guessed target on a verb nobody in the corpus
|
|
401
|
+
* uses would be noise nobody can act on.
|
|
402
|
+
*/
|
|
403
|
+
function resolveDoCmdObjectArgument(ctx, rawArg) {
|
|
404
|
+
const arg = rawArg.trim();
|
|
405
|
+
if (!arg)
|
|
406
|
+
return null;
|
|
407
|
+
if (arg.startsWith('"'))
|
|
408
|
+
return (0, text_utils_1.unwrapVbaStringLiteral)(arg) || null;
|
|
409
|
+
if (!/^\p{L}[\p{L}\p{N}_]*$/u.test(arg))
|
|
410
|
+
return null;
|
|
411
|
+
return ctx.resolveLocalConst(arg) ?? null;
|
|
412
|
+
}
|
|
413
|
+
/**
|
|
414
|
+
* Issue #254: scan one line of VBA source for every `DoCmd` verb in
|
|
415
|
+
* `DOCMD_OBJECT_DISPATCH`. Each match whose object argument resolves to a
|
|
416
|
+
* static name emits ONE `UnresolvedReference` — no node, ever.
|
|
417
|
+
*
|
|
418
|
+
* `maskedLine` has string CONTENT blanked out, so the `docmd` prefix check
|
|
419
|
+
* rejects a verb name that only appears inside a string literal. The object
|
|
420
|
+
* name itself lives inside a literal, which is why the split runs on the
|
|
421
|
+
* original `line`.
|
|
422
|
+
*/
|
|
423
|
+
function scanDoCmdObjectCalls(ctx, line, maskedLine, caller, lineNum) {
|
|
424
|
+
for (let d = 0; d < DOCMD_OBJECT_DISPATCH.length; d++) {
|
|
425
|
+
const dispatch = DOCMD_OBJECT_DISPATCH[d];
|
|
426
|
+
// The shared regexes carry /g, so clone before use to keep `lastIndex`
|
|
427
|
+
// from leaking across lines and across dispatch rows.
|
|
428
|
+
const head = DOCMD_OBJECT_HEAD_RES[d];
|
|
429
|
+
const localRe = new RegExp(head.source, head.flags);
|
|
430
|
+
let m;
|
|
431
|
+
while ((m = localRe.exec(line)) !== null) {
|
|
432
|
+
if (maskedLine.slice(m.index, m.index + 5).toLowerCase() !== 'docmd')
|
|
433
|
+
continue;
|
|
434
|
+
const args = splitDoCmdArguments(line.slice(m.index + m[0].length));
|
|
435
|
+
const targetName = resolveDoCmdObjectArgument(ctx, args[dispatch.argIndex] ?? '');
|
|
436
|
+
if (!targetName)
|
|
437
|
+
continue;
|
|
438
|
+
ctx.unresolvedReferences.push({
|
|
439
|
+
fromNodeId: ctx.findOrCreateFunctionNodeId(caller),
|
|
440
|
+
referenceName: targetName,
|
|
441
|
+
// `references` is an EdgeKind literal, so if the named artifact ever
|
|
442
|
+
// IS indexed the reference becomes a plain `references` edge with no
|
|
443
|
+
// extractor change.
|
|
444
|
+
referenceKind: 'references',
|
|
445
|
+
line: lineNum,
|
|
446
|
+
column: m.index,
|
|
447
|
+
filePath: ctx.filePath,
|
|
448
|
+
language: 'vba',
|
|
449
|
+
metadata: {
|
|
450
|
+
synthesizedBy: dispatch.synthesizedBy,
|
|
451
|
+
docmdVerb: dispatch.method,
|
|
452
|
+
targetName,
|
|
453
|
+
},
|
|
454
|
+
});
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
}
|
|
179
458
|
//# sourceMappingURL=docmd.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docmd.js","sourceRoot":"","sources":["../../../src/extraction/vba/docmd.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"docmd.js","sourceRoot":"","sources":["../../../src/extraction/vba/docmd.ts"],"names":[],"mappings":";;AA+HA,gDA2BC;AA4FD,gDA6BC;AAiBD,kDAsCC;AA0LD,oDAyCC;AA7iBD;;;;;;;;;;;;;;;;;;GAkBG;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;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,YAAY,GAChB,2GAA2G,CAAC;AAe9G;;;;;;;;GAQG;AACH,MAAM,mBAAmB,GAAqC;IA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+1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { VbaClassifier } from './context';
|
|
2
2
|
import { VbaExtractionRule } from './rules';
|
|
3
3
|
/**
|
|
4
4
|
* Issue #153: the declarative rule table for the enum / const concern.
|
|
@@ -26,8 +26,9 @@ import { VbaExtractionRule } from './rules';
|
|
|
26
26
|
* + `contains` edge ONLY when not inside a proc
|
|
27
27
|
* (proc-local Consts are not module symbols).
|
|
28
28
|
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
29
|
+
* This classifier exclusively owns the inter-line `ctx.procStack` /
|
|
30
|
+
* `ctx.currentProcKey` state. The calls/SQL classifier keeps its own
|
|
31
|
+
* `ProcInfo` stack and only reads the shared current-scope key. The
|
|
31
32
|
* `ctx.vbaEnumBlock` state is local to this concern and lives on
|
|
32
33
|
* `ctx` for the same RULES-table-friendliness reason as
|
|
33
34
|
* `vbaDeclTypeBlock`.
|
|
@@ -42,17 +43,9 @@ export declare const RULES: readonly VbaExtractionRule<unknown>[];
|
|
|
42
43
|
* `ctx.vbaEnumBlock` — lives on `ctx` so the RULES table's `emit`
|
|
43
44
|
* functions can read/write it without taking a closure reference.
|
|
44
45
|
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
* never leaks across sweeps. The walk below updates both every
|
|
49
|
-
* iteration; `sweepCallsAndSql` resets again at its own start, so
|
|
50
|
-
* the protocol stays consistent across both classifiers.
|
|
46
|
+
* A fresh `VbaExtractorContext` owns fresh stack state; classifiers never
|
|
47
|
+
* lazily reset it. This makes the result independent of whether a procedure
|
|
48
|
+
* begins on the first or a later physical line.
|
|
51
49
|
*/
|
|
52
50
|
export declare function createEnumsConstsClassifier(): VbaClassifier;
|
|
53
|
-
/**
|
|
54
|
-
* Backward-compat wrapper (see procedures.ts). Returns the classifier's
|
|
55
|
-
* `count` so the orchestrator can decide `hasAnySymbols`.
|
|
56
|
-
*/
|
|
57
|
-
export declare function sweepEnumsAndConsts(ctx: VbaExtractorContext, src: string): number;
|
|
58
51
|
//# sourceMappingURL=enums-consts.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enums-consts.d.ts","sourceRoot":"","sources":["../../../src/extraction/vba/enums-consts.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"enums-consts.d.ts","sourceRoot":"","sources":["../../../src/extraction/vba/enums-consts.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAwB,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAqBlE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,eAAO,MAAM,KAAK,EAAE,SAAS,iBAAiB,CAAC,OAAO,CAAC,EAoKtD,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,wBAAgB,2BAA2B,IAAI,aAAa,CAa3D"}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.RULES = void 0;
|
|
4
4
|
exports.createEnumsConstsClassifier = createEnumsConstsClassifier;
|
|
5
|
-
exports.sweepEnumsAndConsts = sweepEnumsAndConsts;
|
|
6
5
|
/**
|
|
7
6
|
* Enum / Const sweep (REQ-CODE-12, REQ-CODE-13). Emits `enum` + `enum_member`
|
|
8
7
|
* nodes and module-level `constant` nodes, while tracking proc scope so
|
|
@@ -52,8 +51,9 @@ const CONST_DECL_RE = /^\s*(?:(Public|Private|Friend|Global)\s+)?Const\s+(.+)$/i
|
|
|
52
51
|
* + `contains` edge ONLY when not inside a proc
|
|
53
52
|
* (proc-local Consts are not module symbols).
|
|
54
53
|
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
54
|
+
* This classifier exclusively owns the inter-line `ctx.procStack` /
|
|
55
|
+
* `ctx.currentProcKey` state. The calls/SQL classifier keeps its own
|
|
56
|
+
* `ProcInfo` stack and only reads the shared current-scope key. The
|
|
57
57
|
* `ctx.vbaEnumBlock` state is local to this concern and lives on
|
|
58
58
|
* `ctx` for the same RULES-table-friendliness reason as
|
|
59
59
|
* `vbaDeclTypeBlock`.
|
|
@@ -120,6 +120,7 @@ exports.RULES = [
|
|
|
120
120
|
description: 'Match `End Enum` while inside an enum block; emit nothing and clear `ctx.vbaEnumBlock` so subsequent lines route back to the outside-enum-block rules.',
|
|
121
121
|
pattern: ENUM_END_RE,
|
|
122
122
|
requires: 'inside-enum-block',
|
|
123
|
+
terminal: true,
|
|
123
124
|
emit: (_m, ctx) => {
|
|
124
125
|
ctx.vbaEnumBlock = null;
|
|
125
126
|
return { kind: 'end-enum-block' };
|
|
@@ -220,57 +221,22 @@ exports.RULES = [
|
|
|
220
221
|
* `ctx.vbaEnumBlock` — lives on `ctx` so the RULES table's `emit`
|
|
221
222
|
* functions can read/write it without taking a closure reference.
|
|
222
223
|
*
|
|
223
|
-
*
|
|
224
|
-
*
|
|
225
|
-
*
|
|
226
|
-
* never leaks across sweeps. The walk below updates both every
|
|
227
|
-
* iteration; `sweepCallsAndSql` resets again at its own start, so
|
|
228
|
-
* the protocol stays consistent across both classifiers.
|
|
224
|
+
* A fresh `VbaExtractorContext` owns fresh stack state; classifiers never
|
|
225
|
+
* lazily reset it. This makes the result independent of whether a procedure
|
|
226
|
+
* begins on the first or a later physical line.
|
|
229
227
|
*/
|
|
230
228
|
function createEnumsConstsClassifier() {
|
|
231
|
-
let initialized = false;
|
|
232
229
|
const cls = {
|
|
233
230
|
name: 'enumsConsts',
|
|
234
231
|
count: 0,
|
|
235
232
|
classifyLine(line, i, ctx) {
|
|
236
|
-
if (!initialized) {
|
|
237
|
-
ctx.procStack.length = 0;
|
|
238
|
-
ctx.currentProcKey = 'module';
|
|
239
|
-
initialized = true;
|
|
240
|
-
}
|
|
241
233
|
const lineNum = i + 1;
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
continue;
|
|
247
|
-
const m = (0, rules_1.matchRule)(rule.pattern, line);
|
|
248
|
-
if (!m)
|
|
249
|
-
continue;
|
|
250
|
-
const result = rule.emit(m, ctx, line, lineNum);
|
|
251
|
-
if (result !== null && result !== undefined) {
|
|
252
|
-
this.count += rule.count ? rule.count(result) : 1;
|
|
253
|
-
}
|
|
254
|
-
// `enum-end` cleared the enum block — nothing else on this
|
|
255
|
-
// line can apply. The legacy cascade did the same short-circuit
|
|
256
|
-
// via `return`.
|
|
257
|
-
if (rule.id === 'enum-end')
|
|
258
|
-
break;
|
|
259
|
-
}
|
|
234
|
+
this.count += (0, rules_1.runRules)(exports.RULES, ctx, line, line, lineNum, {
|
|
235
|
+
'inside-enum-block': ctx.vbaEnumBlock !== null,
|
|
236
|
+
'outside-enum-block': ctx.vbaEnumBlock === null,
|
|
237
|
+
});
|
|
260
238
|
},
|
|
261
239
|
};
|
|
262
240
|
return cls;
|
|
263
241
|
}
|
|
264
|
-
/**
|
|
265
|
-
* Backward-compat wrapper (see procedures.ts). Returns the classifier's
|
|
266
|
-
* `count` so the orchestrator can decide `hasAnySymbols`.
|
|
267
|
-
*/
|
|
268
|
-
function sweepEnumsAndConsts(ctx, src) {
|
|
269
|
-
const cls = createEnumsConstsClassifier();
|
|
270
|
-
const lines = src.split('\n');
|
|
271
|
-
for (let i = 0; i < lines.length; i++) {
|
|
272
|
-
cls.classifyLine(lines[i] ?? '', i, ctx);
|
|
273
|
-
}
|
|
274
|
-
return cls.count;
|
|
275
|
-
}
|
|
276
242
|
//# sourceMappingURL=enums-consts.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enums-consts.js","sourceRoot":"","sources":["../../../src/extraction/vba/enums-consts.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"enums-consts.js","sourceRoot":"","sources":["../../../src/extraction/vba/enums-consts.ts"],"names":[],"mappings":";;;AAmPA,kEAaC;AAhQD;;;;;GAKG;AACH,gEAAwD;AACxD,2CAAwD;AACxD,6CAAsE;AAEtE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G,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The channel names used when `codegraph.json` → `vba.errorChannel` is absent.
|
|
3
|
+
*
|
|
4
|
+
* `m_Error` / `p_Error` are the private module-variable spellings, `g_Error`
|
|
5
|
+
* the global one, and `Error` the public field a caller reads off the object
|
|
6
|
+
* (`m_ObjRiesgoActivo.Error`). Identical to the probe's
|
|
7
|
+
* `DEFAULT_ERROR_CHANNEL_NAMES` — `scripts/vba-coverage-probe.mjs` measured
|
|
8
|
+
* the census this task is accepted against, so the two lists must agree.
|
|
9
|
+
*/
|
|
10
|
+
export declare const DEFAULT_ERROR_CHANNEL_NAMES: readonly string[];
|
|
11
|
+
/** A channel entry is a bare VBA identifier — nothing qualified, no regex. */
|
|
12
|
+
export declare const ERROR_CHANNEL_ENTRY_RE: RegExp;
|
|
13
|
+
/**
|
|
14
|
+
* The per-extractor compiled channel. Built ONCE per `VbaExtractor` and parked
|
|
15
|
+
* on `VbaExtractorContext`, for the same reason `CompiledSqlWrappers` is: the
|
|
16
|
+
* name lookup runs per identifier per line, and the write matcher per statement
|
|
17
|
+
* per line, so neither may be rebuilt inside the line loop.
|
|
18
|
+
*
|
|
19
|
+
* NOT structured-cloneable (it holds a `Set` and `RegExp`s) — which is exactly
|
|
20
|
+
* why `VbaExtractionOptions.errorChannel` carries plain strings across the
|
|
21
|
+
* worker boundary and the compilation happens on the far side.
|
|
22
|
+
*/
|
|
23
|
+
export interface CompiledErrorChannel {
|
|
24
|
+
/** The channel names, defaults first, project entries appended. Display form. */
|
|
25
|
+
readonly names: readonly string[];
|
|
26
|
+
/** Lowercased `names`, for the per-identifier membership test. VBA is case-insensitive. */
|
|
27
|
+
readonly lookup: ReadonlySet<string>;
|
|
28
|
+
/**
|
|
29
|
+
* One anchored regex per name: the channel in the assignment-TARGET position
|
|
30
|
+
* of a statement — bare (`p_Error = …`), `Me.`-qualified (`Me.Error = …`) or
|
|
31
|
+
* object-qualified (`obj.Error = …`).
|
|
32
|
+
*
|
|
33
|
+
* Anchoring at the start of the statement is the whole precision of this
|
|
34
|
+
* matcher: it is what separates a WRITE from a READ, so the house guard
|
|
35
|
+
* `If m_Error <> "" Then` and the copy `x = m_Error` both correctly miss.
|
|
36
|
+
* Kept identical to the probe's `buildChannelWriteMatcher`.
|
|
37
|
+
*/
|
|
38
|
+
readonly writeRes: readonly RegExp[];
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Compile the channel from the plain-string config entries.
|
|
42
|
+
*
|
|
43
|
+
* `configured` entries are APPENDED to {@link DEFAULT_ERROR_CHANNEL_NAMES},
|
|
44
|
+
* never substituted for them — same contract as `vba.sqlWrappers`: a project
|
|
45
|
+
* that names its own `lastFailure` field must not lose `m_Error` in the trade,
|
|
46
|
+
* because in a codebase this size the two conventions coexist. Blank, dotted
|
|
47
|
+
* and otherwise non-identifier entries are dropped here; `project-config.ts`
|
|
48
|
+
* has already warned about them at load time.
|
|
49
|
+
*/
|
|
50
|
+
export declare function compileErrorChannel(configured?: readonly string[]): CompiledErrorChannel;
|
|
51
|
+
export declare function defaultErrorChannel(): CompiledErrorChannel;
|
|
52
|
+
/**
|
|
53
|
+
* Is `name` the error channel? A WHOLE-name, case-insensitive test — the
|
|
54
|
+
* single reason `ErrorCount` does not match `Error`, pinned by a test.
|
|
55
|
+
*/
|
|
56
|
+
export declare function isErrorChannelName(channel: CompiledErrorChannel, name: string): boolean;
|
|
57
|
+
//# sourceMappingURL=error-channel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-channel.d.ts","sourceRoot":"","sources":["../../../src/extraction/vba/error-channel.ts"],"names":[],"mappings":"AA2DA;;;;;;;;GAQG;AACH,eAAO,MAAM,2BAA2B,EAAE,SAAS,MAAM,EAKxD,CAAC;AAEF,8EAA8E;AAC9E,eAAO,MAAM,sBAAsB,QAA2B,CAAC;AAE/D;;;;;;;;;GASG;AACH,MAAM,WAAW,oBAAoB;IACnC,iFAAiF;IACjF,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,2FAA2F;IAC3F,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACrC;;;;;;;;;OASG;IACH,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;CACtC;AAED;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CACjC,UAAU,CAAC,EAAE,SAAS,MAAM,EAAE,GAC7B,oBAAoB,CAmBtB;AAUD,wBAAgB,mBAAmB,IAAI,oBAAoB,CAG1D;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,oBAAoB,EAC7B,IAAI,EAAE,MAAM,GACX,OAAO,CAET"}
|