Context
The VBA extraction pipeline preprocesses source before the regex sweeps run. Order (src/extraction/vba-extractor.ts:125-127):
const joined = joinLineContinuations(this.source);
const preprocessed = preprocessConditionalCompilation(joined);
const uncommented = stripVbaComments(preprocessed);
Problem
joinLineContinuations (src/extraction/vba-preprocess.ts:54-64) does not actually join continuation lines. Its regex
return src.replace(/ _(?:(\r?\n)|$)/g, (_m, nl) => ' ' + (nl ?? ''));
replaces _ with a single space but preserves the newline (deliberately, to keep line-count parity so downstream startLine = i + 1 math stays correct — see the doc comment at :56-60). The consequence: a VBA statement split across multiple physical lines with the _ continuation is left as separate physical lines, and the regex sweeps only ever see its first fragment.
This is acknowledged as a known gap: src/extraction/vba-extractor.ts:2807 — "Cross-physical-line concat via _ continuation is OUT OF SCOPE."
Impact
Any symbol or call whose defining tokens spill past the first physical line is under-parsed or missed:
Public Declare PtrSafe Function GetTickCount _
Lib "kernel32" () As Long ' Lib/alias metadata on line 2 is not seen
modUtils.RegistrarEvento _
strUsuario, strAccion ' the call args on line 2 are not seen
Public Sub Procesar( _
ByVal a As Long, _
ByVal b As Long) ' params on continuation lines are not seen
Machine-generated Dysflow exports rarely wrap, so this is low-frequency there — but hand-written VBA that wraps long signatures/calls/SQL loses graph coverage silently, which defeats impact analysis on exactly the kind of code humans write.
Secondary: the function name joinLineContinuations is misleading — it strips, it does not join.
Proposed Approach
Implement real logical-line reassembly while preserving accurate line numbers:
- Build a logical source where a line ending in
_ is concatenated with the following physical line(s) into one logical line.
- Maintain a line map: logical-line index → the physical
startLine of its first fragment, so every node/edge startLine still points at the original physical line the statement began on.
- Feed the sweeps the logical lines but resolve
startLine through the map.
- Keep string-literal safety: a
_ that is genuinely the last non-space chars of a physical line is a continuation in VBA regardless of string state (documented at :48-52), so the existing string-agnostic detection is acceptable — but add a test asserting a string that ends ..._" (quote after underscore) is NOT touched.
- Rename
joinLineContinuations → something honest, or make it actually join. If renamed, update vba-extractor.ts and __tests__/extraction-vba-preprocess.test.ts.
Acceptance Criteria
Testing
npm run build
npx vitest run __tests__/extraction-vba-preprocess.test.ts __tests__/extraction-vba.test.ts
npm test
Out of Scope
- Concatenating string literals split across lines for SQL-table extraction beyond what reassembly naturally enables (can be a follow-up).
Context
The VBA extraction pipeline preprocesses source before the regex sweeps run. Order (
src/extraction/vba-extractor.ts:125-127):Problem
joinLineContinuations(src/extraction/vba-preprocess.ts:54-64) does not actually join continuation lines. Its regexreplaces
_with a single space but preserves the newline (deliberately, to keep line-count parity so downstreamstartLine = i + 1math stays correct — see the doc comment at:56-60). The consequence: a VBA statement split across multiple physical lines with the_continuation is left as separate physical lines, and the regex sweeps only ever see its first fragment.This is acknowledged as a known gap:
src/extraction/vba-extractor.ts:2807— "Cross-physical-line concat via_continuation is OUT OF SCOPE."Impact
Any symbol or call whose defining tokens spill past the first physical line is under-parsed or missed:
Machine-generated Dysflow exports rarely wrap, so this is low-frequency there — but hand-written VBA that wraps long signatures/calls/SQL loses graph coverage silently, which defeats impact analysis on exactly the kind of code humans write.
Secondary: the function name
joinLineContinuationsis misleading — it strips, it does not join.Proposed Approach
Implement real logical-line reassembly while preserving accurate line numbers:
_is concatenated with the following physical line(s) into one logical line.startLineof its first fragment, so every node/edgestartLinestill points at the original physical line the statement began on.startLinethrough the map._that is genuinely the last non-space chars of a physical line is a continuation in VBA regardless of string state (documented at:48-52), so the existing string-agnostic detection is acceptable — but add a test asserting a string that ends..._"(quote after underscore) is NOT touched.joinLineContinuations→ something honest, or make it actually join. If renamed, updatevba-extractor.tsand__tests__/extraction-vba-preprocess.test.ts.Acceptance Criteria
Declarereassembles:Lib/alias/PtrSafemetadata is captured from continuation lines.modUtils.Foo _ \n arg1, arg2) resolves to the same edge as its single-line form.Sub/Functionsignature captures all parameters.startLineof its first fragment (regression-guard the line numbers explicitly).extraction-vba-preprocess.test.tsstays green (or is updated only for the rename).__tests__/extraction-vba-preprocess.test.tscover: continuation in aDeclare, a call, aSubsignature, and the string-ending-in-_"non-case.Testing
npm run build npx vitest run __tests__/extraction-vba-preprocess.test.ts __tests__/extraction-vba.test.ts npm testOut of Scope