import type { ExtractorOutput, Import, SubDeclaration, TreeSitterNode, TypeMapEntry } from '../types.js';
/**
 * Maximum recursion depth for tree-sitter AST walkers.
 * Shared across all language extractors to prevent stack overflow on deeply nested ASTs.
 */
export declare const MAX_WALK_DEPTH = 200;
/** Convert a tree-sitter node's start row to a 1-based source line. */
export declare function nodeStartLine(node: TreeSitterNode): number;
export declare function nodeEndLine(node: TreeSitterNode): number;
export declare function findChild(node: TreeSitterNode, type: string): TreeSitterNode | null;
/**
 * Find the first child whose type is in `types`. Useful when several grammar
 * variants name the same conceptual node differently (e.g. `string` vs
 * `string_literal`). Returns the first match in document order, or null.
 */
export declare function findFirstChildOfTypes(node: TreeSitterNode, types: readonly string[]): TreeSitterNode | null;
/**
 * Iterate the direct children of `node` in document order, skipping nulls and
 * tokens whose type appears in `skipTypes`. Mirrors the common
 * `for (let i = 0; i < node.childCount; i++) { const c = node.child(i); if (...) continue; ... }`
 * idiom while letting callers filter out grammar punctuation (`,`, `(`, `{`, etc.).
 */
export declare function iterChildren(node: TreeSitterNode, skipTypes?: ReadonlySet<string>): Generator<TreeSitterNode>;
/** Common punctuation tokens — handy as a `skipTypes` set for `iterChildren`. */
export declare const PUNCTUATION_TOKENS: ReadonlySet<string>;
/**
 * Merge a type-map entry, keeping the higher-confidence one.
 * Shared across all language extractors that build type maps for call resolution.
 */
export declare function setTypeMapEntry(typeMap: Map<string, TypeMapEntry>, name: string, type: string, confidence: number): void;
/**
 * Python convention: __name → private, _name → protected, else undefined.
 */
export declare function pythonVisibility(name: string): 'public' | 'private' | 'protected' | undefined;
/**
 * Go convention: uppercase first letter → public, lowercase → private.
 */
export declare function goVisibility(name: string): 'public' | 'private' | 'protected' | undefined;
/**
 * Rust: check for `visibility_modifier` child (pub, pub(crate), etc.).
 */
export declare function rustVisibility(node: TreeSitterNode): 'public' | 'private';
/**
 * Walk up the parent chain to find an enclosing node whose type is in `typeNames`.
 * Returns the text of `nameField` (default `'name'`) on the matching ancestor, or null.
 *
 * Replaces per-language `findParentClass` / `findParentType` / `findCurrentImpl` helpers.
 */
export declare function findParentNode(node: TreeSitterNode, typeNames: readonly string[], nameField?: string): string | null;
/**
 * Extract child declarations from a container node's body.
 * Finds the body via `bodyFields` (tries childForFieldName then findChild for each),
 * iterates its children, filters by `memberType`, extracts `nameField`, and returns SubDeclarations.
 *
 * Replaces per-language extractStructFields / extractEnumVariants / extractEnumConstants helpers
 * for the common case where each member has a direct name field.
 */
export declare function extractBodyMembers(containerNode: TreeSitterNode, bodyFields: readonly string[], memberType: string, kind: SubDeclaration['kind'], nameField?: string, visibility?: (member: TreeSitterNode) => SubDeclaration['visibility']): SubDeclaration[];
/**
 * Strip leading/trailing quotes (single, double, or backtick) from a string.
 * Strips only the leading/trailing delimiter; interior quotes are untouched.
 */
export declare function stripQuotes(text: string): string;
/**
 * Extract the last segment of a delimited path.
 * e.g. `lastPathSegment('java.util.List', '.')` → `'List'`
 */
export declare function lastPathSegment(path: string, separator?: string): string;
export declare function extractModifierVisibility(node: TreeSitterNode, modifierTypes?: Set<string>): 'public' | 'private' | 'protected' | undefined;
/**
 * Append a `Call` to the extractor output. `line` defaults to the start line of
 * `node`; pass `extra` for `receiver` / `dynamic` flags.
 */
export declare function pushCall(ctx: ExtractorOutput, node: TreeSitterNode, name: string, extra?: {
    receiver?: string;
    dynamic?: boolean;
}): void;
/**
 * Append an `Import` to the extractor output. `line` defaults to the start
 * line of `node`. If `names` is empty, the source basename (split on `/`) is
 * used as a single-name fallback — matching the convention in gleam, julia,
 * and similar module-path imports.
 */
export declare function pushImport(ctx: ExtractorOutput, node: TreeSitterNode, source: string, names: string[], flags?: Partial<Omit<Import, 'source' | 'names' | 'line'>>): void;
/**
 * Options for {@link extractSimpleParameters}.
 */
export interface ExtractParametersOptions {
    /** Tree-sitter types that mark a single parameter node (e.g. `formal_parameter`). */
    paramTypes: readonly string[];
    /**
     * Field name on each parameter that holds the bound identifier. Defaults to
     * `'name'`. Pass `null` to use the parameter node itself when its type is in
     * `paramTypes` and it has no `name` field (e.g. R's bare `identifier`).
     */
    nameField?: string | null;
    /**
     * If true, when `nameField` lookup fails fall back to the first `identifier`
     * child of the parameter. Useful for Gleam / Solidity-style grammars.
     */
    fallbackToIdentifier?: boolean;
    /**
     * Optional type-map sink. When provided, the parameter's `type` field text
     * (if present) is recorded with the given confidence.
     */
    typeMap?: Map<string, TypeMapEntry>;
    /** Confidence used when writing into `typeMap`. Defaults to `0.9`. */
    typeMapConfidence?: number;
    /**
     * Optional callback to derive the type text from the parameter's `type`
     * field node. Defaults to `node.text`. Use this for languages where the
     * `type` field is wrapped (e.g. Java `generic_type` → first child).
     */
    resolveType?: (typeNode: TreeSitterNode) => string | undefined;
}
/**
 * Extract parameters from a parameter-list node using a uniform pattern.
 *
 * This collapses the boilerplate in `extract*Params` helpers across
 * Java/Julia/Gleam/Solidity/R/etc. — each one walks the parameter list,
 * matches a parameter node type, reads the `name` field, and pushes a
 * `SubDeclaration` with `kind: 'parameter'`.
 */
export declare function extractSimpleParameters(paramListNode: TreeSitterNode | null, options: ExtractParametersOptions): SubDeclaration[];
/**
 * Resolve the identifier node that names a parameter. Used by
 * {@link extractSimpleParameters}; exposed so language-specific extractors
 * can reuse the same lookup logic in custom loops.
 */
export declare function resolveParamName(paramNode: TreeSitterNode, nameField: string | null, fallbackToIdentifier: boolean): TreeSitterNode | null;
//# sourceMappingURL=helpers.d.ts.map