UNPKG

antlr-ng

Version:

Next generation ANTLR Tool

35 lines (34 loc) 1.67 kB
import { ATNState, IntervalSet, Token, type BitSet } from "antlr4ng"; import { CommonTree } from "../../tree/CommonTree.js"; import type { IGrammarAST } from "../../types.js"; import type { Grammar } from "../Grammar.js"; import type { IGrammarASTVisitor } from "./IGrammarASTVisitor.js"; export declare class GrammarAST extends CommonTree implements IGrammarAST { /** A discriminator to distinguish between different grammar AST types without creating a circular dependency. */ readonly astType: string; /** For process AST nodes from imported grammars. */ g: Grammar; /** If we build an ATN, we make AST node point at left edge of ATN construct */ atnState?: ATNState; textOverride: string; constructor(nodeOrToken?: GrammarAST | Token); constructor(type: number, t?: Token, text?: string); getNodesWithType(typeOrTypes: number | IntervalSet | null): GrammarAST[]; getAllChildrenWithType(type: number): GrammarAST[]; getNodesWithTypePreorderDFS(types: IntervalSet): GrammarAST[]; getNodeWithTokenIndex(index: number): GrammarAST | null; /** * Walk ancestors of this node until we find ALT with * alt!=null or leftRecursiveAltInfo!=null. Then grab label if any. * If not a rule element, just returns null. */ getAltLabel(): string | null; deleteChild(i: number): CommonTree | null; deleteChild(t: CommonTree): boolean; getFirstDescendantWithType(typeOrTypes: number | BitSet): CommonTree | null; setType(type: number): void; setText(text: string): void; dupNode(): GrammarAST; visit<T>(v: IGrammarASTVisitor<T>): T; private doGetNodesWithTypePreorderDFS; }