/** * Shared AST-walking helpers used by multiple language configs. * Keeps individual config files small. */ import type { SyntaxNode } from '../../utils/ast-helpers.js'; import type { FieldVisibility } from '../../field-types.js'; /** * Check whether any child of `node` (named or unnamed) has .text matching * the given `keyword`. * * Skips the `name` field child to avoid false positives when a method is * named after a contextual keyword (e.g. `abstract()` in TypeScript). */ export declare function hasKeyword(node: SyntaxNode, keyword: string): boolean; /** * Check whether a named child of type `modifierType` contains `keyword`. * Useful for languages that group modifiers under a wrapper node * (e.g. Java 'modifiers', Kotlin 'modifiers'). */ export declare function hasModifier(node: SyntaxNode, modifierType: string, keyword: string): boolean; /** * Return the first matching visibility keyword found either as a direct keyword * child or inside a modifier wrapper node. * Skips the `name` field child (same rationale as hasKeyword). */ export declare function findVisibility(node: SyntaxNode, keywords: ReadonlySet, defaultVis: FieldVisibility, modifierNodeType?: string): FieldVisibility; /** * Extract the text of the first named child whose type is in `types`. */ export declare function firstChildText(node: SyntaxNode, types: ReadonlySet): string | undefined; /** * Extract the first named child node whose type is in `types`. */ export declare function firstChildOfType(node: SyntaxNode, types: ReadonlySet): SyntaxNode | null; /** * Get type text from a named field on the node, using extractSimpleTypeName. * Falls back to raw .text of the field child if extractSimpleTypeName returns undefined. */ export declare function typeFromField(node: SyntaxNode, fieldName: string): string | undefined; /** * Walk named children looking for a type_annotation node and extract its type. */ export declare function typeFromAnnotation(node: SyntaxNode): string | undefined; /** * Find the first descendant (depth-first, one level) matching one of the given types * and return its text via extractSimpleTypeName. */ export declare function typeFromDescendant(node: SyntaxNode, types: ReadonlySet): string | undefined; /** * Collect all modifier keyword texts from a declaration node's named `modifier` children. * Used by C# configs to detect compound visibilities (protected internal, private protected). */ export declare function collectModifierTexts(node: SyntaxNode): Set;