antlr-ng
Version:
Next generation ANTLR Tool
26 lines (25 loc) • 1.07 kB
TypeScript
import { Tool } from "../Tool.js";
import type { SupportedLanguage } from "../codegen/CodeGenerator.js";
import { Grammar } from "../tool/Grammar.js";
import { LeftRecursiveRule } from "../tool/LeftRecursiveRule.js";
import { Rule } from "../tool/Rule.js";
import { GrammarRootAST } from "../tool/ast/GrammarRootAST.js";
import { RuleAST } from "../tool/ast/RuleAST.js";
/**
* Remove left-recursive rule refs, add precedence args to recursive rule refs.
* Rewrite rule so we can create ATN.
*
* MODIFIES grammar AST in place.
*/
export declare class LeftRecursiveRuleTransformer {
ast: GrammarRootAST;
rules: Rule[];
g: Grammar;
tool: Tool;
constructor(ast: GrammarRootAST, rules: Rule[], g: Grammar);
translateLeftRecursiveRules(): void;
/** @returns true if successful */
translateLeftRecursiveRule(context: GrammarRootAST, r: LeftRecursiveRule, language: SupportedLanguage): boolean;
parseArtificialRule(g: Grammar, ruleText: string): RuleAST | undefined;
setAltASTPointers(r: LeftRecursiveRule, t: RuleAST): void;
}