@aroman22/codegraph-vba 1.5.1 → 1.6.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/README.md +1 -1
- package/dist/bin/codegraph.d.ts +1 -1
- package/dist/bin/command-supervision.d.ts +38 -1
- package/dist/db/index.d.ts +84 -5
- package/dist/db/migrations.d.ts +1 -1
- package/dist/db/queries.d.ts +127 -4
- package/dist/db/wal-valve.d.ts +106 -0
- package/dist/directory.d.ts +9 -5
- package/dist/extraction/cfml-extractor.d.ts +107 -0
- package/dist/extraction/grammars.d.ts +25 -1
- package/dist/extraction/index.d.ts +47 -2
- package/dist/extraction/languages/arkts.d.ts +3 -0
- package/dist/extraction/languages/c-cpp.d.ts +98 -0
- package/dist/extraction/languages/cfquery.d.ts +12 -0
- package/dist/extraction/languages/cfscript.d.ts +3 -0
- package/dist/extraction/languages/cobol.d.ts +33 -0
- package/dist/extraction/languages/erlang.d.ts +3 -0
- package/dist/extraction/languages/nix.d.ts +3 -0
- package/dist/extraction/languages/solidity.d.ts +3 -0
- package/dist/extraction/languages/terraform.d.ts +3 -0
- package/dist/extraction/languages/vbnet.d.ts +11 -0
- package/dist/extraction/mybatis-extractor.d.ts +30 -10
- package/dist/extraction/parse-pool.d.ts +28 -1
- package/dist/extraction/tree-sitter-types.d.ts +20 -1
- package/dist/extraction/tree-sitter.d.ts +60 -1
- package/dist/extraction/vba/call-sweep.d.ts +3 -0
- package/dist/extraction/vba/calls.d.ts +55 -0
- package/dist/extraction/vba/constants.d.ts +42 -0
- package/dist/extraction/vba/context.d.ts +175 -0
- package/dist/extraction/vba/controls.d.ts +24 -0
- package/dist/extraction/vba/declarations.d.ts +3 -0
- package/dist/extraction/vba/dims.d.ts +3 -0
- package/dist/extraction/vba/docmd.d.ts +16 -0
- package/dist/extraction/vba/enums-consts.d.ts +15 -0
- package/dist/extraction/vba/implements.d.ts +3 -0
- package/dist/extraction/vba/procedures.d.ts +3 -0
- package/dist/extraction/vba/sql-wrapper.d.ts +17 -0
- package/dist/extraction/vba/tempvars.d.ts +10 -0
- package/dist/extraction/vba/text-utils.d.ts +73 -0
- package/dist/extraction/vba-extractor.d.ts +3 -951
- package/dist/extraction/vba-preprocess.d.ts +1 -1
- package/dist/index.d.ts +81 -1
- package/dist/installer/index.d.ts +42 -0
- package/dist/mcp/daemon.d.ts +35 -3
- package/dist/mcp/early-ppid.d.ts +26 -0
- package/dist/mcp/liveness-watchdog.d.ts +18 -1
- package/dist/mcp/query-pool.d.ts +14 -0
- package/dist/mcp/session.d.ts +14 -0
- package/dist/mcp/startup-handshake.d.ts +44 -0
- package/dist/mcp/tools.d.ts +22 -0
- package/dist/project-config.d.ts +44 -0
- package/dist/resolution/c-fnptr-synthesizer.d.ts +2 -1
- package/dist/resolution/callback-synthesizer.d.ts +1 -1
- package/dist/resolution/cooperative-yield.d.ts +32 -0
- package/dist/resolution/frameworks/cics.d.ts +20 -0
- package/dist/resolution/frameworks/terraform.d.ts +38 -0
- package/dist/resolution/goframe-synthesizer.d.ts +2 -1
- package/dist/resolution/import-resolver.d.ts +7 -0
- package/dist/resolution/index.d.ts +85 -2
- package/dist/resolution/name-matcher.d.ts +22 -3
- package/dist/resolution/strip-comments.d.ts +1 -1
- package/dist/resolution/types.d.ts +29 -0
- package/dist/resolution/workspace-packages.d.ts +10 -0
- package/dist/search/identifier-segments.d.ts +60 -0
- package/dist/sync/watcher.d.ts +10 -5
- package/dist/sync/worktree.d.ts +9 -0
- package/dist/types.d.ts +25 -2
- package/dist/upgrade/index.d.ts +32 -0
- package/dist/upgrade/remove-binary.d.ts +87 -0
- package/dist/upgrade/update-check.d.ts +92 -0
- package/npm-shim.js +32 -3
- package/package.json +7 -7
- package/dist/reasoning/config.d.ts +0 -45
- package/dist/reasoning/credentials.d.ts +0 -5
- package/dist/reasoning/login.d.ts +0 -21
- package/dist/reasoning/reasoner.d.ts +0 -43
|
@@ -28,6 +28,15 @@ export declare function isSourceFile(filePath: string, overrides?: Record<string
|
|
|
28
28
|
* extractor links them. (config/ + locales/ JSON have no section refs.)
|
|
29
29
|
*/
|
|
30
30
|
export declare function isShopifyLiquidJson(filePath: string): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* OTP application resource file: `<app>.app.src` (checked into every rebar3/
|
|
33
|
+
* erlang.mk app) or its compiled `<app>.app`. Erlang TERMS, not forms — the
|
|
34
|
+
* grammar parses them as top-level expressions, and the Erlang extractor's
|
|
35
|
+
* application-tuple handler turns `{mod, {Mod, _}}` and `{applications, […]}`
|
|
36
|
+
* into entry-module and dependency edges. Routed by full suffix because the
|
|
37
|
+
* last-dot extension (`.src`) is far too generic for EXTENSION_MAP.
|
|
38
|
+
*/
|
|
39
|
+
export declare function isErlangAppFile(filePath: string): boolean;
|
|
31
40
|
/**
|
|
32
41
|
* Play Framework routes file: the extensionless `conf/routes` (and included
|
|
33
42
|
* `conf/*.routes`). No grammar — route extraction is done by the Play framework
|
|
@@ -54,12 +63,27 @@ export declare function detectVbaFormFile(filePath: string): boolean;
|
|
|
54
63
|
* Idempotent — safe to call multiple times.
|
|
55
64
|
*/
|
|
56
65
|
export declare function initGrammars(): Promise<void>;
|
|
66
|
+
/**
|
|
67
|
+
* Pre-read the grammar WASM bytes for an index set, keyed by language. The
|
|
68
|
+
* orchestrator reads each grammar ONCE and hands the bytes to every parse
|
|
69
|
+
* worker via its `load-grammars` message, so worker spawns/respawns load
|
|
70
|
+
* grammars from memory instead of re-reading them from disk — on slow storage
|
|
71
|
+
* (HDD, issue #1231) each respawn's grammar re-read otherwise amplifies the
|
|
72
|
+
* I/O contention that caused the respawn. Best-effort: a language whose WASM
|
|
73
|
+
* can't be read here is simply omitted, and the worker falls back to its own
|
|
74
|
+
* disk load (which surfaces the real error/warning path).
|
|
75
|
+
*/
|
|
76
|
+
export declare function readGrammarWasmBytes(languages: Language[]): Promise<Record<string, Uint8Array>>;
|
|
57
77
|
/**
|
|
58
78
|
* Load grammar WASM files for specific languages only.
|
|
59
79
|
* Skips languages that are already loaded or have no WASM grammar.
|
|
60
80
|
* Must be called after initGrammars().
|
|
81
|
+
*
|
|
82
|
+
* `wasmBytes` (optional) holds pre-read grammar bytes keyed by language (from
|
|
83
|
+
* {@link readGrammarWasmBytes}, forwarded through the parse pool); when a
|
|
84
|
+
* language's bytes are present they're loaded from memory instead of disk.
|
|
61
85
|
*/
|
|
62
|
-
export declare function loadGrammarsForLanguages(languages: Language[]): Promise<void>;
|
|
86
|
+
export declare function loadGrammarsForLanguages(languages: Language[], wasmBytes?: Record<string, Uint8Array>): Promise<void>;
|
|
63
87
|
/**
|
|
64
88
|
* Load ALL grammar WASM files. Convenience function for tests and
|
|
65
89
|
* backward compatibility. Prefer loadGrammarsForLanguages() in production.
|
|
@@ -24,6 +24,14 @@ export interface IndexResult {
|
|
|
24
24
|
filesIndexed: number;
|
|
25
25
|
filesSkipped: number;
|
|
26
26
|
filesErrored: number;
|
|
27
|
+
/**
|
|
28
|
+
* How many indexable files the scan discovered — the ground truth the
|
|
29
|
+
* indexed/skipped/errored tallies must add up to. A shortfall means files
|
|
30
|
+
* were silently dropped mid-pipeline (e.g. a killed worker under load) and
|
|
31
|
+
* the index is PARTIAL; callers surface that rather than trusting the
|
|
32
|
+
* counts. Only set by full-index runs (indexAll), not indexFiles/sync.
|
|
33
|
+
*/
|
|
34
|
+
filesDiscovered?: number;
|
|
27
35
|
nodesCreated: number;
|
|
28
36
|
edgesCreated: number;
|
|
29
37
|
errors: ExtractionError[];
|
|
@@ -72,6 +80,17 @@ export declare class ScopeIgnore {
|
|
|
72
80
|
* exclude applies even to tracked files and even inside embedded repos.
|
|
73
81
|
*/
|
|
74
82
|
private exclude;
|
|
83
|
+
/**
|
|
84
|
+
* Project `codegraph.json` `include` patterns — first-party source forced
|
|
85
|
+
* INTO the index despite `.gitignore`. When a path matches, it is NOT
|
|
86
|
+
* ignored (so the watcher watches it), overriding `.gitignore`/`rootMatcher`
|
|
87
|
+
* — but never `exclude` (checked first) and never a built-in default-ignored
|
|
88
|
+
* dir. `includeRoots` are the static prefixes so a gitignored ANCESTOR
|
|
89
|
+
* directory of an included subtree still isn't pruned by the directory
|
|
90
|
+
* walker/watcher.
|
|
91
|
+
*/
|
|
92
|
+
private include;
|
|
93
|
+
private includeRoots;
|
|
75
94
|
private embedded;
|
|
76
95
|
private defaults;
|
|
77
96
|
constructor(rootMatcher: Ignore, embedded: Array<{
|
|
@@ -83,7 +102,17 @@ export declare class ScopeIgnore {
|
|
|
83
102
|
* full root-relative path. Wins over everything else — an explicit user
|
|
84
103
|
* exclude applies even to tracked files and even inside embedded repos.
|
|
85
104
|
*/
|
|
86
|
-
exclude?: Ignore | null
|
|
105
|
+
exclude?: Ignore | null,
|
|
106
|
+
/**
|
|
107
|
+
* Project `codegraph.json` `include` patterns — first-party source forced
|
|
108
|
+
* INTO the index despite `.gitignore`. When a path matches, it is NOT
|
|
109
|
+
* ignored (so the watcher watches it), overriding `.gitignore`/`rootMatcher`
|
|
110
|
+
* — but never `exclude` (checked first) and never a built-in default-ignored
|
|
111
|
+
* dir. `includeRoots` are the static prefixes so a gitignored ANCESTOR
|
|
112
|
+
* directory of an included subtree still isn't pruned by the directory
|
|
113
|
+
* walker/watcher.
|
|
114
|
+
*/
|
|
115
|
+
include?: Ignore | null, includeRoots?: string[]);
|
|
87
116
|
ignores(rel: string): boolean;
|
|
88
117
|
}
|
|
89
118
|
/**
|
|
@@ -102,6 +131,22 @@ export declare function buildScopeIgnore(rootDir: string, embeddedRoots?: Iterab
|
|
|
102
131
|
* there already.
|
|
103
132
|
*/
|
|
104
133
|
export declare function discoverEmbeddedRepoRoots(rootDir: string): string[];
|
|
134
|
+
/**
|
|
135
|
+
* The INVERSE of the gitignored side of {@link discoverEmbeddedRepoRoots}:
|
|
136
|
+
* nested git repositories under a gitignored directory that the project has NOT
|
|
137
|
+
* opted into via `codegraph.json` `includeIgnored`. These are real repos the
|
|
138
|
+
* default `init`/`index` deliberately skips because `.gitignore` excludes them
|
|
139
|
+
* (#970, #976) — most visibly the "super-repo `.gitignore`s its child repos"
|
|
140
|
+
* layout (#1156), where `init` at the parent correctly indexes ~nothing while
|
|
141
|
+
* `init` inside each child works. The CLI uses this to turn that silent empty
|
|
142
|
+
* index into an actionable hint: it names the skipped repos and offers to opt
|
|
143
|
+
* them in. Paths are `rootDir`-relative and trailing-slashed (valid
|
|
144
|
+
* `includeIgnored` patterns as-is). Returns `[]` for a non-git root (a
|
|
145
|
+
* filesystem walk already descends into nested repos there), skips built-in
|
|
146
|
+
* default-ignored dirs (`node_modules`, …), and is bounded so it never stalls
|
|
147
|
+
* on a giant ignored tree.
|
|
148
|
+
*/
|
|
149
|
+
export declare function findUnindexedIgnoredRepos(rootDir: string): string[];
|
|
105
150
|
/**
|
|
106
151
|
* Recursively scan a directory for source files.
|
|
107
152
|
*
|
|
@@ -145,7 +190,7 @@ export declare class ExtractionOrchestrator {
|
|
|
145
190
|
/**
|
|
146
191
|
* Index all files in the project
|
|
147
192
|
*/
|
|
148
|
-
indexAll(onProgress?: (progress: IndexProgress) => void, signal?: AbortSignal, verbose?: boolean): Promise<IndexResult>;
|
|
193
|
+
indexAll(onProgress?: (progress: IndexProgress) => void, signal?: AbortSignal, verbose?: boolean, walBackpressure?: () => Promise<void> | null): Promise<IndexResult>;
|
|
149
194
|
/**
|
|
150
195
|
* Index specific files
|
|
151
196
|
*/
|
|
@@ -7,6 +7,104 @@ import type { LanguageExtractor } from '../tree-sitter-types';
|
|
|
7
7
|
* template args. Returns undefined for primitives / void / `auto` / empty.
|
|
8
8
|
*/
|
|
9
9
|
export declare function normalizeCppReturnType(raw: string): string | undefined;
|
|
10
|
+
/**
|
|
11
|
+
* Strip C++ template arguments from a base-type reference name so it matches the
|
|
12
|
+
* bare class/struct the template was DEFINED as. `template<typename T> class
|
|
13
|
+
* Base { … }` is indexed as a node named `Base`, but a derived class
|
|
14
|
+
* `class D : public Base<int>` records its base as the full `Base<int>` (and
|
|
15
|
+
* `class Q : public ns::Tpl<int>` as `ns::Tpl<int>`) — neither name-matches
|
|
16
|
+
* `Base` / `ns::Tpl`, so the `extends` edge never resolves and the derived class
|
|
17
|
+
* looks like it inherits from nothing (#1043).
|
|
18
|
+
*
|
|
19
|
+
* Removes every balanced `<…>` group regardless of nesting or position, so
|
|
20
|
+
* `Base<int>` → `Base`, `ns::Tpl<Foo<int>>` → `ns::Tpl`, and the rare
|
|
21
|
+
* `Outer<int>::Inner` → `Outer::Inner`. The remaining qualified head is exactly
|
|
22
|
+
* what the non-templated base case already produces, so resolution treats them
|
|
23
|
+
* identically. A name with no template args passes through unchanged.
|
|
24
|
+
*/
|
|
25
|
+
export declare function stripCppTemplateArgs(name: string): string;
|
|
10
26
|
export declare const cExtractor: LanguageExtractor;
|
|
27
|
+
/**
|
|
28
|
+
* Blank an export/visibility macro in a `class/struct EXPORT_MACRO Name …`
|
|
29
|
+
* *definition* header before parsing. Not knowing the macro, tree-sitter reads
|
|
30
|
+
* `class EXPORT_MACRO` as an elaborated type specifier and the rest as a
|
|
31
|
+
* function, so the whole class — its name, base clause, and members — drops out
|
|
32
|
+
* of the index (#946 catches the resulting phantom function but can't recover
|
|
33
|
+
* the class), which silently breaks type-hierarchy / inheritance-impact queries
|
|
34
|
+
* for effectively every Unreal-Engine (`*_API`), Qt/Boost (`*_EXPORT`), LLVM
|
|
35
|
+
* (`*_ABI`), … class. Replacing the macro with equal-length spaces preserves
|
|
36
|
+
* every byte offset (and thus line/column), so the declaration then parses as a
|
|
37
|
+
* normal class_specifier and the existing extraction emits the node, members,
|
|
38
|
+
* and `extends` edge. (#1061, follow-up to #946.)
|
|
39
|
+
*
|
|
40
|
+
* Matched tightly so it can't touch the same macro used as an ordinary value
|
|
41
|
+
* elsewhere (`int x = SOME_API;`): the macro is the ALL-CAPS token sitting
|
|
42
|
+
* *between* `class`/`struct` and the type name, and the trailing `[:{]`
|
|
43
|
+
* definition-guard fires only when a base clause or body follows — the only
|
|
44
|
+
* shape that misparses. That guard also leaves elaborated-type variable
|
|
45
|
+
* declarations (`struct FOO var;`, `class FOO obj = …`) untouched, since those
|
|
46
|
+
* end in `;` / `=` / `[`, never `:` / `{`. C++-only (wired into cppExtractor),
|
|
47
|
+
* so C's heavier use of `struct TAG var;` never reaches it.
|
|
48
|
+
*/
|
|
49
|
+
export declare function blankCppExportMacros(source: string): string;
|
|
50
|
+
export declare function blankCppInlineMacros(source: string): string;
|
|
51
|
+
/**
|
|
52
|
+
* Universal fallback (any macro, no list) for a C/C++ function name still mangled
|
|
53
|
+
* because a macro we don't blank sat in front of the return type: `MACRO Ret
|
|
54
|
+
* name(…)` / `Ret MACRO name(…)` misparse so the return type is glued onto the
|
|
55
|
+
* name ("Ret name", "char_t* to_str(double v)"). Recover the real identifier —
|
|
56
|
+
* the token immediately before the parameter list (or the last token). This runs
|
|
57
|
+
* AFTER the curated pre-parse blank, so it only ever sees the residual tail that
|
|
58
|
+
* blanking didn't already fix cleanly (which also recovers the return type).
|
|
59
|
+
*
|
|
60
|
+
* Safe by construction: only touches an ALREADY-mangled name — one with an
|
|
61
|
+
* internal space that isn't a legit `operator …`/destructor — so a well-formed
|
|
62
|
+
* name is returned unchanged. Guarded against the two ways it could mis-pick:
|
|
63
|
+
* the `Ret (name)` parenthesized-name idiom (left as-is, ambiguous), and a token
|
|
64
|
+
* that is a bare primitive/keyword rather than a real identifier.
|
|
65
|
+
*/
|
|
66
|
+
export declare function recoverMangledCppName(name: string): string;
|
|
67
|
+
export declare function blankMetalAttributes(source: string): string;
|
|
68
|
+
/**
|
|
69
|
+
* Blank annotation-style macro invocations that decorate a declaration but carry
|
|
70
|
+
* NO terminating semicolon — the pervasive Unreal-Engine reflection markup
|
|
71
|
+
* (`UPROPERTY(...)`, `UFUNCTION(...)`, `UCLASS(...)`, `GENERATED_BODY()`,
|
|
72
|
+
* `UE_DEPRECATED_FORGAME(...)`, `DECLARE_DELEGATE_*(...)`, …) that sits on its
|
|
73
|
+
* own line right before a member/type. tree-sitter's C++ grammar doesn't know
|
|
74
|
+
* these are macros, so each one drops into error recovery; in a big reflected
|
|
75
|
+
* class (`CharacterMovementComponent.h` has ~240 of them) the errors accumulate
|
|
76
|
+
* until the enclosing `class_specifier` can't close and collapses into an ERROR
|
|
77
|
+
* node — the whole class definition, its members, and its `extends` edges vanish
|
|
78
|
+
* from the graph. Neither `blankCppExportMacros` (class-header export macros) nor
|
|
79
|
+
* `blankCppInlineMacros` (return-type inline specifiers) touches these in-body
|
|
80
|
+
* markup macros. Replacing each with equal-length spaces preserves every byte
|
|
81
|
+
* offset (so line/column stay exact) and the class then parses normally.
|
|
82
|
+
*
|
|
83
|
+
* Deliberately name-list-FREE — UE alone has hundreds of such macros and projects
|
|
84
|
+
* add their own — so it keys on structure, not a curated list, matched tightly to
|
|
85
|
+
* avoid touching legitimate C++:
|
|
86
|
+
* - the macro must be the FIRST non-whitespace token on its line (`^[ \t]*`),
|
|
87
|
+
* which is where declaration markup lives — so a macro used inside an
|
|
88
|
+
* expression or condition (`if (CHECK(x))`, `x = MACRO(a) + b`) is never
|
|
89
|
+
* matched (it isn't line-leading);
|
|
90
|
+
* - the name must be ALL-CAPS (`[A-Z][A-Z0-9_]{2,}`), since ordinary
|
|
91
|
+
* function/type names called at line start are lower/mixed case;
|
|
92
|
+
* - the char after the balanced `(...)` must START A DECLARATION — a letter,
|
|
93
|
+
* `_`, `~` (destructor), or `#` (a following directive). Declaration markup is
|
|
94
|
+
* always followed by the thing it decorates (`UPROPERTY(...)\n float X;`,
|
|
95
|
+
* `UE_DEPRECATED(...) UPROPERTY(...)`), whereas a statement call is followed by
|
|
96
|
+
* `;` (`FOO(x);`), an init-list item by `,`/`{`, and an expression fragment by
|
|
97
|
+
* an operator (`MAKE(a) + 1`) — all rejected. String/char literals inside the
|
|
98
|
+
* args are skipped so an embedded `)` can't mis-close the balance.
|
|
99
|
+
*
|
|
100
|
+
* C++-only (wired into cppExtractor). A blanked macro inside a block comment is
|
|
101
|
+
* harmless (comments don't parse), and the rare line-leading no-semicolon
|
|
102
|
+
* ALL-CAPS call that isn't markup only loses that one annotation, never a whole
|
|
103
|
+
* class.
|
|
104
|
+
*/
|
|
105
|
+
export declare function blankCppAnnotationMacroCalls(source: string): string;
|
|
106
|
+
export declare function blankCppApiPrefixMacros(source: string): string;
|
|
107
|
+
export declare function blankCppInlineAnnotationMacros(source: string): string;
|
|
108
|
+
export declare function blankCudaConstructs(source: string): string;
|
|
11
109
|
export declare const cppExtractor: LanguageExtractor;
|
|
12
110
|
//# sourceMappingURL=c-cpp.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { LanguageExtractor } from '../tree-sitter-types';
|
|
2
|
+
/**
|
|
3
|
+
* `<cfquery>` SQL bodies: `#hash#` expressions inside the SQL text are real
|
|
4
|
+
* CFML expressions (tree-sitter-cfml's `cfquery` grammar parses them
|
|
5
|
+
* structurally — `call_expression`/`member_expression`, same shape as
|
|
6
|
+
* cfscript's), so a call like `#getCurrentUser().getId()#` embedded in a
|
|
7
|
+
* WHERE clause is a genuine call edge. The surrounding SQL keywords/
|
|
8
|
+
* identifiers aren't symbols CodeGraph models — only `call_expression` is
|
|
9
|
+
* mapped, so extraction yields call references and nothing else.
|
|
10
|
+
*/
|
|
11
|
+
export declare const cfqueryExtractor: LanguageExtractor;
|
|
12
|
+
//# sourceMappingURL=cfquery.d.ts.map
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* COBOL Language Extractor
|
|
3
|
+
*
|
|
4
|
+
* COBOL's AST (vendored, patched build of yutaro-sakamoto/tree-sitter-cobol)
|
|
5
|
+
* is fundamentally different from block-structured languages, so extraction
|
|
6
|
+
* runs almost entirely through the custom visitNode hook (the Pascal pattern):
|
|
7
|
+
*
|
|
8
|
+
* - A program (PROGRAM-ID) becomes a `module` node.
|
|
9
|
+
* - PROCEDURE DIVISION sections and paragraphs become `function` nodes. The
|
|
10
|
+
* grammar emits them FLAT — a section_header/paragraph_header followed by
|
|
11
|
+
* sibling statements — so extents are reconstructed here: a paragraph runs
|
|
12
|
+
* from its header to the next header, a section to the next section header.
|
|
13
|
+
* - PERFORM (including THRU ranges), GO TO, and CALL 'literal' become `calls`
|
|
14
|
+
* references. A dynamic CALL through a data name is skipped — announce,
|
|
15
|
+
* don't guess. EXEC CICS LINK/XCTL PROGRAM('X') with a literal target also
|
|
16
|
+
* becomes a `calls` reference; EXEC SQL INCLUDE X becomes an `imports`
|
|
17
|
+
* reference (DB2's COPY).
|
|
18
|
+
* - COPY statements become `import` nodes + `imports` references.
|
|
19
|
+
* - DATA DIVISION entries become `variable` (01/77 levels), `field` (nested
|
|
20
|
+
* levels, contained in their group item), or `constant` (88-level condition
|
|
21
|
+
* names) nodes, so impact queries on working-storage names work.
|
|
22
|
+
* - Standalone copybooks (.cpy) parse via the grammar's copybook_fragment
|
|
23
|
+
* entry point: data copybooks yield their record structure, procedure
|
|
24
|
+
* copybooks yield paragraphs.
|
|
25
|
+
*
|
|
26
|
+
* The grammar is fixed-format (code area columns 8-72). preParse detects a
|
|
27
|
+
* free-format file (division header or level number starting before column 8)
|
|
28
|
+
* and indents every line by 7 spaces: line numbers are preserved, columns
|
|
29
|
+
* drift by 7 — acceptable for line-oriented consumers.
|
|
30
|
+
*/
|
|
31
|
+
import type { LanguageExtractor } from '../tree-sitter-types';
|
|
32
|
+
export declare const cobolExtractor: LanguageExtractor;
|
|
33
|
+
//# sourceMappingURL=cobol.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { LanguageExtractor } from '../tree-sitter-types';
|
|
2
|
+
/**
|
|
3
|
+
* The vendored VB.NET grammar has no true end-of-file token (its `_eof` rule is
|
|
4
|
+
* a literal-`$` placeholder that never matches real input), so a file whose
|
|
5
|
+
* last line lacks a trailing newline ends every parse with a MISSING-newline
|
|
6
|
+
* error on the final statement. Appending a newline is offset-preserving for
|
|
7
|
+
* all existing content.
|
|
8
|
+
*/
|
|
9
|
+
export declare function ensureTrailingNewline(source: string): string;
|
|
10
|
+
export declare const vbnetExtractor: LanguageExtractor;
|
|
11
|
+
//# sourceMappingURL=vbnet.d.ts.map
|
|
@@ -12,15 +12,21 @@ import { ExtractionResult } from '../types';
|
|
|
12
12
|
*
|
|
13
13
|
* This extractor emits one method-shaped node per `<select|insert|update|
|
|
14
14
|
* delete>` and per `<sql>` fragment, qualified as `<namespace>::<id>` so the
|
|
15
|
-
* MyBatis framework synthesizer
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
15
|
+
* MyBatis framework synthesizer can link the matching Java method → XML
|
|
16
|
+
* statement by suffix-matching qualified names. `<include refid="...">` inside
|
|
17
|
+
* a statement yields an unresolved reference to the SQL fragment, also keyed
|
|
18
|
+
* by `<namespace>::<refid>`.
|
|
19
|
+
*
|
|
20
|
+
* Both dialects are covered: MyBatis 3 `<mapper namespace="...">` and the
|
|
21
|
+
* legacy iBatis 2 `<sqlMap>` (namespaced, or namespace-less with `Map.stmt`
|
|
22
|
+
* ids, plus its extra `<statement>`/`<procedure>` verbs). Attribute values may
|
|
23
|
+
* use either quote style, and statements commented out with `<!-- ... -->` are
|
|
24
|
+
* ignored (see the constructor's comment-stripping pre-pass).
|
|
19
25
|
*
|
|
20
26
|
* Non-mapper XML (Maven `pom.xml`, Spring beans XML, `web.xml`, log4j config,
|
|
21
|
-
* etc.) is detected by the absence of a `<mapper namespace="...">`
|
|
22
|
-
* returns just a file node — we still need the file row so
|
|
23
|
-
* track it, but we emit no symbols.
|
|
27
|
+
* etc.) is detected by the absence of a `<mapper namespace="...">` /
|
|
28
|
+
* `<sqlMap>` root and returns just a file node — we still need the file row so
|
|
29
|
+
* the watcher can track it, but we emit no symbols.
|
|
24
30
|
*/
|
|
25
31
|
export declare class MyBatisExtractor {
|
|
26
32
|
private filePath;
|
|
@@ -31,16 +37,30 @@ export declare class MyBatisExtractor {
|
|
|
31
37
|
private errors;
|
|
32
38
|
private lineStarts;
|
|
33
39
|
constructor(filePath: string, source: string);
|
|
40
|
+
private static stripXmlComments;
|
|
34
41
|
extract(): ExtractionResult;
|
|
35
42
|
private createFileNode;
|
|
36
43
|
/**
|
|
37
|
-
* Find the
|
|
38
|
-
*
|
|
39
|
-
*
|
|
44
|
+
* Find the mapper root and its dialect. Two shapes are recognized:
|
|
45
|
+
* - MyBatis 3: `<mapper namespace="com.foo.Bar">` — namespace required.
|
|
46
|
+
* - iBatis 2: `<sqlMap namespace="Account">`, or a namespace-less
|
|
47
|
+
* `<sqlMap>` whose statement ids carry the qualifier as `Map.statement`.
|
|
48
|
+
* Returns the namespace, the dialect, and the byte offsets of the body
|
|
49
|
+
* (between the opening and closing tag) so statement extraction is scoped to
|
|
50
|
+
* the root's contents. Either quote style is accepted for the namespace
|
|
51
|
+
* (`namespace='X'` is legal XML and common in older mappers).
|
|
40
52
|
*/
|
|
41
53
|
private findMapperRoot;
|
|
42
54
|
private extractMapper;
|
|
43
55
|
private buildSignature;
|
|
56
|
+
/**
|
|
57
|
+
* Build the `<namespace>::<id>` qualified name the MyBatis synthesizer
|
|
58
|
+
* suffix-matches against a Java `<Class>::<method>`, and the display name.
|
|
59
|
+
* For a namespace-less iBatis `<sqlMap>`, the statement id carries the
|
|
60
|
+
* qualifier as `Map.statement`, so split on the last dot to reach the same
|
|
61
|
+
* shape (`Account.getById` → `Account::getById`, name `getById`).
|
|
62
|
+
*/
|
|
63
|
+
private qualifyStatement;
|
|
44
64
|
private previewSql;
|
|
45
65
|
private computeLineStarts;
|
|
46
66
|
private getLineNumber;
|
|
@@ -47,6 +47,7 @@ export interface ParseTask {
|
|
|
47
47
|
content: string;
|
|
48
48
|
language: Language;
|
|
49
49
|
frameworkNames?: string[];
|
|
50
|
+
vbaTargets?: Record<string, boolean>;
|
|
50
51
|
}
|
|
51
52
|
/**
|
|
52
53
|
* Resolve the pool size from the `CODEGRAPH_PARSE_WORKERS` override and the
|
|
@@ -56,6 +57,12 @@ export interface ParseTask {
|
|
|
56
57
|
* - unset / blank / non-numeric → `clamp(cores - 1, 1, 8)` (leave a core for
|
|
57
58
|
* the main thread + UI; never zero — parsing always needs a worker).
|
|
58
59
|
*/
|
|
60
|
+
/**
|
|
61
|
+
* Resolve the base per-parse timeout from the `CODEGRAPH_PARSE_TIMEOUT_MS`
|
|
62
|
+
* override. Slow storage (HDD, network folders) can need a larger budget; a
|
|
63
|
+
* non-numeric / non-positive value falls back to the default (10s).
|
|
64
|
+
*/
|
|
65
|
+
export declare function resolveParseTimeoutMs(envVal: string | undefined): number;
|
|
59
66
|
export declare function resolveParsePoolSize(envVal: string | undefined, cpuCount: number): number;
|
|
60
67
|
export interface ParseWorkerPoolOptions {
|
|
61
68
|
/** Languages to load grammars for in every worker at spawn. */
|
|
@@ -72,6 +79,15 @@ export interface ParseWorkerPoolOptions {
|
|
|
72
79
|
createWorker?: () => ParsePoolWorker;
|
|
73
80
|
/** Optional verbose logger (the orchestrator's `[worker] …` logger). */
|
|
74
81
|
log?: (msg: string) => void;
|
|
82
|
+
/**
|
|
83
|
+
* Pre-read grammar WASM bytes keyed by language, forwarded to every worker's
|
|
84
|
+
* `load-grammars` message so a spawn/respawn loads grammars from memory
|
|
85
|
+
* instead of re-reading them from disk — on slow storage each respawn's
|
|
86
|
+
* grammar re-read otherwise amplifies the very I/O contention that caused
|
|
87
|
+
* the respawn (issue #1231). Best-effort: a missing language falls back to
|
|
88
|
+
* the worker's own disk read.
|
|
89
|
+
*/
|
|
90
|
+
grammarBuffers?: Record<string, Uint8Array>;
|
|
75
91
|
}
|
|
76
92
|
export declare class ParseWorkerPool {
|
|
77
93
|
private idle;
|
|
@@ -89,6 +105,7 @@ export declare class ParseWorkerPool {
|
|
|
89
105
|
private readonly parseTimeoutMs;
|
|
90
106
|
private readonly createWorker;
|
|
91
107
|
private readonly log;
|
|
108
|
+
private readonly grammarBuffers?;
|
|
92
109
|
constructor(opts: ParseWorkerPoolOptions);
|
|
93
110
|
/** Pool size cap (for logging). */
|
|
94
111
|
get size(): number;
|
|
@@ -99,7 +116,7 @@ export declare class ParseWorkerPool {
|
|
|
99
116
|
/**
|
|
100
117
|
* Parse one file on the pool. Resolves with the extraction result, or REJECTS
|
|
101
118
|
* if the parse times out or its worker crashes — the caller records the error
|
|
102
|
-
* and (for worker-exit/OOM rejections) re-attempts in its retry pass.
|
|
119
|
+
* and (for worker-exit/OOM/timeout rejections) re-attempts in its retry pass.
|
|
103
120
|
*/
|
|
104
121
|
requestParse(task: ParseTask): Promise<ExtractionResult>;
|
|
105
122
|
private spawnOne;
|
|
@@ -112,7 +129,17 @@ export declare class ParseWorkerPool {
|
|
|
112
129
|
private recycle;
|
|
113
130
|
private removeWorker;
|
|
114
131
|
private dispatch;
|
|
132
|
+
/**
|
|
133
|
+
* The base timer fired with no result processed yet. Do NOT kill or settle:
|
|
134
|
+
* the timer firing doesn't prove the parse is still running — after a long
|
|
135
|
+
* synchronous main-thread stretch Node services the timers phase before the
|
|
136
|
+
* poll phase, so an already-delivered `parse-result` is still queued behind
|
|
137
|
+
* this callback. Mark the job late (onMessage accepts a result that shows up)
|
|
138
|
+
* and arm the hard-kill backstop for workers that are genuinely hung.
|
|
139
|
+
*/
|
|
115
140
|
private onTimeout;
|
|
141
|
+
/** No result after the full hard-kill window — the worker really is hung. */
|
|
142
|
+
private onHardTimeout;
|
|
116
143
|
private drain;
|
|
117
144
|
private settle;
|
|
118
145
|
/**
|
|
@@ -76,8 +76,10 @@ export interface LanguageExtractor {
|
|
|
76
76
|
* grammar mis-parses inside enum bodies). MUST preserve byte offsets (replace
|
|
77
77
|
* removed text with spaces, keep newlines) so node positions and getNodeText
|
|
78
78
|
* stay correct; the returned string is used for both parsing and extraction.
|
|
79
|
+
* `filePath` lets a transform key off the concrete file extension when one
|
|
80
|
+
* language id serves several dialects (C++ also parses `.metal` shaders).
|
|
79
81
|
*/
|
|
80
|
-
preParse?: (source: string) => string;
|
|
82
|
+
preParse?: (source: string, filePath?: string) => string;
|
|
81
83
|
/** Node types that represent functions */
|
|
82
84
|
functionTypes: string[];
|
|
83
85
|
/** Node types that represent classes */
|
|
@@ -114,6 +116,15 @@ export interface LanguageExtractor {
|
|
|
114
116
|
returnField?: string;
|
|
115
117
|
/** Override symbol name extraction (e.g. ObjC multi-part selectors). */
|
|
116
118
|
resolveName?: (node: SyntaxNode, source: string) => string | undefined;
|
|
119
|
+
/**
|
|
120
|
+
* Post-process an already-extracted name to recover a real identifier from a
|
|
121
|
+
* name still mangled by a macro the pre-parse didn't blank (C/C++:
|
|
122
|
+
* `MACRO Ret name(` misparses to the name "Ret name"). Applied to every name
|
|
123
|
+
* this extractor produces, so it MUST be a no-op on a well-formed name — only
|
|
124
|
+
* C/C++ set it, because a mangled name there is unambiguous (an internal space),
|
|
125
|
+
* whereas e.g. Kotlin/Scala backtick identifiers legitimately contain spaces.
|
|
126
|
+
*/
|
|
127
|
+
recoverMangledName?: (name: string) => string;
|
|
117
128
|
/** Extract property name when the generic name walk fails (e.g. ObjC @property). */
|
|
118
129
|
extractPropertyName?: (node: SyntaxNode, source: string) => string | null;
|
|
119
130
|
/** Extract signature from node */
|
|
@@ -140,6 +151,14 @@ export interface LanguageExtractor {
|
|
|
140
151
|
extraClassNodeTypes?: string[];
|
|
141
152
|
/** Whether methods can be top-level without enclosing class (Go: true) */
|
|
142
153
|
methodsAreTopLevel?: boolean;
|
|
154
|
+
/**
|
|
155
|
+
* Skip a bodiless class node as a forward declaration / elaborated type,
|
|
156
|
+
* mirroring the bodiless-struct/enum skip. Set only for languages where a
|
|
157
|
+
* bodiless `class` specifier is NOT a complete definition — C/C++
|
|
158
|
+
* (`class Foo;` is a forward decl). Leave unset for languages where a
|
|
159
|
+
* bodiless class IS complete (Kotlin `class Empty`, Scala `case object`). (#1093)
|
|
160
|
+
*/
|
|
161
|
+
skipBodilessClass?: boolean;
|
|
143
162
|
/** NodeKind to use for interface-like declarations (Rust: 'trait'). Default: 'interface' */
|
|
144
163
|
interfaceKind?: NodeKind;
|
|
145
164
|
/**
|
|
@@ -25,6 +25,8 @@ export declare class TreeSitterExtractor {
|
|
|
25
25
|
private errors;
|
|
26
26
|
private extractor;
|
|
27
27
|
private nodeStack;
|
|
28
|
+
private namespacePrefix;
|
|
29
|
+
private cppLocalFnPtrs;
|
|
28
30
|
private methodIndex;
|
|
29
31
|
private fnRefSpec;
|
|
30
32
|
private fnRefCandidates;
|
|
@@ -427,6 +429,25 @@ export declare class TreeSitterExtractor {
|
|
|
427
429
|
/**
|
|
428
430
|
* Extract a function call
|
|
429
431
|
*/
|
|
432
|
+
/**
|
|
433
|
+
* The module an Erlang gen_server target expression statically names, or
|
|
434
|
+
* null when it's dynamic (pid/var/tuple form). Static shapes:
|
|
435
|
+
* - a bare atom — either this module or another one; OTP's dominant
|
|
436
|
+
* registration convention (`{local, ?MODULE}`) names a server process
|
|
437
|
+
* after its module, so `gen_server:call(other_mod, …)` reaches
|
|
438
|
+
* `other_mod`'s handlers. A registered name that matches no module
|
|
439
|
+
* resolves to nothing downstream (the qualified ref just drops).
|
|
440
|
+
* - `?MODULE`, or a macro the file defines as `?MODULE`
|
|
441
|
+
* (`-define(SERVER, ?MODULE)` — the standard self idiom)
|
|
442
|
+
* - a macro the file defines as a bare atom
|
|
443
|
+
* (`-define(STORE, kv_store)` — the cross-module variant)
|
|
444
|
+
* The macro tables are memoized per file (single entry — extraction is
|
|
445
|
+
* file-sequential).
|
|
446
|
+
*/
|
|
447
|
+
private erlangServerMacroFile;
|
|
448
|
+
private erlangSelfMacros;
|
|
449
|
+
private erlangAtomMacros;
|
|
450
|
+
private resolveErlangGenServerTarget;
|
|
430
451
|
private extractCall;
|
|
431
452
|
/**
|
|
432
453
|
* `new Foo(...)` / `Foo::new(...)` / object_creation_expression —
|
|
@@ -437,7 +458,37 @@ export declare class TreeSitterExtractor {
|
|
|
437
458
|
* Children are still walked so nested calls inside the constructor
|
|
438
459
|
* arguments (`new Foo(bar())`) get their own `calls` references.
|
|
439
460
|
*/
|
|
461
|
+
/**
|
|
462
|
+
* VB.NET `New Invoice(1)` is syntactically ambiguous between constructing
|
|
463
|
+
* Invoice with an argument and allocating an Invoice array of bound 1; the
|
|
464
|
+
* grammar parses the parenthesized form as array_creation_expression. A
|
|
465
|
+
* user-defined type with no `{...}` array initializer is overwhelmingly a
|
|
466
|
+
* constructor call, so treat it as an instantiation. Predefined element
|
|
467
|
+
* types (`New Byte(1023)`) and brace-initialized forms stay arrays.
|
|
468
|
+
*/
|
|
469
|
+
private isVbnetConstructorShapedArrayCreation;
|
|
440
470
|
private extractInstantiation;
|
|
471
|
+
/**
|
|
472
|
+
* Is this C++ `declaration` a stack/direct-initialization object construction
|
|
473
|
+
* that invokes a constructor — `Calculator calc(0)` (direct-init) or
|
|
474
|
+
* `Widget w{1, 2}` (brace-init) — as opposed to a plain variable or a
|
|
475
|
+
* function declaration? Used to emit an `instantiates` edge for the
|
|
476
|
+
* call-less construction syntax (#1035); heap `new T(...)` is handled
|
|
477
|
+
* separately by INSTANTIATION_KINDS.
|
|
478
|
+
*
|
|
479
|
+
* Two signals, both required:
|
|
480
|
+
* - the `type` field is a class-like NAMED type (`type_identifier`,
|
|
481
|
+
* `template_type`, or `qualified_identifier`). Primitives (`int x(0)`),
|
|
482
|
+
* `auto` (`placeholder_type_specifier` — that form always carries a real
|
|
483
|
+
* `call_expression`, already handled), and sized specifiers are excluded —
|
|
484
|
+
* they construct no class; and
|
|
485
|
+
* - a declarator carries constructor arguments: an `init_declarator` whose
|
|
486
|
+
* `value` is an `argument_list` (`(args)`) or `initializer_list` (`{args}`).
|
|
487
|
+
* This skips default construction `Calculator c;` (no value) and the
|
|
488
|
+
* most-vexing-parse `Calculator c();` (a bodyless `function_declarator`,
|
|
489
|
+
* a function decl — not a construction).
|
|
490
|
+
*/
|
|
491
|
+
private isCppStackConstruction;
|
|
441
492
|
/**
|
|
442
493
|
* Static-member / value-read pass. A type/enum/class used only via a member
|
|
443
494
|
* VALUE — `Enum.value`, `Type.CONST`, `Colors.red`, `Foo::BAR` — recorded no
|
|
@@ -507,6 +558,14 @@ export declare class TreeSitterExtractor {
|
|
|
507
558
|
* heuristic — no false edges (resolution still validates each path).
|
|
508
559
|
*/
|
|
509
560
|
private extractRustRouteMacro;
|
|
561
|
+
/**
|
|
562
|
+
* Record a C++ local function-pointer binding (`local = &fn` / `&fn<…>` /
|
|
563
|
+
* `&ns::fn<…>`) for the CURRENT enclosing symbol, so calls through the local
|
|
564
|
+
* resolve to the real target (see cppLocalFnPtrs). Only the address-of shape
|
|
565
|
+
* is accepted — a bare-identifier RHS (`auto x = y;`) is any value copy, and
|
|
566
|
+
* linking through it would guess.
|
|
567
|
+
*/
|
|
568
|
+
private recordCppFnPtrBinding;
|
|
510
569
|
private visitFunctionBody;
|
|
511
570
|
/**
|
|
512
571
|
* Extract inheritance relationships
|
|
@@ -643,5 +702,5 @@ export declare class TreeSitterExtractor {
|
|
|
643
702
|
* those names and the file's language are run after the tree-sitter pass.
|
|
644
703
|
* Their nodes/references/errors are merged into the returned result.
|
|
645
704
|
*/
|
|
646
|
-
export declare function extractFromSource(filePath: string, source: string, language?: Language, frameworkNames?: string[]): ExtractionResult;
|
|
705
|
+
export declare function extractFromSource(filePath: string, source: string, language?: Language, frameworkNames?: string[], vbaTargets?: Record<string, boolean>): ExtractionResult;
|
|
647
706
|
//# sourceMappingURL=tree-sitter.d.ts.map
|