@aroman22/codegraph-vba-darwin-arm64 1.10.0 → 1.11.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/db/queries.d.ts +37 -0
- package/lib/dist/db/queries.d.ts.map +1 -1
- package/lib/dist/db/queries.js +33 -0
- package/lib/dist/db/queries.js.map +1 -1
- package/lib/dist/extraction/frameworks/dysflow-export.d.ts +37 -0
- package/lib/dist/extraction/frameworks/dysflow-export.d.ts.map +1 -0
- package/lib/dist/extraction/frameworks/dysflow-export.js +121 -0
- package/lib/dist/extraction/frameworks/dysflow-export.js.map +1 -0
- package/lib/dist/extraction/frameworks/index.d.ts +20 -0
- package/lib/dist/extraction/frameworks/index.d.ts.map +1 -0
- package/lib/dist/extraction/frameworks/index.js +24 -0
- package/lib/dist/extraction/frameworks/index.js.map +1 -0
- package/lib/dist/extraction/index.d.ts.map +1 -1
- package/lib/dist/extraction/index.js +25 -5
- package/lib/dist/extraction/index.js.map +1 -1
- package/lib/dist/extraction/parse-pool.d.ts +10 -0
- package/lib/dist/extraction/parse-pool.d.ts.map +1 -1
- package/lib/dist/extraction/parse-pool.js +2 -0
- package/lib/dist/extraction/parse-pool.js.map +1 -1
- package/lib/dist/extraction/parse-worker.js +6 -2
- package/lib/dist/extraction/parse-worker.js.map +1 -1
- package/lib/dist/extraction/tree-sitter.d.ts +9 -1
- package/lib/dist/extraction/tree-sitter.d.ts.map +1 -1
- package/lib/dist/extraction/tree-sitter.js +58 -5
- package/lib/dist/extraction/tree-sitter.js.map +1 -1
- package/lib/dist/extraction/vba/call-sweep.d.ts +43 -0
- package/lib/dist/extraction/vba/call-sweep.d.ts.map +1 -1
- package/lib/dist/extraction/vba/call-sweep.js +155 -66
- package/lib/dist/extraction/vba/call-sweep.js.map +1 -1
- package/lib/dist/extraction/vba/calls.d.ts.map +1 -1
- package/lib/dist/extraction/vba/calls.js +6 -0
- package/lib/dist/extraction/vba/calls.js.map +1 -1
- package/lib/dist/extraction/vba/context.d.ts +109 -1
- package/lib/dist/extraction/vba/context.d.ts.map +1 -1
- package/lib/dist/extraction/vba/context.js +155 -2
- package/lib/dist/extraction/vba/context.js.map +1 -1
- package/lib/dist/extraction/vba/declarations.d.ts +38 -2
- package/lib/dist/extraction/vba/declarations.d.ts.map +1 -1
- package/lib/dist/extraction/vba/declarations.js +217 -129
- package/lib/dist/extraction/vba/declarations.js.map +1 -1
- package/lib/dist/extraction/vba/dims.d.ts +35 -1
- package/lib/dist/extraction/vba/dims.d.ts.map +1 -1
- package/lib/dist/extraction/vba/dims.js +185 -109
- package/lib/dist/extraction/vba/dims.js.map +1 -1
- package/lib/dist/extraction/vba/enums-consts.d.ts +47 -7
- package/lib/dist/extraction/vba/enums-consts.d.ts.map +1 -1
- package/lib/dist/extraction/vba/enums-consts.js +212 -139
- package/lib/dist/extraction/vba/enums-consts.js.map +1 -1
- package/lib/dist/extraction/vba/event-synth.d.ts +3 -0
- package/lib/dist/extraction/vba/event-synth.d.ts.map +1 -0
- package/lib/dist/extraction/vba/event-synth.js +176 -0
- package/lib/dist/extraction/vba/event-synth.js.map +1 -0
- package/lib/dist/extraction/vba/implements.d.ts +16 -0
- package/lib/dist/extraction/vba/implements.d.ts.map +1 -1
- package/lib/dist/extraction/vba/implements.js +43 -12
- package/lib/dist/extraction/vba/implements.js.map +1 -1
- package/lib/dist/extraction/vba/procedures.d.ts +20 -0
- package/lib/dist/extraction/vba/procedures.d.ts.map +1 -1
- package/lib/dist/extraction/vba/procedures.js +48 -13
- package/lib/dist/extraction/vba/procedures.js.map +1 -1
- package/lib/dist/extraction/vba/rules.d.ts +125 -0
- package/lib/dist/extraction/vba/rules.d.ts.map +1 -0
- package/lib/dist/extraction/vba/rules.js +49 -0
- package/lib/dist/extraction/vba/rules.js.map +1 -0
- package/lib/dist/extraction/vba-extractor.d.ts +77 -1
- package/lib/dist/extraction/vba-extractor.d.ts.map +1 -1
- package/lib/dist/extraction/vba-extractor.js +177 -15
- package/lib/dist/extraction/vba-extractor.js.map +1 -1
- package/lib/dist/extraction/vba-preprocess.d.ts +11 -1
- package/lib/dist/extraction/vba-preprocess.d.ts.map +1 -1
- package/lib/dist/extraction/vba-preprocess.js +45 -16
- package/lib/dist/extraction/vba-preprocess.js.map +1 -1
- package/lib/dist/extraction/vba-timing.d.ts +38 -0
- package/lib/dist/extraction/vba-timing.d.ts.map +1 -0
- package/lib/dist/extraction/vba-timing.js +203 -0
- package/lib/dist/extraction/vba-timing.js.map +1 -0
- package/lib/dist/index.d.ts.map +1 -1
- package/lib/dist/index.js +22 -0
- package/lib/dist/index.js.map +1 -1
- package/lib/dist/project-config.d.ts +31 -0
- package/lib/dist/project-config.d.ts.map +1 -1
- package/lib/dist/project-config.js +75 -22
- package/lib/dist/project-config.js.map +1 -1
- package/lib/dist/resolution/frameworks/index.d.ts.map +1 -1
- package/lib/dist/resolution/frameworks/index.js +7 -0
- package/lib/dist/resolution/frameworks/index.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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"declarations.js","sourceRoot":"","sources":["../../../src/extraction/vba/declarations.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"declarations.js","sourceRoot":"","sources":["../../../src/extraction/vba/declarations.ts"],"names":[],"mappings":";;;AAmOA,kFA+BC;AAMD,kEAOC;AAvQD,gEAAwD;AACxD,6CAA8C;AAE9C,mCAAmE;AAEnE,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,w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C,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACtC,GAAG,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC;IAC3C,CAAC;IACD,OAAO,GAAG,CAAC,KAAK,CAAC;AACnB,CAAC"}
|
|
@@ -1,6 +1,40 @@
|
|
|
1
1
|
import { VbaExtractorContext, VbaClassifier } from './context';
|
|
2
|
+
import { VbaExtractionRule } from './rules';
|
|
2
3
|
/**
|
|
3
|
-
* Issue #
|
|
4
|
+
* Issue #153: the declarative rule table for the Dim / WithEvents
|
|
5
|
+
* concern. Two rules:
|
|
6
|
+
*
|
|
7
|
+
* - `dim-decl` — match a `Dim|Private|Public|Global|Static
|
|
8
|
+
* <var> [As [New] <TypePart>[.<TypePart>]][, …]`
|
|
9
|
+
* declaration; populate `localVarTypeMap` and
|
|
10
|
+
* emit one `references` edge per non-primitive
|
|
11
|
+
* type (or per qualified outer type).
|
|
12
|
+
* - `withevents-decl`— match a `[Dim|Private|Public|Global|Static]
|
|
13
|
+
* WithEvents <var> As <FormType>` declaration;
|
|
14
|
+
* populate `localVarTypeMap` with `withEvents: true`,
|
|
15
|
+
* emit a `references` edge (synthesizedBy:
|
|
16
|
+
* `vba-withevents`) and a `subscribes-event` edge.
|
|
17
|
+
*
|
|
18
|
+
* The two rules are dispatched independently and BOTH can fire on the
|
|
19
|
+
* same line in principle (a `WithEvents` line does NOT match the
|
|
20
|
+
* `Dim|Private|...` prefix because the negative lookahead excludes it).
|
|
21
|
+
* The `dim-decl` rule's `count` hook reports the number of
|
|
22
|
+
* non-primitive `references` edges it emitted, so a multi-variable
|
|
23
|
+
* `Dim a As Foo, b As Bar` line adds 2 to the classifier count, and a
|
|
24
|
+
* bare `Dim x` line adds 0 (the bare-Dim path is a `localVarTypeMap`
|
|
25
|
+
* only side effect, no graph edges).
|
|
26
|
+
*
|
|
27
|
+
* No inter-line state — each rule is self-contained.
|
|
28
|
+
*/
|
|
29
|
+
export declare const RULES: readonly VbaExtractionRule<unknown>[];
|
|
30
|
+
/**
|
|
31
|
+
* Issue #83: factory for the Dim / WithEvents classifier.
|
|
32
|
+
*
|
|
33
|
+
* The body walks the declarative `RULES` table (Issue #153). The two
|
|
34
|
+
* rules are independent: `dim-decl` handles typed declarations
|
|
35
|
+
* (REJECTED if the line is a `WithEvents` because the prefix
|
|
36
|
+
* negative-lookahead excludes `WithEvents`), `withevents-decl`
|
|
37
|
+
* handles WithEvents. No inter-line state.
|
|
4
38
|
*/
|
|
5
39
|
export declare function createDimsClassifier(): VbaClassifier;
|
|
6
40
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dims.d.ts","sourceRoot":"","sources":["../../../src/extraction/vba/dims.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"dims.d.ts","sourceRoot":"","sources":["../../../src/extraction/vba/dims.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC/D,OAAO,EAAyB,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAiFnE;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,KAAK,EAAE,SAAS,iBAAiB,CAAC,OAAO,CAAC,EAyItD,CAAC;AAEF;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,IAAI,aAAa,CAgBpD;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,mBAAmB,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAOpF"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RULES = void 0;
|
|
3
4
|
exports.createDimsClassifier = createDimsClassifier;
|
|
4
5
|
exports.sweepDimsAndWithEvents = sweepDimsAndWithEvents;
|
|
5
6
|
const tree_sitter_helpers_1 = require("../tree-sitter-helpers");
|
|
6
7
|
const constants_1 = require("./constants");
|
|
8
|
+
const rules_1 = require("./rules");
|
|
7
9
|
/**
|
|
8
10
|
* Check that a line is a variable declaration and NOT a Sub/Function/
|
|
9
11
|
* Property/Const/WithEvents header (those have their own sweeps).
|
|
@@ -64,124 +66,198 @@ const BARE_DIM_VAR_RE = /^\s*(?:Dim|Private|Public|Global|Static)\s+(\p{L}[\p{L}
|
|
|
64
66
|
/** `WithEvents m_X As Form_Foo` — Dim/Private/Public/Global/Static prefix is optional. */
|
|
65
67
|
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;
|
|
66
68
|
/**
|
|
67
|
-
*
|
|
69
|
+
* Capture the variable name from a WithEvents line (used to populate
|
|
70
|
+
* `localVarTypeMap` and to stamp `metadata.variableName` on the
|
|
71
|
+
* references edge — see `withevents-decl` rule's description for the
|
|
72
|
+
* full rationale tied to issue #150).
|
|
68
73
|
*/
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
74
|
+
const WITHEVENTS_VAR_RE = /^\s*(?:(?:Dim|Private|Public|Global|Static)\s+)?WithEvents\s+(\p{L}[\p{L}\p{N}_]*)/iu;
|
|
75
|
+
/** Helper regex for the bare-Dim fallback path — extracts an `As <Type>` continuation. */
|
|
76
|
+
const DIM_AS_TYPE_RE = /\bAs\s+(\p{L}[\p{L}\p{N}_]*)/iu;
|
|
77
|
+
/**
|
|
78
|
+
* Issue #153: the declarative rule table for the Dim / WithEvents
|
|
79
|
+
* concern. Two rules:
|
|
80
|
+
*
|
|
81
|
+
* - `dim-decl` — match a `Dim|Private|Public|Global|Static
|
|
82
|
+
* <var> [As [New] <TypePart>[.<TypePart>]][, …]`
|
|
83
|
+
* declaration; populate `localVarTypeMap` and
|
|
84
|
+
* emit one `references` edge per non-primitive
|
|
85
|
+
* type (or per qualified outer type).
|
|
86
|
+
* - `withevents-decl`— match a `[Dim|Private|Public|Global|Static]
|
|
87
|
+
* WithEvents <var> As <FormType>` declaration;
|
|
88
|
+
* populate `localVarTypeMap` with `withEvents: true`,
|
|
89
|
+
* emit a `references` edge (synthesizedBy:
|
|
90
|
+
* `vba-withevents`) and a `subscribes-event` edge.
|
|
91
|
+
*
|
|
92
|
+
* The two rules are dispatched independently and BOTH can fire on the
|
|
93
|
+
* same line in principle (a `WithEvents` line does NOT match the
|
|
94
|
+
* `Dim|Private|...` prefix because the negative lookahead excludes it).
|
|
95
|
+
* The `dim-decl` rule's `count` hook reports the number of
|
|
96
|
+
* non-primitive `references` edges it emitted, so a multi-variable
|
|
97
|
+
* `Dim a As Foo, b As Bar` line adds 2 to the classifier count, and a
|
|
98
|
+
* bare `Dim x` line adds 0 (the bare-Dim path is a `localVarTypeMap`
|
|
99
|
+
* only side effect, no graph edges).
|
|
100
|
+
*
|
|
101
|
+
* No inter-line state — each rule is self-contained.
|
|
102
|
+
*/
|
|
103
|
+
exports.RULES = [
|
|
104
|
+
(0, rules_1.defineRule)({
|
|
105
|
+
id: 'dim-decl',
|
|
106
|
+
description: 'Match a `Dim|Private|Public|Global|Static <var> [As [New] <Type>][, …]` declaration; populate `localVarTypeMap` and emit one `vba-name-resolution` `references` edge per non-primitive type (or per qualified outer type).',
|
|
107
|
+
pattern: DIM_DECL_PREFIX_RE,
|
|
108
|
+
count: (result) => result.edges,
|
|
109
|
+
emit: (_m, ctx, line, lineNum) => {
|
|
110
|
+
// Re-run the prefix check inside the emit (the pattern is a
|
|
111
|
+
// RegExp without /g so `.test()` is enough and idempotent). This
|
|
112
|
+
// keeps the rule table's contract "pattern matches → emit fires"
|
|
113
|
+
// while the emit body is the same code that used to live inline.
|
|
114
|
+
let edgesEmitted = 0;
|
|
115
|
+
if (!DIM_DECL_PREFIX_RE.test(line))
|
|
116
|
+
return null;
|
|
117
|
+
DIM_ALL_VARS_RE.lastIndex = 0;
|
|
118
|
+
let m;
|
|
119
|
+
while ((m = DIM_ALL_VARS_RE.exec(line)) !== null) {
|
|
120
|
+
const varName = m[1] ?? '';
|
|
121
|
+
// Issue #54: DIM_ALL_VARS_RE groups (2) and (3) are alternative
|
|
122
|
+
// captures for the same outer-type position — the bracketed
|
|
123
|
+
// alternative wins when present, the bare one otherwise. The
|
|
124
|
+
// captured value is already unwrapped (the `[...]` is consumed
|
|
125
|
+
// by the regex, group (2) holds the inner content). Same shape
|
|
126
|
+
// for the inner type at groups (4)/(5).
|
|
127
|
+
const outerType = m[2] ?? m[3] ?? '';
|
|
128
|
+
const innerType = m[4] ?? m[5] ?? '';
|
|
129
|
+
// Fix 2 (Issue #2): populate the local var type map so that
|
|
130
|
+
// `sweepCallsAndSql` can gate qualified statement-form calls.
|
|
131
|
+
if (varName && outerType) {
|
|
132
|
+
ctx.localVarTypeMap.set(varName.toLowerCase(), {
|
|
133
|
+
outer: outerType,
|
|
134
|
+
qualified: !!innerType,
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
if (innerType) {
|
|
138
|
+
// Qualified form (`Dim x As Foo.Bar`) — emit reference to the
|
|
139
|
+
// outer type `Foo` (same behaviour as the old DIM_QUAL_RE path).
|
|
140
|
+
if (outerType) {
|
|
141
|
+
ctx.emitReference(outerType, lineNum, 0, 'vba-name-resolution');
|
|
142
|
+
edgesEmitted++;
|
|
115
143
|
}
|
|
116
144
|
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
// Captures the FIRST variable name only. Multi-variable bare
|
|
124
|
-
// Dim (e.g. `Dim a, b, c` without an `As` clause) is rare in
|
|
125
|
-
// real Dysflow fixtures and is intentionally NOT tracked here —
|
|
126
|
-
// those bare variables fall back to the undeclared-receiver
|
|
127
|
-
// path, which is the conservative choice. Skip if the typed-form
|
|
128
|
-
// loop already populated the entry.
|
|
129
|
-
const bm = BARE_DIM_VAR_RE.exec(line);
|
|
130
|
-
if (bm) {
|
|
131
|
-
const varName = bm[1] ?? '';
|
|
132
|
-
if (varName) {
|
|
133
|
-
const key = varName.toLowerCase();
|
|
134
|
-
if (!ctx.localVarTypeMap.has(key)) {
|
|
135
|
-
// Look for an `As <Type>` continuation on the same line so the
|
|
136
|
-
// outer type matches the existing typed-form behaviour. If
|
|
137
|
-
// absent, the variable is implicit `Variant` per VBA semantics.
|
|
138
|
-
const asRe = /\bAs\s+(\p{L}[\p{L}\p{N}_]*)/iu;
|
|
139
|
-
const asMatch = asRe.exec(line);
|
|
140
|
-
const outer = asMatch ? (asMatch[1] ?? '').toLowerCase() : 'variant';
|
|
141
|
-
ctx.localVarTypeMap.set(key, {
|
|
142
|
-
outer,
|
|
143
|
-
qualified: false,
|
|
144
|
-
});
|
|
145
|
-
}
|
|
145
|
+
else {
|
|
146
|
+
// Unqualified form (`Dim x As SomeType`, `Dim x As New SomeType`)
|
|
147
|
+
// — emit reference only when the type is not a primitive or keyword.
|
|
148
|
+
if (outerType && !constants_1.PRIMITIVE_TYPES.has(outerType.toLowerCase())) {
|
|
149
|
+
ctx.emitReference(outerType, lineNum, 0, 'vba-name-resolution');
|
|
150
|
+
edgesEmitted++;
|
|
146
151
|
}
|
|
147
152
|
}
|
|
148
153
|
}
|
|
149
|
-
//
|
|
150
|
-
//
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
154
|
+
// Antigravity audit Task 3: bare `Dim x` (no `As` clause) and
|
|
155
|
+
// explicit-primitive `Dim x As <primitive>` declarations must
|
|
156
|
+
// still register `x` in `localVarTypeMap` so the qualified-call
|
|
157
|
+
// site scan in `scanCallSites` can gate the dead-end stub that
|
|
158
|
+
// no resolver could ever repoint.
|
|
159
|
+
//
|
|
160
|
+
// Captures the FIRST variable name only. Multi-variable bare
|
|
161
|
+
// Dim (e.g. `Dim a, b, c` without an `As` clause) is rare in
|
|
162
|
+
// real Dysflow fixtures and is intentionally NOT tracked here —
|
|
163
|
+
// those bare variables fall back to the undeclared-receiver
|
|
164
|
+
// path, which is the conservative choice. Skip if the typed-form
|
|
165
|
+
// loop already populated the entry.
|
|
166
|
+
const bm = BARE_DIM_VAR_RE.exec(line);
|
|
167
|
+
if (bm) {
|
|
168
|
+
const varName = bm[1] ?? '';
|
|
169
|
+
if (varName) {
|
|
170
|
+
const key = varName.toLowerCase();
|
|
171
|
+
if (!ctx.localVarTypeMap.has(key)) {
|
|
172
|
+
// Look for an `As <Type>` continuation on the same line so the
|
|
173
|
+
// outer type matches the existing typed-form behaviour. If
|
|
174
|
+
// absent, the variable is implicit `Variant` per VBA semantics.
|
|
175
|
+
const asMatch = DIM_AS_TYPE_RE.exec(line);
|
|
176
|
+
const outer = asMatch ? (asMatch[1] ?? '').toLowerCase() : 'variant';
|
|
177
|
+
ctx.localVarTypeMap.set(key, {
|
|
178
|
+
outer,
|
|
161
179
|
qualified: false,
|
|
162
|
-
withEvents: true,
|
|
163
|
-
variableName: weVarName,
|
|
164
180
|
});
|
|
165
181
|
}
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
return { edges: edgesEmitted };
|
|
185
|
+
},
|
|
186
|
+
}),
|
|
187
|
+
(0, rules_1.defineRule)({
|
|
188
|
+
id: 'withevents-decl',
|
|
189
|
+
description: 'Match a `[Dim|Private|Public|Global|Static] WithEvents <var> As <FormType>` declaration; populate `localVarTypeMap` with `withEvents: true`, emit a `vba-withevents` `references` edge AND a `subscribes-event` edge (the `variableName` metadata is preserved on both edges so the issue #150 event-handler synthesis pass can locate the handler Sub after the resolver repoints the references edge).',
|
|
190
|
+
pattern: WITHEVENTS_RE,
|
|
191
|
+
emit: (m, ctx, line, lineNum) => {
|
|
192
|
+
const formType = m[1] ?? '';
|
|
193
|
+
if (!formType)
|
|
194
|
+
return null;
|
|
195
|
+
// Extract the variable name from the WithEvents line for the map.
|
|
196
|
+
const weVarM = WITHEVENTS_VAR_RE.exec(line);
|
|
197
|
+
const weVarName = weVarM?.[1] ?? '';
|
|
198
|
+
if (weVarName) {
|
|
199
|
+
ctx.localVarTypeMap.set(weVarName.toLowerCase(), {
|
|
200
|
+
outer: formType,
|
|
201
|
+
qualified: false,
|
|
202
|
+
withEvents: true,
|
|
203
|
+
variableName: weVarName,
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
// Stamp `variableName` onto the `references` edge's metadata so
|
|
207
|
+
// the post-extraction event-handler synthesis pass (#150) can
|
|
208
|
+
// locate the `m_<var>_<event>` handler Sub even after
|
|
209
|
+
// `resolveVbaReferenceStubs` repoints this edge to the real
|
|
210
|
+
// class node AND CASCADE-deletes the companion
|
|
211
|
+
// `subscribes-event` edge along with the synthetic class stub.
|
|
212
|
+
// Without this, the variable name would be lost once the
|
|
213
|
+
// resolver runs, and the synthesis pass would have no way to
|
|
214
|
+
// bind the `WithEvents` binding to its handler.
|
|
215
|
+
ctx.emitReference(formType, lineNum, 0, 'vba-withevents', undefined, {
|
|
216
|
+
...(weVarName ? { variableName: weVarName } : {}),
|
|
217
|
+
});
|
|
218
|
+
const targetId = (0, tree_sitter_helpers_1.generateNodeId)(ctx.filePath, 'class', formType, 0);
|
|
219
|
+
const subscriberEdge = {
|
|
220
|
+
source: ctx.moduleOrClassNode?.id ?? '',
|
|
221
|
+
target: targetId,
|
|
222
|
+
kind: 'subscribes-event',
|
|
223
|
+
provenance: 'heuristic',
|
|
224
|
+
metadata: {
|
|
225
|
+
synthesizedBy: 'vba-withevents',
|
|
226
|
+
variableName: weVarName || undefined,
|
|
227
|
+
},
|
|
228
|
+
line: lineNum,
|
|
229
|
+
column: 0,
|
|
230
|
+
};
|
|
231
|
+
ctx.edges.push(subscriberEdge);
|
|
232
|
+
if (!ctx.moduleOrClassNode) {
|
|
233
|
+
ctx.pendingModuleOrClassSource.push(subscriberEdge);
|
|
234
|
+
}
|
|
235
|
+
return { name: formType };
|
|
236
|
+
},
|
|
237
|
+
}),
|
|
238
|
+
];
|
|
239
|
+
/**
|
|
240
|
+
* Issue #83: factory for the Dim / WithEvents classifier.
|
|
241
|
+
*
|
|
242
|
+
* The body walks the declarative `RULES` table (Issue #153). The two
|
|
243
|
+
* rules are independent: `dim-decl` handles typed declarations
|
|
244
|
+
* (REJECTED if the line is a `WithEvents` because the prefix
|
|
245
|
+
* negative-lookahead excludes `WithEvents`), `withevents-decl`
|
|
246
|
+
* handles WithEvents. No inter-line state.
|
|
247
|
+
*/
|
|
248
|
+
function createDimsClassifier() {
|
|
249
|
+
return {
|
|
250
|
+
name: 'dims',
|
|
251
|
+
count: 0,
|
|
252
|
+
classifyLine(line, i, ctx) {
|
|
253
|
+
const lineNum = i + 1;
|
|
254
|
+
for (const rule of exports.RULES) {
|
|
255
|
+
const m = (0, rules_1.matchRule)(rule.pattern, line);
|
|
256
|
+
if (!m)
|
|
257
|
+
continue;
|
|
258
|
+
const result = rule.emit(m, ctx, line, lineNum);
|
|
259
|
+
if (result !== null && result !== undefined) {
|
|
260
|
+
this.count += rule.count ? rule.count(result) : 1;
|
|
185
261
|
}
|
|
186
262
|
}
|
|
187
263
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dims.js","sourceRoot":"","sources":["../../../src/extraction/vba/dims.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dims.js","sourceRoot":"","sources":["../../../src/extraction/vba/dims.ts"],"names":[],"mappings":";;;AAyQA,oDAgBC;AAMD,wDAOC;AA/RD,gEAAwD;AACxD,2CAA8C;AAE9C,mCAAmE;AAEnE;;;;;;;;;;;;GAYG;AACH,MAAM,kBAAkB,GACtB,8FAA8F,CAAC;AAEjG;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,eAAe,GACnB,kIAAkI,CAAC;AAErI;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,eAAe,GACnB,iFAAiF,CAAC;AAEpF,0FAA0F;AAC1F,MAAM,aAAa,GACjB,iHAAiH,CAAC;AAEpH;;;;;GAKG;AACH,MAAM,iBAAiB,GACrB,sFAAsF,CAAC;AAEzF,0FAA0F;AAC1F,MAAM,cAAc,GAAG,gCAAgC,CAAC;AAExD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACU,QAAA,KAAK,GAA0C;IAC1D,IAAA,kBAAU,EAAC;QACT,EAAE,EAAE,UAAU;QACd,WAAW,EACT,4NAA4N;QAC9N,OAAO,EAAE,kBAAkB;QAC3B,KAAK,EAAE,CAAC,MAAM,EAAE,EAAE,CAAE,MAA4B,CAAC,KAAK;QACtD,IAAI,EAAE,CAAC,EAAE,EA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AC7D,CAAC;YACH,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,SAAgB,sBAAsB,CAAC,GAAwB,EAAE,GAAW;IAC1E,MAAM,GAAG,GAAG,oBAAoB,EAAE,CAAC;IACnC,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC9B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACtC,GAAG,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC;IAC3C,CAAC;IACD,OAAO,GAAG,CAAC,KAAK,CAAC;AACnB,CAAC"}
|
|
@@ -1,13 +1,53 @@
|
|
|
1
1
|
import { VbaExtractorContext, VbaClassifier } from './context';
|
|
2
|
+
import { VbaExtractionRule } from './rules';
|
|
2
3
|
/**
|
|
3
|
-
* Issue #
|
|
4
|
-
*
|
|
4
|
+
* Issue #153: the declarative rule table for the enum / const concern.
|
|
5
|
+
* Six rules, partitioned by where they fire:
|
|
5
6
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
7
|
+
* - `proc-start` (outside-enum-block) — match a `Sub` /
|
|
8
|
+
* `Function` / `Property` header; push onto
|
|
9
|
+
* `ctx.procStack` and set `ctx.currentProcKey`
|
|
10
|
+
* so subsequent Const writes land in the
|
|
11
|
+
* per-proc resolution bucket.
|
|
12
|
+
* - `proc-end` (outside-enum-block) — match `End Sub` /
|
|
13
|
+
* `End Function` / `End Property`; pop the
|
|
14
|
+
* matching `procStack` entry.
|
|
15
|
+
* - `enum-start` (outside-enum-block) — match `[visibility]
|
|
16
|
+
* Enum <Name>`; emit an `enum` node + `contains`
|
|
17
|
+
* edge and mark `ctx.vbaEnumBlock`.
|
|
18
|
+
* - `enum-end` (inside-enum-block) — match `End Enum`; clear
|
|
19
|
+
* `ctx.vbaEnumBlock`.
|
|
20
|
+
* - `enum-member` (inside-enum-block) — match `<MemberName>
|
|
21
|
+
* [= <value>]`; emit an `enum_member` node + a
|
|
22
|
+
* `contains` edge from the open enum.
|
|
23
|
+
* - `const-decl` (outside-enum-block) — match `[visibility]
|
|
24
|
+
* Const <decls>`; always write the per-scope
|
|
25
|
+
* resolution bucket, and emit a `constant` node
|
|
26
|
+
* + `contains` edge ONLY when not inside a proc
|
|
27
|
+
* (proc-local Consts are not module symbols).
|
|
28
|
+
*
|
|
29
|
+
* The inter-line `ctx.procStack` / `ctx.currentProcKey` state is
|
|
30
|
+
* SHARED with the calls/SQL classifier (issue #52 protocol). The
|
|
31
|
+
* `ctx.vbaEnumBlock` state is local to this concern and lives on
|
|
32
|
+
* `ctx` for the same RULES-table-friendliness reason as
|
|
33
|
+
* `vbaDeclTypeBlock`.
|
|
34
|
+
*/
|
|
35
|
+
export declare const RULES: readonly VbaExtractionRule<unknown>[];
|
|
36
|
+
/**
|
|
37
|
+
* Issue #83: factory for the enum / const classifier.
|
|
38
|
+
*
|
|
39
|
+
* The body walks the declarative `RULES` table (Issue #153) and
|
|
40
|
+
* honours each rule's `requires` precondition. The inter-line
|
|
41
|
+
* state — `ctx.procStack`, `ctx.currentProcKey`, and
|
|
42
|
+
* `ctx.vbaEnumBlock` — lives on `ctx` so the RULES table's `emit`
|
|
43
|
+
* functions can read/write it without taking a closure reference.
|
|
44
|
+
*
|
|
45
|
+
* Issue #52: the first invocation also resets the shared proc-stack
|
|
46
|
+
* + lookup key so leftover state from a previous `extract()` (only
|
|
47
|
+
* possible in tests that construct a fresh extractor and run twice)
|
|
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.
|
|
11
51
|
*/
|
|
12
52
|
export declare function createEnumsConstsClassifier(): VbaClassifier;
|
|
13
53
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enums-consts.d.ts","sourceRoot":"","sources":["../../../src/extraction/vba/enums-consts.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"enums-consts.d.ts","sourceRoot":"","sources":["../../../src/extraction/vba/enums-consts.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC/D,OAAO,EAAyB,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAqBnE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,eAAO,MAAM,KAAK,EAAE,SAAS,iBAAiB,CAAC,OAAO,CAAC,EAgKtD,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,2BAA2B,IAAI,aAAa,CA6B3D;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,mBAAmB,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAOjF"}
|