antlr-ng
Version:
Next generation ANTLR Tool
34 lines (33 loc) • 1.91 kB
TypeScript
import { type Token } from "antlr4ng";
import { IActionSplitterListener } from "../parse/IActionSplitterListener.js";
import { ActionAST } from "../tool/ast/ActionAST.js";
import { IOutputModelFactory } from "./IOutputModelFactory.js";
import { RuleFunction } from "./model/RuleFunction.js";
import { ActionChunk } from "./model/chunk/ActionChunk.js";
import { RulePropertyRef } from "./model/chunk/RulePropertyRef.js";
import { TokenPropertyRef } from "./model/chunk/TokenPropertyRef.js";
export declare class ActionTranslator implements IActionSplitterListener {
static readonly thisRulePropToModelMap: Map<string, typeof RulePropertyRef>;
static readonly rulePropToModelMap: Map<string, typeof RulePropertyRef>;
static readonly tokenPropToModelMap: Map<string, typeof TokenPropertyRef>;
private readonly gen;
private readonly target;
private readonly node;
private rf?;
private readonly chunks;
private readonly factory;
private nodeContext;
constructor(factory: IOutputModelFactory, node: ActionAST);
static translateAction(factory: IOutputModelFactory, rf: RuleFunction | null, tokenWithinAction: Token | null, node: ActionAST): ActionChunk[];
static translateActionChunk(factory: IOutputModelFactory, rf: RuleFunction | null, action: string, node: ActionAST, refToken?: Token): ActionChunk[];
attr(_expr: string, x: Token): void;
qualifiedAttr(expr: string, x: Token, y: Token): void;
setAttr(_expr: string, x: Token, rhs: Token): void;
nonLocalAttr(_expr: string, x: Token, y: Token): void;
setNonLocalAttr(_expr: string, x: Token, y: Token, rhs: string): void;
text(text: string): void;
getTokenLabel(x: string): string;
getRuleLabel(x: string): string;
protected getTokenPropertyRef(x: string, y: string): TokenPropertyRef;
protected getRulePropertyRef(x: string | undefined, prop: string): RulePropertyRef;
}