UNPKG

antlr-ng

Version:

Next generation ANTLR Tool

28 lines (27 loc) 792 B
var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); import { TerminalAST } from "../../tool/ast/TerminalAST.js"; import { RuleElement } from "./RuleElement.js"; class MatchToken extends RuleElement { static { __name(this, "MatchToken"); } name; escapedName; ttype = 0; labels = new Array(); constructor(factory, ast) { super(factory, ast); if (ast instanceof TerminalAST) { const g = factory.g; const gen = factory.getGenerator(); this.ttype = g.getTokenType(ast.getText()); const target = gen.target; this.name = target.getTokenTypeAsTargetLabel(g, this.ttype); this.escapedName = target.escapeIfNeeded(this.name); } } } export { MatchToken };