UNPKG

@vlocode/apex

Version:
32 lines 1.64 kB
import { ParserRuleContext } from "antlr4ng"; import { ApexParserVisitor } from "../grammar"; import "../grammar"; export declare abstract class ApexSyntaxTreeVisitor<T> extends ApexParserVisitor<T> { protected state: T; constructor(state: T); visitChildren(node: ParserRuleContext): T; /** * Aggregates the result of a child node into the state of the visitor. * This method is called by `visitChildren` for each child node. * @param aggregate The current state of the visitor * @param nextResult The result of the child node * @returns The new state of the visitor */ protected aggregateResult(aggregate: T, nextResult: T): T; /** * Get the first child of a node of a specific type * @param node Node to get the child from * @param type Type of the child to get * @returns The first child of the specified type or throws an error if no child of the specified type was found */ getFirstChildOfType<TNode extends ParserRuleContext>(node: ParserRuleContext, type: new (...args: any[]) => TNode): TNode; /** * Get all sibling nodes ao the same level as the specified node of a specific type. * Checks the parent node of the specified node. * @param node Node to get the siblings from * @param type Type of the siblings to get * @returns All sibling nodes of the specified type or an empty array if no siblings of the specified type were found */ getSiblingsOfType<TNode extends ParserRuleContext>(node: ParserRuleContext, type: new (...args: any[]) => TNode): TNode[]; } //# sourceMappingURL=syntaxTreeVisitor.d.ts.map