@aroman22/codegraph-vba-darwin-arm64 1.14.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 +4 -1
- package/package.json +1 -1
|
@@ -35,18 +35,28 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.RULES = void 0;
|
|
37
37
|
exports.createProceduresClassifier = createProceduresClassifier;
|
|
38
|
-
exports.sweepProcedures = sweepProcedures;
|
|
39
38
|
/**
|
|
40
39
|
* Procedure sweep: emit one `function` node per `Sub` / `Function` /
|
|
41
40
|
* `Property Get|Let|Set` declaration, record each proc in `localProcs` for
|
|
42
41
|
* same-file call resolution, and synthesize the Access `<Control>_<Event>`
|
|
43
|
-
* event-handler edge for form/report code-behind classes (hueco 3 / issue #41)
|
|
42
|
+
* event-handler edge for form/report code-behind classes (hueco 3 / issue #41),
|
|
43
|
+
* plus the form-level `Form_<Event>` / `Report_<Event>` lifecycle edge to the
|
|
44
|
+
* sibling layout node (issue #247).
|
|
44
45
|
*/
|
|
45
46
|
const path = __importStar(require("path"));
|
|
46
47
|
const tree_sitter_helpers_1 = require("../tree-sitter-helpers");
|
|
47
48
|
const constants_1 = require("./constants");
|
|
48
49
|
const text_utils_1 = require("./text-utils");
|
|
49
50
|
const rules_1 = require("./rules");
|
|
51
|
+
const signature_1 = require("./signature");
|
|
52
|
+
const parameters_1 = require("./parameters");
|
|
53
|
+
/**
|
|
54
|
+
* `Static` is a storage specifier, not visibility, and VBA allows it either on
|
|
55
|
+
* its own (`Static Sub X`) or after the visibility keyword (`Public Static
|
|
56
|
+
* Function Y`). `PROC_RE` folds both spellings away, so we re-test the
|
|
57
|
+
* declaration head to keep the fact.
|
|
58
|
+
*/
|
|
59
|
+
const STATIC_PROC_RE = /^\s*(?:(?:Public|Private|Friend)\s+)?Static\s+(?:Sub|Function|Property)\b/i;
|
|
50
60
|
/**
|
|
51
61
|
* Parse a `Function`/`Property Get` declaration's return type — the `As
|
|
52
62
|
* <Type>` that follows the parameter list (or the name, for a paren-less
|
|
@@ -72,21 +82,7 @@ function parseArrayParameters(line) {
|
|
|
72
82
|
if (closeIdx < openIdx)
|
|
73
83
|
return [];
|
|
74
84
|
const body = line.slice(openIdx + 1, closeIdx);
|
|
75
|
-
const params =
|
|
76
|
-
let depth = 0;
|
|
77
|
-
let start = 0;
|
|
78
|
-
for (let i = 0; i < body.length; i++) {
|
|
79
|
-
const ch = body[i];
|
|
80
|
-
if (ch === '(')
|
|
81
|
-
depth++;
|
|
82
|
-
else if (ch === ')')
|
|
83
|
-
depth--;
|
|
84
|
-
else if (ch === ',' && depth === 0) {
|
|
85
|
-
params.push(body.slice(start, i));
|
|
86
|
-
start = i + 1;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
params.push(body.slice(start));
|
|
85
|
+
const params = (0, signature_1.splitParameterList)(body);
|
|
90
86
|
const arrayParamRe = /^\s*(?:ByRef|ByVal)\s+(\p{L}[\p{L}\p{N}_]*)\s*\(\s*\)/iu;
|
|
91
87
|
const out = [];
|
|
92
88
|
for (const raw of params) {
|
|
@@ -97,16 +93,6 @@ function parseArrayParameters(line) {
|
|
|
97
93
|
}
|
|
98
94
|
return out;
|
|
99
95
|
}
|
|
100
|
-
function parenthesisDelta(line) {
|
|
101
|
-
let depth = 0;
|
|
102
|
-
for (const ch of line) {
|
|
103
|
-
if (ch === '(')
|
|
104
|
-
depth++;
|
|
105
|
-
else if (ch === ')')
|
|
106
|
-
depth--;
|
|
107
|
-
}
|
|
108
|
-
return depth;
|
|
109
|
-
}
|
|
110
96
|
/**
|
|
111
97
|
* Issue #153: the declarative rule table for the procedures concern.
|
|
112
98
|
* One rule — `procedure` — matches a `Sub` / `Function` /
|
|
@@ -125,7 +111,7 @@ function parenthesisDelta(line) {
|
|
|
125
111
|
exports.RULES = [
|
|
126
112
|
(0, rules_1.defineRule)({
|
|
127
113
|
id: 'procedure',
|
|
128
|
-
description: 'Match a `Sub` / `Function` / `Property Get|Let|Set <Name>(...) [As <Type>]` declaration; emit a function node, register the proc in `localProcs` / `functionNodeByName` / `functionNodeByStartLine` / `functionReturnTypes`, and (for `Form_
|
|
114
|
+
description: 'Match a `Sub` / `Function` / `Property Get|Let|Set <Name>(...) [As <Type>]` declaration; emit a function node, register the proc in `localProcs` / `functionNodeByName` / `functionNodeByStartLine` / `functionReturnTypes`, and (for code-behind whose filename or `VB_Name` carries the `Form_` / `Report_` prefix) synthesize an `event-handler` edge — to a `form-instance-control` stub for a control handler, or to the sibling `form-layout` / `report-layout` stub for a form-level lifecycle handler.',
|
|
129
115
|
pattern: constants_1.PROC_RE,
|
|
130
116
|
emit: (m, ctx, line, lineNum) => {
|
|
131
117
|
const visibilityRaw = (m[1] ?? '').trim();
|
|
@@ -156,20 +142,33 @@ exports.RULES = [
|
|
|
156
142
|
: kindRaw.startsWith('function')
|
|
157
143
|
? 'function'
|
|
158
144
|
: 'property';
|
|
145
|
+
// Issue #250: `Property Get` / `Let` / `Set` all fold into
|
|
146
|
+
// `kind: 'property'`, so the accessor keyword is the only thing that
|
|
147
|
+
// tells a getter from its setter. `PROC_RE`'s kind capture keeps it.
|
|
148
|
+
const accessor = (/^property\s+(get|let|set)$/i.exec(kindRaw)?.[1] ??
|
|
149
|
+
undefined);
|
|
150
|
+
// A `Sub` and a `Property Let`/`Set` have no return type; a `Function`
|
|
151
|
+
// and a `Property Get` do. Parsed once and reused by both the factory
|
|
152
|
+
// inference below and the node metadata.
|
|
153
|
+
const returnType = kind === 'function' || accessor === 'get' ? parseReturnType(line) : null;
|
|
159
154
|
// Factory-return inference: record a function's project-class return type
|
|
160
155
|
// so the call sweep can type `Set x = <name>(...)`. Restricted to `Sub`'s
|
|
161
156
|
// sibling `Function` (a `Property Let/Set` has no return type and a
|
|
162
157
|
// `Property Get`'s `As <Type>` is rarely a factory target). Primitives are
|
|
163
158
|
// skipped — `x.Method` on a primitive is never a project call.
|
|
164
159
|
if (kind === 'function') {
|
|
165
|
-
|
|
166
|
-
if (retType && !constants_1.PRIMITIVE_TYPES.has(retType.toLowerCase())) {
|
|
160
|
+
if (returnType && !constants_1.PRIMITIVE_TYPES.has(returnType.toLowerCase())) {
|
|
167
161
|
const key = name.toLowerCase();
|
|
168
162
|
if (!ctx.functionReturnTypes.has(key)) {
|
|
169
|
-
ctx.functionReturnTypes.set(key,
|
|
163
|
+
ctx.functionReturnTypes.set(key, returnType);
|
|
170
164
|
}
|
|
171
165
|
}
|
|
172
166
|
}
|
|
167
|
+
// Issue #250: the declared signature. `line` is the preprocessed logical
|
|
168
|
+
// line, so a header split with `_` continuations is already joined — do
|
|
169
|
+
// not re-join it here. The parameter list is located from the end of the
|
|
170
|
+
// NAME so a colon-separated single-line proc cannot leak its body in.
|
|
171
|
+
const signature = (0, signature_1.parseSignature)(line, (m.index ?? 0) + m[0].length);
|
|
173
172
|
const proc = {
|
|
174
173
|
name,
|
|
175
174
|
// B3 (hueco 5): when this file is a `.cls`, prefix the
|
|
@@ -211,9 +210,27 @@ exports.RULES = [
|
|
|
211
210
|
startColumn: 0,
|
|
212
211
|
endColumn: line.length,
|
|
213
212
|
visibility,
|
|
213
|
+
// Issue #250: the procedure's real shape. `visibility` folds `Friend`
|
|
214
|
+
// and `Static` into `public` (the Node enum has no room for either),
|
|
215
|
+
// so both facts are kept here rather than lost. `accessor` and
|
|
216
|
+
// `returnType` are omitted when they do not apply, so their absence
|
|
217
|
+
// is meaningful. `arity.total` is `null`, never `Infinity`, for a
|
|
218
|
+
// `ParamArray` — this metadata is JSON-serialised across the
|
|
219
|
+
// parse-worker boundary.
|
|
220
|
+
metadata: {
|
|
221
|
+
procKind: kind,
|
|
222
|
+
...(accessor ? { accessor } : {}),
|
|
223
|
+
isStatic: STATIC_PROC_RE.test(line),
|
|
224
|
+
isFriend: visibilityRaw.toLowerCase() === 'friend',
|
|
225
|
+
...(returnType ? { returnType } : {}),
|
|
226
|
+
params: signature.params,
|
|
227
|
+
arity: signature.arity,
|
|
228
|
+
},
|
|
214
229
|
updatedAt: Date.now(),
|
|
215
230
|
};
|
|
216
231
|
ctx.nodes.push(fnNode);
|
|
232
|
+
// Issue #257: the same parsed signature becomes `parameter` nodes.
|
|
233
|
+
(0, parameters_1.emitParameterNodes)(ctx, fnNode, signature.params, lineNum, line);
|
|
217
234
|
// Cache the first node emitted for this name — `findFunctionNodeByName`
|
|
218
235
|
// (audit S2) becomes O(1) instead of O(n) per call site.
|
|
219
236
|
if (!ctx.functionNodeByName.has(name)) {
|
|
@@ -228,8 +245,11 @@ exports.RULES = [
|
|
|
228
245
|
// LAST underscore so multi-word events like `BeforeDelConfirm` parse
|
|
229
246
|
// correctly. Form-level events (`Form_Load`, `Form_Open`,
|
|
230
247
|
// `Form_Unload`, …) are NOT control handlers — they fire on the
|
|
231
|
-
// form object itself, not on a control — so they
|
|
232
|
-
//
|
|
248
|
+
// form object itself, not on a control — so they do NOT take this
|
|
249
|
+
// path. Issue #247 gives them their own branch below, targeting
|
|
250
|
+
// the sibling form-layout / report-layout node; routing them
|
|
251
|
+
// through the control path would synthesize a bogus
|
|
252
|
+
// `form-instance-control` node literally named `Form`.
|
|
233
253
|
//
|
|
234
254
|
// Scope guard: only emit when this .cls looks like a form code-
|
|
235
255
|
// behind (`Form_*.cls`). Without this guard, regular service classes
|
|
@@ -260,53 +280,136 @@ exports.RULES = [
|
|
|
260
280
|
// See vba-form-extractor.ts:findControlName for the matching real
|
|
261
281
|
// form-instance-control node emission.
|
|
262
282
|
const handler = (0, text_utils_1.parseEventHandlerName)(name);
|
|
283
|
+
// Issue #247: the form's or report's OWN lifecycle events
|
|
284
|
+
// (`Form_Load`, `Form_Open`, `Form_Current`, `Report_Open`, …).
|
|
285
|
+
// `parseEventHandlerName` refuses these by design — see its doc
|
|
286
|
+
// comment and the block above. They are not control handlers, so
|
|
287
|
+
// they get their own target: the sibling layout node.
|
|
288
|
+
const formLevelHandler = (0, text_utils_1.parseFormLevelEventHandlerName)(name);
|
|
263
289
|
// Prefix-driven sibling binding (issue #41). Both `Form_*.cls` and
|
|
264
290
|
// `Report_*.cls` Dysflow code-behind files share the same code path;
|
|
265
291
|
// only the sibling extension differs (`.form.txt` vs `.report.txt`).
|
|
266
|
-
// The
|
|
267
|
-
// `
|
|
268
|
-
//
|
|
269
|
-
//
|
|
270
|
-
//
|
|
271
|
-
//
|
|
272
|
-
//
|
|
292
|
+
// The prefix test rejects a class called `FormularioVentas.cls` or
|
|
293
|
+
// `ReportingHelper.cls` (no trailing underscore) — the trailing `_` is
|
|
294
|
+
// the discriminator. A class that matches on NEITHER its filename nor
|
|
295
|
+
// its VB_Name (e.g. `InformeRiesgoPDFServicio.cls` with methods like
|
|
296
|
+
// `GenerarHTML_Principal`) gets `codeBehindExt === null` and is skipped,
|
|
297
|
+
// preserving the original Form_-only guard's behaviour for non-form
|
|
298
|
+
// classes.
|
|
273
299
|
const basename = path.basename(ctx.filePath).toLowerCase();
|
|
274
|
-
const
|
|
300
|
+
const basenameExt = basename.startsWith('report_')
|
|
275
301
|
? '.report.txt'
|
|
276
302
|
: basename.startsWith('form_')
|
|
277
303
|
? '.form.txt'
|
|
278
304
|
: null;
|
|
305
|
+
// Issue #249: the basename above stays the fast path, but it is not the
|
|
306
|
+
// module's identity — `Attribute VB_Name` is. When a code-behind class
|
|
307
|
+
// is exported (or hand-renamed) to a filename that drops the prefix, the
|
|
308
|
+
// file still parses and still emits its procedures, so the form used to
|
|
309
|
+
// come out with no event wiring at all and nothing to show for it. Fall
|
|
310
|
+
// back to the resolved VB_Name (`ctx.classNamePrefix`) so the decision to
|
|
311
|
+
// bind follows the module, not the filename.
|
|
312
|
+
const codeBehindExt = basenameExt ?? (0, text_utils_1.codeBehindExtFromVbName)(ctx.classNamePrefix);
|
|
313
|
+
// Non-null only when the two disagree, so the fast path's edge metadata
|
|
314
|
+
// is unchanged and a mismatch is diagnosable instead of invisible.
|
|
315
|
+
const bindingSource = basenameExt === null && codeBehindExt !== null ? 'vb-name' : null;
|
|
279
316
|
const isFormCodeBehind = codeBehindExt !== null;
|
|
280
|
-
if (
|
|
317
|
+
if (isFormCodeBehind) {
|
|
318
|
+
// The sibling path is still derived from the FILE path — that is where
|
|
319
|
+
// the `.form.txt` / `.report.txt` actually lives on disk, whatever the
|
|
320
|
+
// module calls itself. Only the decision to bind falls back to VB_Name.
|
|
281
321
|
const siblingPath = ctx.filePath.replace(/\.cls$/i, codeBehindExt);
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
322
|
+
if (formLevelHandler) {
|
|
323
|
+
// ---- Form-LEVEL event (issue #247). --------------------------
|
|
324
|
+
// The target is the sibling's layout node, not a control. Same
|
|
325
|
+
// cross-file stub mechanic as the control branch below: emit a
|
|
326
|
+
// local stub carrying the deterministic id VbaFormExtractor
|
|
327
|
+
// will produce for the same file, so the per-file edge filter
|
|
328
|
+
// (`insertedIds.has(source) && insertedIds.has(target)`) accepts
|
|
329
|
+
// the edge, and `INSERT OR REPLACE` converges on the real node
|
|
330
|
+
// whichever file is indexed first.
|
|
331
|
+
//
|
|
332
|
+
// The id formula must stay byte-identical to
|
|
333
|
+
// `VbaFormExtractor.createFormLayoutNode`:
|
|
334
|
+
// `generateNodeId(siblingPath, layoutKind, name, 1)` where
|
|
335
|
+
// `name` is the sibling's `Attribute VB_Name` when present and
|
|
336
|
+
// its extension-stripped basename otherwise. A SaveAsText
|
|
337
|
+
// `.form.txt` / `.report.txt` has no top-level `VB_Name` (the
|
|
338
|
+
// only one it carries lives inside the embedded
|
|
339
|
+
// `CodeBehindForm` block, past the point `detectVbName` stops
|
|
340
|
+
// scanning), so the basename branch is the one that fires — and
|
|
341
|
+
// the sibling shares this `.cls`'s basename by construction.
|
|
342
|
+
const layoutKind = codeBehindExt === '.report.txt' ? 'report-layout' : 'form-layout';
|
|
343
|
+
const layoutName = path.basename(ctx.filePath).replace(/\.cls$/i, '');
|
|
344
|
+
const layoutNodeId = (0, tree_sitter_helpers_1.generateNodeId)(siblingPath, layoutKind, layoutName, 1);
|
|
345
|
+
ctx.nodes.push({
|
|
346
|
+
id: layoutNodeId,
|
|
347
|
+
kind: layoutKind,
|
|
348
|
+
name: layoutName,
|
|
349
|
+
qualifiedName: layoutName,
|
|
350
|
+
filePath: siblingPath,
|
|
351
|
+
language: 'vba',
|
|
352
|
+
startLine: 1,
|
|
353
|
+
endLine: 1,
|
|
354
|
+
startColumn: 0,
|
|
355
|
+
endColumn: 0,
|
|
356
|
+
// Mirrors the real node's back-compat marker so a stub that
|
|
357
|
+
// survives (sibling never indexed) still looks like a layout
|
|
358
|
+
// node to consumers keyed on `containerKind`.
|
|
359
|
+
metadata: { containerKind: 'module' },
|
|
360
|
+
updatedAt: Date.now(),
|
|
361
|
+
});
|
|
362
|
+
ctx.edges.push({
|
|
363
|
+
source: nodeId,
|
|
364
|
+
target: layoutNodeId,
|
|
365
|
+
kind: 'event-handler',
|
|
366
|
+
provenance: 'heuristic',
|
|
367
|
+
// `scope: 'form'` lets consumers separate form-level from
|
|
368
|
+
// control-level handlers without re-parsing the Sub name.
|
|
369
|
+
// `bindingSource` appears only when the filename and the module's
|
|
370
|
+
// VB_Name disagree (issue #249).
|
|
371
|
+
metadata: {
|
|
372
|
+
eventName: formLevelHandler.eventName,
|
|
373
|
+
scope: 'form',
|
|
374
|
+
...(bindingSource ? { bindingSource } : {}),
|
|
375
|
+
},
|
|
376
|
+
line: lineNum,
|
|
377
|
+
column: 0,
|
|
378
|
+
});
|
|
379
|
+
}
|
|
380
|
+
else if (handler) {
|
|
381
|
+
const controlNodeId = (0, tree_sitter_helpers_1.generateNodeId)(siblingPath, 'form-instance-control', handler.controlName, 0);
|
|
382
|
+
// Stub form-instance-control: local so the per-file edge filter
|
|
383
|
+
// passes the event-handler edge. Overwritten by the real node
|
|
384
|
+
// emitted from the sibling .form.txt (or .report.txt) at index time
|
|
385
|
+
// (same id, same schema, INSERT OR REPLACE). No metadata.controlType
|
|
386
|
+
// here — the sibling side carries the real control type.
|
|
387
|
+
ctx.nodes.push({
|
|
388
|
+
id: controlNodeId,
|
|
389
|
+
kind: 'form-instance-control',
|
|
390
|
+
name: handler.controlName,
|
|
391
|
+
qualifiedName: `${siblingPath}::${handler.controlName}`,
|
|
392
|
+
filePath: siblingPath,
|
|
393
|
+
language: 'vba',
|
|
394
|
+
startLine: 0,
|
|
395
|
+
endLine: 0,
|
|
396
|
+
startColumn: 0,
|
|
397
|
+
endColumn: 0,
|
|
398
|
+
updatedAt: Date.now(),
|
|
399
|
+
});
|
|
400
|
+
ctx.edges.push({
|
|
401
|
+
source: nodeId,
|
|
402
|
+
target: controlNodeId,
|
|
403
|
+
kind: 'event-handler',
|
|
404
|
+
provenance: 'heuristic',
|
|
405
|
+
metadata: {
|
|
406
|
+
eventName: handler.eventName,
|
|
407
|
+
...(bindingSource ? { bindingSource } : {}),
|
|
408
|
+
},
|
|
409
|
+
line: lineNum,
|
|
410
|
+
column: 0,
|
|
411
|
+
});
|
|
412
|
+
}
|
|
310
413
|
}
|
|
311
414
|
if (ctx.moduleOrClassNode) {
|
|
312
415
|
ctx.edges.push({
|
|
@@ -331,54 +434,13 @@ exports.RULES = [
|
|
|
331
434
|
}),
|
|
332
435
|
];
|
|
333
436
|
function createProceduresClassifier() {
|
|
334
|
-
let pendingHeader;
|
|
335
437
|
return {
|
|
336
438
|
name: 'procedures',
|
|
337
439
|
count: 0,
|
|
338
440
|
classifyLine(line, i, ctx) {
|
|
339
|
-
if (pendingHeader) {
|
|
340
|
-
pendingHeader.text += ` ${line}`;
|
|
341
|
-
pendingHeader.depth += parenthesisDelta(line);
|
|
342
|
-
if (pendingHeader.depth <= 0) {
|
|
343
|
-
pendingHeader.proc.arrayParameters = parseArrayParameters(pendingHeader.text);
|
|
344
|
-
pendingHeader = undefined;
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
441
|
const lineNum = i + 1;
|
|
348
|
-
|
|
349
|
-
const m = (0, rules_1.matchRule)(rule.pattern, line);
|
|
350
|
-
if (!m)
|
|
351
|
-
continue;
|
|
352
|
-
const previousProcCount = ctx.procedures.length;
|
|
353
|
-
const result = rule.emit(m, ctx, line, lineNum);
|
|
354
|
-
if (result !== null && result !== undefined) {
|
|
355
|
-
this.count += rule.count ? rule.count(result) : 1;
|
|
356
|
-
}
|
|
357
|
-
const proc = ctx.procedures[previousProcCount];
|
|
358
|
-
const openIdx = line.indexOf('(');
|
|
359
|
-
if (proc && openIdx >= 0) {
|
|
360
|
-
const depth = parenthesisDelta(line.slice(openIdx));
|
|
361
|
-
if (depth > 0) {
|
|
362
|
-
pendingHeader = { proc, text: line, depth };
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
}
|
|
442
|
+
this.count += (0, rules_1.runRules)(exports.RULES, ctx, line, line, lineNum, {});
|
|
366
443
|
},
|
|
367
444
|
};
|
|
368
445
|
}
|
|
369
|
-
/**
|
|
370
|
-
* Backward-compat wrapper: pre-#83 callers (e.g. legacy test fixtures)
|
|
371
|
-
* used `sweepProcedures(ctx, src)` and got back the ProcInfo[].
|
|
372
|
-
* Now it returns `ctx.procedures` (the same flat list the factory
|
|
373
|
-
* appends to). The implementation still calls the classifier once per
|
|
374
|
-
* pre-split line, so the count is identical to the new walker path.
|
|
375
|
-
*/
|
|
376
|
-
function sweepProcedures(ctx, src) {
|
|
377
|
-
const cls = createProceduresClassifier();
|
|
378
|
-
const lines = src.split('\n');
|
|
379
|
-
for (let i = 0; i < lines.length; i++) {
|
|
380
|
-
cls.classifyLine(lines[i] ?? '', i, ctx);
|
|
381
|
-
}
|
|
382
|
-
return ctx.procedures;
|
|
383
|
-
}
|
|
384
446
|
//# sourceMappingURL=procedures.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"procedures.js","sourceRoot":"","sources":["../../../src/extraction/vba/procedures.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"procedures.js","sourceRoot":"","sources":["../../../src/extraction/vba/procedures.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4aA,gEASC;AArbD;;;;;;;GAOG;AACH,2CAA6B;AAE7B,gEAAwD;AACxD,2CAAuD;AACvD,6CAKsB;AAEtB,mCAAkE;AAClE,2CAAiE;AACjE,6CAAkD;AAElD;;;;;GAKG;AACH,MAAM,cAAc,GAClB,4EAA4E,CAAC;AAE/E;;;;;;;GAOG;AACH,SAAS,eAAe,CAAC,IAAY;IACnC,MAAM,WAAW,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC;QACpC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACvC,CAAC,CAAC,IAAI,CAAC;IACT,MAAM,CAAC,GAAG,4DAA4D,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACzF,IAAI,CAAC,CAAC;QAAE,OAAO,IAAI,CAAC;IACpB,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;AAC9B,CAAC;AAED,SAAS,oBAAoB,CAAC,IAAY;IACxC,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAClC,IAAI,OAAO,GAAG,CAAC;QAAE,OAAO,EAAE,CAAC;IAC3B,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IACvC,IAAI,QAAQ,GAAG,OAAO;QAAE,OAAO,EAAE,CAAC;IAClC,MAAM,IAAI,GAAG,IAAI,CAAC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,CAAC;YACD,OAAO,EAAE,IAAI,EAAE,CAAC;QAClB,CAAC;KACF,CAAC;CACH,CAAC;AAEF,SAAgB,0BAA0B;IACxC,OAAO;QACL,IAAI,EAAE,YAAY;QAClB,KAAK,EAAE,CAAC;QACR,YAAY,CAAC,IAAI,EAAE,CAAC,EAAE,GAAG;YACvB,MAAM,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC;YACtB,IAAI,CAAC,KAAK,IAAI,IAAA,gBAAQ,EAAC,aAAK,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC;QAC9D,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -50,10 +50,8 @@ import type { VbaExtractorContext } from './context';
|
|
|
50
50
|
* or a non-empty `RegExp[]` (a rule is matched when ANY
|
|
51
51
|
* of the alternatives matches). The dispatcher runs
|
|
52
52
|
* `.exec()` for single regexes and iterates for arrays.
|
|
53
|
-
* - `requires?` Optional structural gate
|
|
54
|
-
*
|
|
55
|
-
* `.bas`/`.frm`/`.dsr`; `'inside-procedure'` only when
|
|
56
|
-
* `ctx.procStack.length > 0`. The orchestrator is
|
|
53
|
+
* - `requires?` Optional structural gate from the closed
|
|
54
|
+
* `VbaRuleRequirement` union. The orchestrator is
|
|
57
55
|
* expected to honour this — keeping the gate declarative
|
|
58
56
|
* lets the rule own its own preconditions instead of
|
|
59
57
|
* scattering `if` checks into the rule body.
|
|
@@ -75,6 +73,8 @@ import type { VbaExtractorContext } from './context';
|
|
|
75
73
|
* rules whose emit can fan out (e.g. a multi-variable
|
|
76
74
|
* `Dim a As Foo, b As Bar` line that produces two
|
|
77
75
|
* `references` edges from one match).
|
|
76
|
+
* - `terminal?` Stop dispatch after this rule matches, without coupling
|
|
77
|
+
* dispatcher control flow to a rule id.
|
|
78
78
|
*
|
|
79
79
|
* The `count` parameter is typed as `unknown` to keep the
|
|
80
80
|
* `VbaExtractionRule<T>` shape covariant in `T` — narrowing `T`
|
|
@@ -87,11 +87,14 @@ export interface VbaExtractionRule<T = unknown> {
|
|
|
87
87
|
readonly id: string;
|
|
88
88
|
readonly description: string;
|
|
89
89
|
readonly pattern: RegExp | RegExp[];
|
|
90
|
-
readonly requires?:
|
|
90
|
+
readonly requires?: VbaRuleRequirement;
|
|
91
91
|
readonly scan?: 'masked' | 'unmasked' | 'both';
|
|
92
|
+
readonly terminal?: boolean;
|
|
92
93
|
readonly emit: (match: RegExpMatchArray, ctx: VbaExtractorContext, line: string, lineNum: number) => T | null;
|
|
93
94
|
readonly count?: (result: unknown) => number;
|
|
94
95
|
}
|
|
96
|
+
export type VbaRuleRequirement = 'inside-procedure' | 'inside-type-block' | 'outside-type-block' | 'inside-enum-block' | 'outside-enum-block';
|
|
97
|
+
export type VbaRuleGates = Partial<Record<VbaRuleRequirement, boolean>>;
|
|
95
98
|
/**
|
|
96
99
|
* Helper to build a `VbaExtractionRule<T>` with a single RegExp.
|
|
97
100
|
* Most rules are 1-line declarations; this collapses the boilerplate
|
|
@@ -126,4 +129,6 @@ export declare function matchRuleForScan(rule: VbaExtractionRule, line: string,
|
|
|
126
129
|
match: RegExpMatchArray;
|
|
127
130
|
line: string;
|
|
128
131
|
} | null;
|
|
132
|
+
/** Dispatch a rule table with consistent scan, gate, count, and terminal semantics. */
|
|
133
|
+
export declare function runRules(rules: readonly VbaExtractionRule[], ctx: VbaExtractorContext, line: string, maskedLine: string, lineNum: number, gates: VbaRuleGates): number;
|
|
129
134
|
//# sourceMappingURL=rules.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rules.d.ts","sourceRoot":"","sources":["../../../src/extraction/vba/rules.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAErD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AACH,MA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B,MAAM,MAAM,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,kBAAkB,EAAE,OAAO,CAAC,CAAC,CAAC;AAExE;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,CAAC,GAAG,OAAO,EACpC,IAAI,EAAE,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,GAAG;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,GAChE,iBAAiB,CAAC,CAAC,CAAC,CAEtB;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,GAAG,OAAO,EAChD,IAAI,EAAE,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,GAAG;IAAE,OAAO,EAAE,MAAM,EAAE,CAAA;CAAE,GAClE,iBAAiB,CAAC,CAAC,CAAC,CAOtB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,SAAS,CACvB,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,EAC1B,IAAI,EAAE,MAAM,GACX,gBAAgB,GAAG,IAAI,CASzB;AAED,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,iBAAiB,EACvB,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,MAAM,GACjB;IAAE,KAAK,EAAE,gBAAgB,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAYlD;AAED,uFAAuF;AACvF,wBAAgB,QAAQ,CACtB,KAAK,EAAE,SAAS,iBAAiB,EAAE,EACnC,GAAG,EAAE,mBAAmB,EACxB,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,YAAY,GAClB,MAAM,CAaR"}
|
|
@@ -4,6 +4,7 @@ exports.defineRule = defineRule;
|
|
|
4
4
|
exports.defineRuleAlternatives = defineRuleAlternatives;
|
|
5
5
|
exports.matchRule = matchRule;
|
|
6
6
|
exports.matchRuleForScan = matchRuleForScan;
|
|
7
|
+
exports.runRules = runRules;
|
|
7
8
|
/**
|
|
8
9
|
* Helper to build a `VbaExtractionRule<T>` with a single RegExp.
|
|
9
10
|
* Most rules are 1-line declarations; this collapses the boilerplate
|
|
@@ -60,4 +61,22 @@ function matchRuleForScan(rule, line, maskedLine) {
|
|
|
60
61
|
}
|
|
61
62
|
return null;
|
|
62
63
|
}
|
|
64
|
+
/** Dispatch a rule table with consistent scan, gate, count, and terminal semantics. */
|
|
65
|
+
function runRules(rules, ctx, line, maskedLine, lineNum, gates) {
|
|
66
|
+
let count = 0;
|
|
67
|
+
for (const rule of rules) {
|
|
68
|
+
if (rule.requires && gates[rule.requires] !== true)
|
|
69
|
+
continue;
|
|
70
|
+
const matched = matchRuleForScan(rule, line, maskedLine);
|
|
71
|
+
if (!matched)
|
|
72
|
+
continue;
|
|
73
|
+
const result = rule.emit(matched.match, ctx, matched.line, lineNum);
|
|
74
|
+
if (result !== null && result !== undefined) {
|
|
75
|
+
count += rule.count ? rule.count(result) : 1;
|
|
76
|
+
}
|
|
77
|
+
if (rule.terminal)
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
80
|
+
return count;
|
|
81
|
+
}
|
|
63
82
|
//# sourceMappingURL=rules.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rules.js","sourceRoot":"","sources":["../../../src/extraction/vba/rules.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"rules.js","sourceRoot":"","sources":["../../../src/extraction/vba/rules.ts"],"names":[],"mappings":";;AAoHA,gCAIC;AAQD,wDASC;AAcD,8BAYC;AAED,4CAgBC;AAGD,4BAoBC;AA7FD;;;;GAIG;AACH,SAAgB,UAAU,CACxB,IAAiE;IAEjE,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;GAKG;AACH,SAAgB,sBAAsB,CACpC,IAAmE;IAEnE,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC9B,MAAM,IAA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,CAAC;QACzB,IAAI,IAAI,CAAC,QAAQ,IAAI,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,IAAI;YAAE,SAAS;QAC7D,MAAM,OAAO,GAAG,gBAAgB,CAAC,IAAI,EAAE,IAAI,EAAE,UAAU,CAAC,CAAC;QACzD,IAAI,CAAC,OAAO;YAAE,SAAS;QACvB,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,EAAE,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACpE,IAAI,MAAM,KAAK,IAAI,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YAC5C,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC/C,CAAC;QACD,IAAI,IAAI,CAAC,QAAQ;YAAE,MAAM;IAC3B,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical list of VBA/Access runtime objects and singletons whose
|
|
3
|
+
* `Receiver.Member` calls are NEVER user-defined code — DAO, FileSystemObject
|
|
4
|
+
* (`fso`), intrinsic collections, error/debug intrinsics, late-binding
|
|
5
|
+
* factories, and Access application singletons.
|
|
6
|
+
*
|
|
7
|
+
* Issue #245: this used to be TWO literal sets written at different times.
|
|
8
|
+
* `RUNTIME_OBJECTS` (formerly in `src/resolution/vba-runtime-objects.ts`)
|
|
9
|
+
* decided whether a synthetic call EDGE was stamped `declined-runtime`;
|
|
10
|
+
* `RUNTIME_RECEIVER_BLACKLIST` (formerly a second literal in
|
|
11
|
+
* `./constants.ts`) decided whether the call-site scan looked at a receiver
|
|
12
|
+
* at all. Because the second list omitted `VBA`, `fso`, `Collection`,
|
|
13
|
+
* `ListBox` and friends, the extractor still synthesized a `function` NODE
|
|
14
|
+
* for every one of those calls — 6,132 stub nodes against 3,840 real
|
|
15
|
+
* procedures on the reference corpus. Edge consumers can filter on
|
|
16
|
+
* `repointDecision`; symbol search and node counts cannot.
|
|
17
|
+
*
|
|
18
|
+
* The two sets are now one literal (`RUNTIME_OBJECT_DEFS`) with two derived
|
|
19
|
+
* views, so they can never drift apart again:
|
|
20
|
+
*
|
|
21
|
+
* - `RUNTIME_OBJECTS` — every canonical name, lowercased, for the
|
|
22
|
+
* case-insensitive `isRuntimeObject` predicate. Consumed by the
|
|
23
|
+
* post-extraction stub resolver (`ReferenceResolver.resolveVbaCallStubTarget`)
|
|
24
|
+
* to DECLINE repointing a stub whose receiver is a runtime object, and by
|
|
25
|
+
* the extractor's stub-NODE gate in `./calls.ts`.
|
|
26
|
+
* - `RUNTIME_RECEIVER_BLACKLIST` — the case-sensitive PascalCase subset
|
|
27
|
+
* flagged `blocksCallScan`. These receivers/members are dropped by the
|
|
28
|
+
* call-site scans BEFORE any reference is surfaced, so the set is
|
|
29
|
+
* deliberately narrow: widening it would silently delete
|
|
30
|
+
* `unresolved_refs` rows. Widening the canonical set is safe; promoting
|
|
31
|
+
* an entry to `blocksCallScan` is not.
|
|
32
|
+
*
|
|
33
|
+
* A user class or module that happens to share a runtime-object name (a
|
|
34
|
+
* "shadow" declaration, e.g. a user `.cls` literally named `DAO`) is still
|
|
35
|
+
* linked by the resolver: it runs its normal two-step name resolution FIRST
|
|
36
|
+
* and only falls back to this list when no real target exists (FR-2.1).
|
|
37
|
+
*
|
|
38
|
+
* This module is a LEAF: it imports nothing. `src/extraction/` must not
|
|
39
|
+
* depend on `src/resolution/`, so the canonical set lives here and
|
|
40
|
+
* `src/resolution/vba-runtime-objects.ts` re-exports it — every existing
|
|
41
|
+
* resolver import keeps working unchanged.
|
|
42
|
+
*/
|
|
43
|
+
/**
|
|
44
|
+
* Every canonical runtime-object name, lowercased so matching is
|
|
45
|
+
* case-insensitive against a receiver as it appears in source.
|
|
46
|
+
*/
|
|
47
|
+
export declare const RUNTIME_OBJECTS: ReadonlySet<string>;
|
|
48
|
+
/**
|
|
49
|
+
* Derived view: the case-sensitive receivers/members the call-site scans drop
|
|
50
|
+
* before surfacing anything. NOT a second literal — see `blocksCallScan`.
|
|
51
|
+
*/
|
|
52
|
+
export declare const RUNTIME_RECEIVER_BLACKLIST: ReadonlySet<string>;
|
|
53
|
+
/**
|
|
54
|
+
* True iff `receiver` (any case) names a known VBA/Access runtime object.
|
|
55
|
+
* Leading/trailing brackets and surrounding whitespace are stripped
|
|
56
|
+
* defensively so a bracketed receiver (`[DAO]`) still matches.
|
|
57
|
+
*/
|
|
58
|
+
export declare function isRuntimeObject(receiver: string | null | undefined): boolean;
|
|
59
|
+
//# sourceMappingURL=runtime-objects.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-objects.d.ts","sourceRoot":"","sources":["../../../src/extraction/vba/runtime-objects.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AA0DH;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,WAAW,CAAC,MAAM,CAE/C,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,0BAA0B,EAAE,WAAW,CAAC,MAAM,CAE1D,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAI5E"}
|