import type Parser from 'tree-sitter'; import type { NodeLabel } from '../../../_shared/index.js'; import type { LanguageProvider } from '../language-provider.js'; /** Tree-sitter AST node. Re-exported for use across ingestion modules. */ export type SyntaxNode = Parser.SyntaxNode; /** * Ordered list of definition capture keys for tree-sitter query matches. * Used to extract the definition node from a capture map. */ export declare const DEFINITION_CAPTURE_KEYS: readonly ["definition.function", "definition.class", "definition.interface", "definition.method", "definition.struct", "definition.enum", "definition.namespace", "definition.module", "definition.trait", "definition.impl", "definition.type", "definition.const", "definition.static", "definition.typedef", "definition.macro", "definition.union", "definition.property", "definition.record", "definition.delegate", "definition.annotation", "definition.constructor", "definition.template"]; /** Extract the definition node from a tree-sitter query capture map. */ export declare const getDefinitionNodeFromCaptures: (captureMap: Record) => SyntaxNode | null; /** * Node types that represent function/method definitions across languages. * Used to find the enclosing function for a call site. */ export declare const FUNCTION_NODE_TYPES: Set; /** * Node types for standard function declarations that need C/C++ declarator handling. * Used by extractFunctionName to determine how to extract the function name. */ export declare const FUNCTION_DECLARATION_TYPES: Set; /** AST node types that represent a class-like container (for HAS_METHOD edge extraction) */ export declare const CLASS_CONTAINER_TYPES: Set; export declare const CONTAINER_TYPE_TO_LABEL: Record; /** Check if a Kotlin function_declaration capture is inside a class_body (i.e., a method). * Kotlin grammar uses function_declaration for both top-level functions and class methods. * Returns true when the captured definition node has a class_body ancestor. */ export declare function isKotlinClassMethod(captureNode: { parent?: SyntaxNode | null; } | null | undefined): boolean; /** * Determine the graph node label from a tree-sitter capture map. * Handles language-specific reclassification via the provider's labelOverride hook * (e.g. C/C++ duplicate skipping, Kotlin Method promotion). * Returns null if the capture should be skipped (import, call, C/C++ duplicate, missing name). */ export declare function getLabelFromCaptures(captureMap: Record, provider: LanguageProvider): NodeLabel | null; /** Walk up AST to find enclosing class/struct/interface/impl, return its generateId or null. * For Go method_declaration nodes, extracts receiver type (e.g. `func (u *User) Save()` → User struct). */ export declare const findEnclosingClassId: (node: SyntaxNode, filePath: string) => string | null; /** * Find a child of `childType` within a sibling node of `siblingType`. * Used for Kotlin AST traversal where visibility_modifier lives inside a modifiers sibling. */ export declare const findSiblingChild: (parent: SyntaxNode, siblingType: string, childType: string) => SyntaxNode | null; /** * Extract function name and label from a function_definition or similar AST node. * Handles C/C++ qualified_identifier (ClassName::MethodName) and other language patterns. */ export declare const extractFunctionName: (node: SyntaxNode) => { funcName: string | null; label: NodeLabel; }; export interface MethodSignature { parameterCount: number | undefined; /** Number of required (non-optional, non-default) parameters. * Only set when fewer than parameterCount — enables range-based arity filtering. * undefined means all parameters are required (or metadata unavailable). */ requiredParameterCount: number | undefined; /** Per-parameter type names extracted via extractSimpleTypeName. * Only populated for languages with method overloading (Java, Kotlin, C#, C++). * undefined (not []) when no types are extractable — avoids empty array allocations. */ parameterTypes: string[] | undefined; returnType: string | undefined; } /** Argument list node types shared between extractMethodSignature and countCallArguments. */ export declare const CALL_ARGUMENT_LIST_TYPES: Set; /** * Extract parameter count and return type text from an AST method/function node. * Works across languages by looking for common AST patterns. */ export declare const extractMethodSignature: (node: SyntaxNode | null | undefined) => MethodSignature; /** Walk an AST node depth-first, returning the first descendant with the given type. */ export declare function findDescendant(node: SyntaxNode, type: string): SyntaxNode | null; /** Extract the text content from a string or encapsed_string AST node. */ export declare function extractStringContent(node: SyntaxNode | null | undefined): string | null; /** Check if a C/C++ function_definition is inside a class or struct body. * Used by the C/C++ labelOverride to skip duplicate function captures * that are already covered by definition.method queries. */ export declare function isCppInsideClassOrStruct(functionNode: SyntaxNode): boolean; /** Find the first direct named child of a tree-sitter node matching the given type. */ export declare function findChild(node: SyntaxNode, type: string): SyntaxNode | null;