@aroman22/codegraph-vba-darwin-arm64 1.6.0 → 1.6.2
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/migrations.d.ts +1 -1
- package/lib/dist/db/migrations.d.ts.map +1 -1
- package/lib/dist/db/migrations.js +14 -1
- package/lib/dist/db/migrations.js.map +1 -1
- package/lib/dist/db/queries.d.ts.map +1 -1
- package/lib/dist/db/queries.js +8 -2
- package/lib/dist/db/queries.js.map +1 -1
- package/lib/dist/db/schema.sql +1 -0
- package/lib/dist/extraction/grammars.d.ts +32 -0
- package/lib/dist/extraction/grammars.d.ts.map +1 -1
- package/lib/dist/extraction/grammars.js +61 -0
- package/lib/dist/extraction/grammars.js.map +1 -1
- package/lib/dist/extraction/tree-sitter.d.ts.map +1 -1
- package/lib/dist/extraction/tree-sitter.js +24 -0
- package/lib/dist/extraction/tree-sitter.js.map +1 -1
- package/lib/dist/extraction/vba/call-sweep.d.ts +13 -1
- package/lib/dist/extraction/vba/call-sweep.d.ts.map +1 -1
- package/lib/dist/extraction/vba/call-sweep.js +229 -151
- package/lib/dist/extraction/vba/call-sweep.js.map +1 -1
- package/lib/dist/extraction/vba/context.d.ts +52 -2
- package/lib/dist/extraction/vba/context.d.ts.map +1 -1
- package/lib/dist/extraction/vba/context.js +29 -2
- package/lib/dist/extraction/vba/context.js.map +1 -1
- package/lib/dist/extraction/vba/declarations.d.ts +10 -1
- package/lib/dist/extraction/vba/declarations.d.ts.map +1 -1
- package/lib/dist/extraction/vba/declarations.js +141 -123
- package/lib/dist/extraction/vba/declarations.js.map +1 -1
- package/lib/dist/extraction/vba/dims.d.ts +9 -1
- package/lib/dist/extraction/vba/dims.d.ts.map +1 -1
- package/lib/dist/extraction/vba/dims.js +125 -109
- package/lib/dist/extraction/vba/dims.js.map +1 -1
- package/lib/dist/extraction/vba/enums-consts.d.ts +13 -10
- package/lib/dist/extraction/vba/enums-consts.d.ts.map +1 -1
- package/lib/dist/extraction/vba/enums-consts.js +153 -131
- package/lib/dist/extraction/vba/enums-consts.js.map +1 -1
- package/lib/dist/extraction/vba/implements.d.ts +9 -1
- package/lib/dist/extraction/vba/implements.d.ts.map +1 -1
- package/lib/dist/extraction/vba/implements.js +56 -40
- package/lib/dist/extraction/vba/implements.js.map +1 -1
- package/lib/dist/extraction/vba/procedures.d.ts +13 -1
- package/lib/dist/extraction/vba/procedures.d.ts.map +1 -1
- package/lib/dist/extraction/vba/procedures.js +238 -186
- package/lib/dist/extraction/vba/procedures.js.map +1 -1
- package/lib/dist/extraction/vba/sql-wrapper.d.ts.map +1 -1
- package/lib/dist/extraction/vba/sql-wrapper.js +20 -3
- package/lib/dist/extraction/vba/sql-wrapper.js.map +1 -1
- package/lib/dist/extraction/vba-extractor.d.ts.map +1 -1
- package/lib/dist/extraction/vba-extractor.js +47 -38
- package/lib/dist/extraction/vba-extractor.js.map +1 -1
- package/lib/dist/extraction/vba-form-extractor.d.ts.map +1 -1
- package/lib/dist/extraction/vba-form-extractor.js +6 -1
- package/lib/dist/extraction/vba-form-extractor.js.map +1 -1
- package/lib/dist/extraction/vba-preprocess.d.ts.map +1 -1
- package/lib/dist/extraction/vba-preprocess.js +23 -2
- package/lib/dist/extraction/vba-preprocess.js.map +1 -1
- package/lib/dist/extraction/vba-test-manifest-extractor.d.ts +26 -0
- package/lib/dist/extraction/vba-test-manifest-extractor.d.ts.map +1 -0
- package/lib/dist/extraction/vba-test-manifest-extractor.js +173 -0
- package/lib/dist/extraction/vba-test-manifest-extractor.js.map +1 -0
- package/lib/dist/extraction/vba-test-sequence-extractor.d.ts +29 -0
- package/lib/dist/extraction/vba-test-sequence-extractor.d.ts.map +1 -0
- package/lib/dist/extraction/vba-test-sequence-extractor.js +180 -0
- package/lib/dist/extraction/vba-test-sequence-extractor.js.map +1 -0
- package/lib/dist/mcp/server-instructions.d.ts +1 -1
- package/lib/dist/mcp/server-instructions.d.ts.map +1 -1
- package/lib/dist/mcp/server-instructions.js +5 -0
- package/lib/dist/mcp/server-instructions.js.map +1 -1
- package/lib/dist/resolution/index.d.ts.map +1 -1
- package/lib/dist/resolution/index.js +30 -0
- package/lib/dist/resolution/index.js.map +1 -1
- package/lib/dist/resolution/types.d.ts +7 -0
- package/lib/dist/resolution/types.d.ts.map +1 -1
- package/lib/dist/upgrade/index.d.ts +2 -2
- package/lib/dist/upgrade/index.d.ts.map +1 -1
- package/lib/dist/upgrade/index.js +1 -1
- package/lib/dist/upgrade/index.js.map +1 -1
- package/lib/node_modules/.modules.yaml +1 -1
- package/lib/node_modules/.pnpm/lock.yaml +4 -0
- package/lib/node_modules/.pnpm-workspace-state-v1.json +1 -1
- package/lib/package.json +8 -2
- package/package.json +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createEnumsConstsClassifier = createEnumsConstsClassifier;
|
|
3
4
|
exports.sweepEnumsAndConsts = sweepEnumsAndConsts;
|
|
4
5
|
/**
|
|
5
6
|
* Enum / Const sweep (REQ-CODE-12, REQ-CODE-13). Emits `enum` + `enum_member`
|
|
@@ -24,140 +25,87 @@ const ENUM_MEMBER_RE = /^\s*(\p{L}[\p{L}\p{N}_]*)\s*(?:=|$)/u;
|
|
|
24
25
|
/** `[visibility] Const <decls>` — captures visibility (1) and the rest (2). */
|
|
25
26
|
const CONST_DECL_RE = /^\s*(?:(Public|Private|Friend|Global)\s+)?Const\s+(.+)$/i;
|
|
26
27
|
/**
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* per member and a `contains` edge enum→member;
|
|
30
|
-
* - one `constant` node per name declared on a `Const` line (multi-name
|
|
31
|
-
* lines emit one node per name);
|
|
32
|
-
* - a `contains` edge from the module/class node to each enum and constant
|
|
33
|
-
* (held in `pendingModuleOrClassSource` until the module node exists).
|
|
28
|
+
* Issue #83: factory for the enum / const classifier. Closure state:
|
|
29
|
+
* `currentEnum` (open `Enum ... End Enum` block).
|
|
34
30
|
*
|
|
35
|
-
*
|
|
36
|
-
* the
|
|
31
|
+
* Also resets + advances the SHARED `ctx.procStack`/`ctx.currentProcKey`
|
|
32
|
+
* per line — same protocol the pre-#83 sweep followed. The calls-sql
|
|
33
|
+
* classifier runs AFTER this one in the per-line dispatch order and
|
|
34
|
+
* applies the same protocol, so the end-of-line scope state is identical
|
|
35
|
+
* to the legacy sequential-sweep behaviour.
|
|
37
36
|
*/
|
|
38
|
-
function
|
|
39
|
-
const lines = src.split('\n');
|
|
40
|
-
let count = 0;
|
|
37
|
+
function createEnumsConstsClassifier() {
|
|
41
38
|
let currentEnum = null;
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
// line (different leading keywords), so it is safe to advance the
|
|
60
|
-
// stack here and then fall through to the rest of the body.
|
|
61
|
-
const procStart = constants_1.PROC_RE.exec(line);
|
|
62
|
-
if (procStart) {
|
|
63
|
-
ctx.procStack.push(lineNum);
|
|
64
|
-
ctx.currentProcKey = String(lineNum);
|
|
65
|
-
}
|
|
66
|
-
else if (constants_1.PROCEDURE_END_RE.test(line) && ctx.procStack.length > 0) {
|
|
67
|
-
ctx.procStack.pop();
|
|
68
|
-
ctx.currentProcKey =
|
|
69
|
-
ctx.procStack.length > 0
|
|
70
|
-
? String(ctx.procStack[ctx.procStack.length - 1])
|
|
71
|
-
: 'module';
|
|
72
|
-
}
|
|
73
|
-
if (currentEnum) {
|
|
74
|
-
if (ENUM_END_RE.test(line)) {
|
|
75
|
-
currentEnum = null;
|
|
76
|
-
continue;
|
|
39
|
+
const cls = {
|
|
40
|
+
name: 'enumsConsts',
|
|
41
|
+
count: 0,
|
|
42
|
+
classifyLine(line, i, ctx) {
|
|
43
|
+
const lineNum = i + 1;
|
|
44
|
+
// Issue #52: track proc scope so Const declarations on this line
|
|
45
|
+
// can decide whether they belong to the module (currentProcKey
|
|
46
|
+
// === 'module') or to the top-most procedure (write the per-proc
|
|
47
|
+
// bucket, skip the module-level `constant` node emission).
|
|
48
|
+
//
|
|
49
|
+
// PROC_RE cannot overlap with CONST_DECL_RE on the same physical
|
|
50
|
+
// line (different leading keywords), so it is safe to advance the
|
|
51
|
+
// stack here and then fall through to the rest of the body.
|
|
52
|
+
const procStart = constants_1.PROC_RE.exec(line);
|
|
53
|
+
if (procStart) {
|
|
54
|
+
ctx.procStack.push(lineNum);
|
|
55
|
+
ctx.currentProcKey = String(lineNum);
|
|
77
56
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
id: memberId,
|
|
85
|
-
kind: 'enum_member',
|
|
86
|
-
name: memberName,
|
|
87
|
-
qualifiedName: `${currentEnum.name}.${memberName}`,
|
|
88
|
-
filePath: ctx.filePath,
|
|
89
|
-
language: 'vba',
|
|
90
|
-
startLine: lineNum,
|
|
91
|
-
endLine: lineNum,
|
|
92
|
-
startColumn: 0,
|
|
93
|
-
endColumn: line.length,
|
|
94
|
-
updatedAt: Date.now(),
|
|
95
|
-
});
|
|
96
|
-
// enum → member: source is known, emit directly (not pending).
|
|
97
|
-
ctx.edges.push({
|
|
98
|
-
source: currentEnum.id,
|
|
99
|
-
target: memberId,
|
|
100
|
-
kind: 'contains',
|
|
101
|
-
});
|
|
102
|
-
}
|
|
57
|
+
else if (constants_1.PROCEDURE_END_RE.test(line) && ctx.procStack.length > 0) {
|
|
58
|
+
ctx.procStack.pop();
|
|
59
|
+
ctx.currentProcKey =
|
|
60
|
+
ctx.procStack.length > 0
|
|
61
|
+
? String(ctx.procStack[ctx.procStack.length - 1])
|
|
62
|
+
: 'module';
|
|
103
63
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
const visibility = (0, text_utils_1.foldVisibility)(constDecl[1] ?? '');
|
|
135
|
-
const body = constDecl[2] ?? '';
|
|
136
|
-
const declarations = (0, text_utils_1.parseConstDeclarations)(body);
|
|
137
|
-
for (const declaration of declarations) {
|
|
138
|
-
const constName = declaration.name;
|
|
139
|
-
if (!constName)
|
|
140
|
-
continue;
|
|
141
|
-
// Issue #52: every Const line (module-level or proc-local)
|
|
142
|
-
// writes into a per-scope resolution bucket so
|
|
143
|
-
// `DoCmd.OpenForm FORM_X` later resolves correctly; module-level
|
|
144
|
-
// Consts additionally emit a `constant` graph node + the
|
|
145
|
-
// module→constant `contains` edge. Proc-local Consts skip both
|
|
146
|
-
// (the const is not a module symbol, so the wrong-containment
|
|
147
|
-
// node + edge the pre-fix code emitted are gone), but the
|
|
148
|
-
// per-proc bucket keeps OpenForm/OpenQuery argument
|
|
149
|
-
// resolution working exactly as before.
|
|
150
|
-
if (declaration.value !== null) {
|
|
151
|
-
ctx.setLocalConstInScope(ctx.currentProcKey, constName, declaration.value);
|
|
64
|
+
if (currentEnum) {
|
|
65
|
+
if (ENUM_END_RE.test(line)) {
|
|
66
|
+
currentEnum = null;
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
const mm = ENUM_MEMBER_RE.exec(line);
|
|
70
|
+
if (mm) {
|
|
71
|
+
const memberName = mm[1] ?? '';
|
|
72
|
+
if (memberName) {
|
|
73
|
+
const memberId = (0, tree_sitter_helpers_1.generateNodeId)(ctx.filePath, 'enum_member', memberName, lineNum);
|
|
74
|
+
ctx.nodes.push({
|
|
75
|
+
id: memberId,
|
|
76
|
+
kind: 'enum_member',
|
|
77
|
+
name: memberName,
|
|
78
|
+
qualifiedName: `${currentEnum.name}.${memberName}`,
|
|
79
|
+
filePath: ctx.filePath,
|
|
80
|
+
language: 'vba',
|
|
81
|
+
startLine: lineNum,
|
|
82
|
+
endLine: lineNum,
|
|
83
|
+
startColumn: 0,
|
|
84
|
+
endColumn: line.length,
|
|
85
|
+
updatedAt: Date.now(),
|
|
86
|
+
});
|
|
87
|
+
// enum → member: source is known, emit directly (not pending).
|
|
88
|
+
ctx.edges.push({
|
|
89
|
+
source: currentEnum.id,
|
|
90
|
+
target: memberId,
|
|
91
|
+
kind: 'contains',
|
|
92
|
+
});
|
|
93
|
+
}
|
|
152
94
|
}
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
const enumStart = ENUM_START_RE.exec(line);
|
|
98
|
+
if (enumStart) {
|
|
99
|
+
const visibility = (0, text_utils_1.foldVisibility)(enumStart[1] ?? '');
|
|
100
|
+
const name = enumStart[2] ?? '';
|
|
101
|
+
if (!name)
|
|
102
|
+
return;
|
|
103
|
+
const enumId = (0, tree_sitter_helpers_1.generateNodeId)(ctx.filePath, 'enum', name, lineNum);
|
|
156
104
|
ctx.nodes.push({
|
|
157
|
-
id:
|
|
158
|
-
kind: '
|
|
159
|
-
name
|
|
160
|
-
qualifiedName:
|
|
105
|
+
id: enumId,
|
|
106
|
+
kind: 'enum',
|
|
107
|
+
name,
|
|
108
|
+
qualifiedName: name,
|
|
161
109
|
filePath: ctx.filePath,
|
|
162
110
|
language: 'vba',
|
|
163
111
|
startLine: lineNum,
|
|
@@ -165,14 +113,88 @@ function sweepEnumsAndConsts(ctx, src) {
|
|
|
165
113
|
startColumn: 0,
|
|
166
114
|
endColumn: line.length,
|
|
167
115
|
visibility,
|
|
168
|
-
metadata: declaration.value !== null ? { value: declaration.value } : undefined,
|
|
169
116
|
updatedAt: Date.now(),
|
|
170
117
|
});
|
|
171
|
-
ctx.pushContainsFromModule(
|
|
172
|
-
|
|
118
|
+
ctx.pushContainsFromModule(enumId);
|
|
119
|
+
currentEnum = { id: enumId, name };
|
|
120
|
+
this.count++;
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
const constDecl = CONST_DECL_RE.exec(line);
|
|
124
|
+
if (constDecl) {
|
|
125
|
+
const visibility = (0, text_utils_1.foldVisibility)(constDecl[1] ?? '');
|
|
126
|
+
const body = constDecl[2] ?? '';
|
|
127
|
+
const declarations = (0, text_utils_1.parseConstDeclarations)(body);
|
|
128
|
+
for (const declaration of declarations) {
|
|
129
|
+
const constName = declaration.name;
|
|
130
|
+
if (!constName)
|
|
131
|
+
continue;
|
|
132
|
+
// Issue #52: every Const line (module-level or proc-local)
|
|
133
|
+
// writes into a per-scope resolution bucket so
|
|
134
|
+
// `DoCmd.OpenForm FORM_X` later resolves correctly; module-level
|
|
135
|
+
// Consts additionally emit a `constant` graph node + the
|
|
136
|
+
// module→constant `contains` edge. Proc-local Consts skip both
|
|
137
|
+
// (the const is not a module symbol, so the wrong-containment
|
|
138
|
+
// node + edge the pre-fix code emitted are gone), but the
|
|
139
|
+
// per-proc bucket keeps OpenForm/OpenQuery argument
|
|
140
|
+
// resolution working exactly as before.
|
|
141
|
+
if (declaration.value !== null) {
|
|
142
|
+
ctx.setLocalConstInScope(ctx.currentProcKey, constName, declaration.value);
|
|
143
|
+
}
|
|
144
|
+
if (ctx.procStack.length > 0)
|
|
145
|
+
continue;
|
|
146
|
+
const constId = (0, tree_sitter_helpers_1.generateNodeId)(ctx.filePath, 'constant', constName, lineNum);
|
|
147
|
+
ctx.nodes.push({
|
|
148
|
+
id: constId,
|
|
149
|
+
kind: 'constant',
|
|
150
|
+
name: constName,
|
|
151
|
+
qualifiedName: constName,
|
|
152
|
+
filePath: ctx.filePath,
|
|
153
|
+
language: 'vba',
|
|
154
|
+
startLine: lineNum,
|
|
155
|
+
endLine: lineNum,
|
|
156
|
+
startColumn: 0,
|
|
157
|
+
endColumn: line.length,
|
|
158
|
+
visibility,
|
|
159
|
+
metadata: declaration.value !== null ? { value: declaration.value } : undefined,
|
|
160
|
+
updatedAt: Date.now(),
|
|
161
|
+
});
|
|
162
|
+
ctx.pushContainsFromModule(constId);
|
|
163
|
+
this.count++;
|
|
164
|
+
}
|
|
173
165
|
}
|
|
166
|
+
},
|
|
167
|
+
};
|
|
168
|
+
// Issue #52: reset the shared scope stack + lookup key so leftover
|
|
169
|
+
// state from a previous extract() (impossible in production but
|
|
170
|
+
// possible in unit tests that construct a fresh extractor and run
|
|
171
|
+
// twice) never leaks across sweeps. The walk below updates both
|
|
172
|
+
// every iteration; `sweepCallsAndSql` resets again at its own
|
|
173
|
+
// start, before any OpenForm/OpenQuery reader consults them.
|
|
174
|
+
// We re-bind the classifier to call this reset at the start of
|
|
175
|
+
// its first invocation.
|
|
176
|
+
const originalClassify = cls.classifyLine;
|
|
177
|
+
let initialized = false;
|
|
178
|
+
cls.classifyLine = function (line, i, ctx) {
|
|
179
|
+
if (!initialized) {
|
|
180
|
+
ctx.procStack.length = 0;
|
|
181
|
+
ctx.currentProcKey = 'module';
|
|
182
|
+
initialized = true;
|
|
174
183
|
}
|
|
184
|
+
return originalClassify.call(this, line, i, ctx);
|
|
185
|
+
};
|
|
186
|
+
return cls;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Backward-compat wrapper (see procedures.ts). Returns the classifier's
|
|
190
|
+
* `count` so the orchestrator can decide `hasAnySymbols`.
|
|
191
|
+
*/
|
|
192
|
+
function sweepEnumsAndConsts(ctx, src) {
|
|
193
|
+
const cls = createEnumsConstsClassifier();
|
|
194
|
+
const lines = src.split('\n');
|
|
195
|
+
for (let i = 0; i < lines.length; i++) {
|
|
196
|
+
cls.classifyLine(lines[i] ?? '', i, ctx);
|
|
175
197
|
}
|
|
176
|
-
return count;
|
|
198
|
+
return cls.count;
|
|
177
199
|
}
|
|
178
200
|
//# 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":";;AAwCA,kEAiKC;AAMD,kDAOC;AAtND;;;;;GAKG;AACH,gEAAwD;AACxD,2CAAwD;AACxD,6CAAsE;AAGtE,wDAAwD;AACxD,MAAM,aAAa,GACjB,0EAA0E,CAAC;AAE7E,kDAAkD;AAClD,MAAM,WAAW,GAAG,mBAAmB,CAAC;AAExC;;;;;GAKG;AACH,MAAM,cAAc,GAAG,sCAAsC,CAAC;AAE9D,+EAA+E;AAC/E,MAAM,aAAa,GACjB,0DAA0D,CAAC;AAE7D;;;;;;;;;GASG;AACH,SAAgB,2BAA2B;IACzC,IAAI,WAAW,GAAwC,IAAI,CAAC;IAC5D,MAAM,GAAG,GAAkB;QACzB,IAAI,EAAE,aAAa;QACnB,KAAK,EAAE,CAAC;QACR,YAAY,CAAC,IAAI,EAAE,CAAC,EAAE,GAAG;YACvB,MAAM,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC;YAEtB,iEAAiE;YACjE,+DAA+D;YAC/D,iEAAiE;YACjE,2DAA2D;YAC3D,EAAE;YACF,iEAAiE;YACjE,kEAAkE;YAClE,4DAA4D;YAC5D,MAAM,SAAS,GAAG,mBAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACrC,IAAI,SAAS,EAAE,CAAC;gBACd,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;gBAC5B,GAAG,CAAC,cAAc,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;YACvC,CAAC;iBAAM,IAAI,4BAAgB,CAAC,IAAI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AAC,CAAC,IAAI,EAAE,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC;IAC3C,CAAC;IACD,OAAO,GAAG,CAAC,KAAK,CAAC;AACnB,CAAC"}
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
-
import { VbaExtractorContext } from './context';
|
|
1
|
+
import { VbaExtractorContext, VbaClassifier } from './context';
|
|
2
|
+
/**
|
|
3
|
+
* Issue #83: factory for the `Implements` classifier. Stateless per-line.
|
|
4
|
+
*/
|
|
5
|
+
export declare function createImplementsClassifier(): VbaClassifier;
|
|
6
|
+
/**
|
|
7
|
+
* Backward-compat wrapper (see procedures.ts). Returns the classifier's
|
|
8
|
+
* `count` so the orchestrator can decide `hasAnySymbols`.
|
|
9
|
+
*/
|
|
2
10
|
export declare function sweepImplements(ctx: VbaExtractorContext, src: string): number;
|
|
3
11
|
//# sourceMappingURL=implements.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"implements.d.ts","sourceRoot":"","sources":["../../../src/extraction/vba/implements.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"implements.d.ts","sourceRoot":"","sources":["../../../src/extraction/vba/implements.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAK/D;;GAEG;AACH,wBAAgB,0BAA0B,IAAI,aAAa,CA+C1D;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,mBAAmB,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAO7E"}
|
|
@@ -1,52 +1,68 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createImplementsClassifier = createImplementsClassifier;
|
|
3
4
|
exports.sweepImplements = sweepImplements;
|
|
4
5
|
const tree_sitter_helpers_1 = require("../tree-sitter-helpers");
|
|
5
6
|
/** Implements regex. */
|
|
6
7
|
const IMPLEMENTS_RE = /^\s*Implements\s+(\p{L}[\p{L}\p{N}_]*)/iu;
|
|
8
|
+
/**
|
|
9
|
+
* Issue #83: factory for the `Implements` classifier. Stateless per-line.
|
|
10
|
+
*/
|
|
11
|
+
function createImplementsClassifier() {
|
|
12
|
+
return {
|
|
13
|
+
name: 'implements',
|
|
14
|
+
count: 0,
|
|
15
|
+
classifyLine(line, i, ctx) {
|
|
16
|
+
const m = IMPLEMENTS_RE.exec(line);
|
|
17
|
+
if (!m)
|
|
18
|
+
return;
|
|
19
|
+
const name = m[1] ?? '';
|
|
20
|
+
if (!name)
|
|
21
|
+
return;
|
|
22
|
+
const lineNum = i + 1;
|
|
23
|
+
const targetId = (0, tree_sitter_helpers_1.generateNodeId)(ctx.filePath, 'interface', name, lineNum);
|
|
24
|
+
ctx.nodes.push({
|
|
25
|
+
id: targetId,
|
|
26
|
+
kind: 'interface',
|
|
27
|
+
name,
|
|
28
|
+
qualifiedName: name,
|
|
29
|
+
filePath: ctx.filePath,
|
|
30
|
+
language: 'vba',
|
|
31
|
+
startLine: lineNum,
|
|
32
|
+
endLine: lineNum,
|
|
33
|
+
startColumn: 0,
|
|
34
|
+
endColumn: line.length,
|
|
35
|
+
updatedAt: Date.now(),
|
|
36
|
+
});
|
|
37
|
+
const edge = {
|
|
38
|
+
source: '', // placeholder; rewritten after module node exists
|
|
39
|
+
target: targetId,
|
|
40
|
+
kind: 'implements',
|
|
41
|
+
// S4 fix: `Implements IFoo` is a static, source-declared fact —
|
|
42
|
+
// not a guess. Use the `parser` provenance (generalizes
|
|
43
|
+
// `tree-sitter` for non-tree-sitter extractors like our regex
|
|
44
|
+
// sweepers) instead of `heuristic`, which is reserved for
|
|
45
|
+
// guessed/inferred edges.
|
|
46
|
+
provenance: 'parser',
|
|
47
|
+
line: lineNum,
|
|
48
|
+
column: 0,
|
|
49
|
+
};
|
|
50
|
+
ctx.edges.push(edge);
|
|
51
|
+
ctx.pendingModuleOrClassSource.push(edge);
|
|
52
|
+
this.count++;
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Backward-compat wrapper (see procedures.ts). Returns the classifier's
|
|
58
|
+
* `count` so the orchestrator can decide `hasAnySymbols`.
|
|
59
|
+
*/
|
|
7
60
|
function sweepImplements(ctx, src) {
|
|
61
|
+
const cls = createImplementsClassifier();
|
|
8
62
|
const lines = src.split('\n');
|
|
9
|
-
let count = 0;
|
|
10
63
|
for (let i = 0; i < lines.length; i++) {
|
|
11
|
-
|
|
12
|
-
const m = IMPLEMENTS_RE.exec(line);
|
|
13
|
-
if (!m)
|
|
14
|
-
continue;
|
|
15
|
-
const name = m[1] ?? '';
|
|
16
|
-
if (!name)
|
|
17
|
-
continue;
|
|
18
|
-
const lineNum = i + 1;
|
|
19
|
-
const targetId = (0, tree_sitter_helpers_1.generateNodeId)(ctx.filePath, 'interface', name, lineNum);
|
|
20
|
-
ctx.nodes.push({
|
|
21
|
-
id: targetId,
|
|
22
|
-
kind: 'interface',
|
|
23
|
-
name,
|
|
24
|
-
qualifiedName: name,
|
|
25
|
-
filePath: ctx.filePath,
|
|
26
|
-
language: 'vba',
|
|
27
|
-
startLine: lineNum,
|
|
28
|
-
endLine: lineNum,
|
|
29
|
-
startColumn: 0,
|
|
30
|
-
endColumn: line.length,
|
|
31
|
-
updatedAt: Date.now(),
|
|
32
|
-
});
|
|
33
|
-
const edge = {
|
|
34
|
-
source: '', // placeholder; rewritten after module node exists
|
|
35
|
-
target: targetId,
|
|
36
|
-
kind: 'implements',
|
|
37
|
-
// S4 fix: `Implements IFoo` is a static, source-declared fact —
|
|
38
|
-
// not a guess. Use the `parser` provenance (generalizes
|
|
39
|
-
// `tree-sitter` for non-tree-sitter extractors like our regex
|
|
40
|
-
// sweepers) instead of `heuristic`, which is reserved for
|
|
41
|
-
// guessed/inferred edges.
|
|
42
|
-
provenance: 'parser',
|
|
43
|
-
line: lineNum,
|
|
44
|
-
column: 0,
|
|
45
|
-
};
|
|
46
|
-
ctx.edges.push(edge);
|
|
47
|
-
ctx.pendingModuleOrClassSource.push(edge);
|
|
48
|
-
count++;
|
|
64
|
+
cls.classifyLine(lines[i] ?? '', i, ctx);
|
|
49
65
|
}
|
|
50
|
-
return count;
|
|
66
|
+
return cls.count;
|
|
51
67
|
}
|
|
52
68
|
//# sourceMappingURL=implements.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"implements.js","sourceRoot":"","sources":["../../../src/extraction/vba/implements.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"implements.js","sourceRoot":"","sources":["../../../src/extraction/vba/implements.ts"],"names":[],"mappings":";;AAeA,gEA+CC;AAMD,0CAOC;AArED,gEAAwD;AAGxD,wBAAwB;AACxB,MAAM,aAAa,GAAG,0CAA0C,CAAC;AAEjE;;GAEG;AACH,SAAgB,0BAA0B;IACxC,OAAO;QACL,IAAI,EAAE,YAAY;QAClB,KAAK,EAAE,CAAC;QACR,YAAY,CAAC,IAAI,EAAE,CAAC,EAAE,GAAG;YACvB,MAAM,CAAC,GAAG,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACnC,IAAI,CAAC,CAAC;gBAAE,OAAO;YACf,MAAM,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;YACxB,IAAI,CAAC,IAAI;gBAAE,OAAO;YAClB,MAAM,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC;YACtB,MAAM,QAAQ,GAAG,IAAA,oCAAc,EAC7B,GAAG,CAAC,QAAQ,EACZ,WAAW,EACX,IAAI,EACJ,OAAO,CACR,CAAC;YACF,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC;gBACb,EAAE,EAAE,QAAQ;gBACZ,IAAI,EAAE,WAAW;gBACjB,IAAI;gBACJ,aAAa,EAAE,IAAI;gBACnB,QAAQ,EAAE,GAAG,CAAC,QAAQ;gBACtB,QA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**
|
|
3
|
+
* Issue #83: factory for the procedures classifier. Closure state: none
|
|
4
|
+
* beyond `count` (the per-concern accumulators live on `ctx`).
|
|
5
|
+
*/
|
|
6
|
+
export declare function createProceduresClassifier(): VbaClassifier;
|
|
7
|
+
/**
|
|
8
|
+
* Backward-compat wrapper: pre-#83 callers (e.g. legacy test fixtures)
|
|
9
|
+
* used `sweepProcedures(ctx, src)` and got back the ProcInfo[].
|
|
10
|
+
* Now it returns `ctx.procedures` (the same flat list the factory
|
|
11
|
+
* appends to). The implementation still calls the classifier once per
|
|
12
|
+
* pre-split line, so the count is identical to the new walker path.
|
|
13
|
+
*/
|
|
2
14
|
export declare function sweepProcedures(ctx: VbaExtractorContext, src: string): ProcInfo[];
|
|
3
15
|
//# sourceMappingURL=procedures.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"procedures.d.ts","sourceRoot":"","sources":["../../../src/extraction/vba/procedures.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"procedures.d.ts","sourceRoot":"","sources":["../../../src/extraction/vba/procedures.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,mBAAmB,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAmBzE;;;GAGG;AACH,wBAAgB,0BAA0B,IAAI,aAAa,CAqN1D;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,mBAAmB,EAAE,GAAG,EAAE,MAAM,GAAG,QAAQ,EAAE,CAOjF"}
|