antlr-ng
Version:
Next generation ANTLR Tool
46 lines (45 loc) • 1.01 kB
JavaScript
var __defProp = Object.defineProperty;
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
import { GrammarASTWithOptions } from "./GrammarASTWithOptions.js";
class ActionAST extends GrammarASTWithOptions {
static {
__name(this, "ActionAST");
}
astType = "ActionAST";
resolver;
chunks;
// Alt, rule, grammar space
scope = null;
constructor(...args) {
if (args.length === 1) {
if (typeof args[0] === "number") {
super(args[0]);
} else if (args[0] instanceof ActionAST) {
const [node] = args;
super(node);
this.resolver = node.resolver;
this.chunks = node.chunks;
} else {
super(args[0]);
}
} else {
const [type, t] = args;
super(type, t);
}
}
dupNode() {
return new ActionAST(this);
}
visit(v) {
return v.visit(this);
}
setScope(scope) {
this.scope = scope;
}
getScope() {
return this.scope;
}
}
export {
ActionAST
};