/** * Generic, grammar-agnostic node accessors + AST helpers (ADR-0010 v1 * vocabulary). `nameOf`/`childrenOf`/`namedChildrenOf` are lifted verbatim * from `graph-adapter-common/walk.ts` (they operate on `Node` only, no graph * types). `walkNodes`/`findEnclosing` mirror the `lang-typescript` precedents * (`ast-utilities.walkNodes`, `function-scope.findEnclosingFunction`) over * tree-sitter nodes. Per-language node-kind predicates layer on top in each * `lang-*` package. */ import type { Node } from 'web-tree-sitter'; /** * Read the text of a node's `name` field, or `null` when absent. Every * grammar exposes the declared name via a `name` field on function / method / * class / impl nodes. */ export declare function nameOf(node: Node): string | null; /** * `node.children` with the nulls removed. web-tree-sitter types `.children` * as `(Node | null)[]` (a null slot is theoretically possible mid-iteration * during an incremental re-parse); for our one-shot parse the slots are * always populated, but we filter once here so consumers get a clean `Node[]`. */ export declare function childrenOf(node: Node): Node[]; /** `node.namedChildren` with the nulls removed. See {@link childrenOf}. */ export declare function namedChildrenOf(node: Node): Node[]; /** The node's source text. */ export declare function nodeText(node: Node): string; /** 1-based line number of the node's start. */ export declare function getLineNumber(node: Node): number; /** 0-based column of the node's start. */ export declare function getColumn(node: Node): number; /** * Pre-order visit of every named descendant of `root` (not `root` itself) — * the tree-sitter analog of `lang-typescript`'s `walkNodes`. Named children * are the meaningful AST nodes (punctuation/anonymous tokens excluded). */ export declare function walkNodes(root: Node, visitor: (node: Node) => void): void; /** * Walk ancestors of `node` (excluding `node`) and return the nearest one * matching `predicate`, or `null` at the root — the tree-sitter analog of * `lang-typescript`'s `findEnclosingFunction`. Per-language helpers compose * this with a node-kind predicate. */ export declare function findEnclosing(node: Node, predicate: (n: Node) => boolean): Node | null; //# sourceMappingURL=nodes.d.ts.map