import { type LoadedNativeGrammarSet, type NativeTreeCursor, type NativeQueryCapture, type NativeQueryInstance } from "./grammar-loaders.js"; import { type HeaderLanguageEvidence } from "./language-manifest.js"; import { StructuralParserPool, type ParserPoolOptions } from "./parser-pool.js"; import type { LanguageManifestEntry, NormalizedStructure, StructuralParseOutcome } from "./types.js"; export interface StructuralQueryContext { /** Every cursor created here is owned and deleted by the runtime. */ createCursor(node?: StructuralSyntaxNode): NativeTreeCursor; /** Compile once per grammar/query source and execute against a node. */ query(source: string, node?: StructuralSyntaxNode): readonly NativeQueryCapture[]; /** Queue an exact host byte slice for parsing after native host resources are released. */ collectEmbeddedSlice(slice: StructuralEmbeddedSlice): void; } export interface StructuralEmbeddedSlice { readonly extension: string; readonly startByte: number; readonly endByte: number; readonly scope: string; } /** Cursor creation is intentionally absent; use StructuralQueryContext. */ export interface StructuralSyntaxNode { readonly type: string; readonly hasError: boolean; readonly endIndex: number; readonly startIndex?: number; readonly namedChildren?: readonly StructuralSyntaxNode[]; readonly children?: readonly StructuralSyntaxNode[]; readonly parent?: StructuralSyntaxNode | null; childForFieldName?(fieldName: string): StructuralSyntaxNode | null; } export interface StructuralQueryTree { readonly rootNode: StructuralSyntaxNode; } export type StructuralQueryExecutor = (tree: StructuralQueryTree, source: Buffer, language: LanguageManifestEntry, context: StructuralQueryContext) => NormalizedStructure | Promise; export interface StructuralParseRequest { extension: string; source: Buffer; queryExecutor?: StructuralQueryExecutor; headerEvidence?: HeaderLanguageEvidence; } export interface StructuralRuntimeOptions { parserPool?: StructuralParserPool; grammarSet?: () => LoadedNativeGrammarSet | Promise; queryExecutor?: StructuralQueryExecutor; pool?: Omit; } export declare const STRUCTURAL_QUERY_MATCH_LIMIT = 4096; export declare function executeBoundedNativeQuery(query: NativeQueryInstance, node: Parameters[0]): readonly NativeQueryCapture[]; /** Owns parser leases and all native tree/cursor lifetime for one parse. */ export declare class StructuralRuntime { #private; constructor(options?: StructuralRuntimeOptions); parse(request: StructuralParseRequest): Promise; } export declare const structuralRuntime: StructuralRuntime; //# sourceMappingURL=structural-runtime.d.ts.map