/** * Shared web-tree-sitter loader for the Tier-S parser analyzers (Python / HTML / * CSS). web-tree-sitter is a pure-WASM runtime — no native compilation — so a * grammar parses identically on every platform; grammars ship as `.wasm` files * in `tree-sitter-wasms` (out/tree-sitter-.wasm). * * Everything here degrades to `undefined` on any failure (missing dependency, * missing grammar, init error) so a caller simply keeps the deterministic regex * floor. The runtime is initialised once and parsed grammars are cached. */ export interface TsNode { type: string; text: string; namedChildren: TsNode[]; childForFieldName(field: string): TsNode | null; descendantsOfType(type: string | string[]): TsNode[]; } export interface TsTree { rootNode: TsNode; } export interface TsLanguage { __brand?: "tree-sitter-language"; } export interface TsParser { setLanguage(language: TsLanguage): void; parse(source: string): TsTree; } /** * Return the number of times tree-sitter fell back to the regex floor since * process start (or since the last `__resetTreeSitterForTests` call). Each * distinct failure path (import failure, init failure, grammar load failure, * parser instantiation failure) increments the counter once. A caller can * snapshot this before and after a batch parse pass to detect systemic * degradation without scraping stderr. */ export declare function getTreeSitterDegradationCount(): number; /** * Obtain a parser bound to `grammar` (e.g. "python", "html", "css"), or * `undefined` if web-tree-sitter or the grammar wasm cannot be loaded. */ export declare function getTreeSitterParser(grammar: string, dependencyPath?: string): Promise; /** Test seam: reset the memoised runtime/grammar caches and degradation counter. */ export declare function __resetTreeSitterForTests(): void; //# sourceMappingURL=treeSitter.d.ts.map