antlr-ng
Version:
Next generation ANTLR Tool
64 lines (63 loc) • 2.78 kB
TypeScript
import { type TokenStream } from "antlr4ng";
import { type GrammarSpecContext, type RuleSpecContext } from "../generated/ANTLRv4Parser.js";
import { GrammarAST } from "../tool/ast/GrammarAST.js";
import { GrammarRootAST } from "../tool/ast/GrammarRootAST.js";
/**
* Converts a grammar spec parse tree into a grammar AST.
*/
export declare class ParseTreeToASTConverter {
/**
* Converts the grammar parse tree to an abstract syntax tree (AST).
* We generate here the same tree structure as produced by the old ANTlR 3.x parser.
*
* @param grammarSpec The root context of the grammar parse tree.
* @param tokens The token stream to use for the AST nodes.
*
* @returns The generated AST.
*/
static convertGrammarSpecToAST(grammarSpec: GrammarSpecContext, tokens: TokenStream): GrammarRootAST;
static convertRuleSpecToAST(rule: RuleSpecContext, ast: GrammarAST): GrammarAST | undefined;
private static convertRuleBlockToAST;
private static convertRulerefToAST;
private static convertPrequelConstructToAST;
private static convertRulesToAST;
private static convertModeSpecToAST;
private static convertOptionsSpecToAST;
private static convertDelegateGrammarsToAST;
private static convertTokensSpec;
private static convertChannelsSpecToAST;
private static convertActionRuleToAST;
private static convertAtomToAST;
private static convertBlockToAST;
private static convertEbnfSuffixToAST;
private static convertEbnfToAST;
private static convertActionElementToAST;
private static convertActionBlockToAST;
private static convertArgActionBlockToAST;
private static convertPredicateOptionsToAST;
private static convertLexerRuleSpecToAST;
private static convertLexerRuleBlockToAST;
private static convertLexerAltToAST;
private static convertLexerElementsToAST;
private static convertLexerElementToAST;
private static convertElementOptionsToAST;
private static convertElementOptionToAST;
private static convertLexerCommandsToAST;
private static convertLexerCommandToAST;
private static convertTerminalDefToAST;
private static convertNotSetToAST;
private static convertSetElementToAST;
private static convertBlockSetToAST;
private static convertLexerAtomToAST;
private static convertCharacterRangeToAST;
private static convertWildcardToAST;
private static convertRuleActionToAST;
private static convertAltListToAST;
private static convertAlternativeToAST;
private static convertElementToAST;
private static convertLabeledElementToAST;
private static convertLexerBlockToAST;
private static createToken;
private static createASTNode;
private static createVirtualASTNode;
}