UNPKG

antlr-ng

Version:

Next generation ANTLR Tool

45 lines (44 loc) 1.39 kB
var __defProp = Object.defineProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); import { MurmurHash } from "../../../support/MurmurHash.js"; import { ListenerDispatchMethod } from "../ListenerDispatchMethod.js"; import { VisitorDispatchMethod } from "../VisitorDispatchMethod.js"; import { StructDecl } from "./StructDecl.js"; class AltLabelStructDecl extends StructDecl { static { __name(this, "AltLabelStructDecl"); } altNum; parentRule; constructor(factory, r, altNum, label) { super(factory, r, factory.getGenerator().target.getAltLabelContextStructName(label)); this.altNum = altNum; this.parentRule = r.name; this.derivedFromName = label; } addDispatchMethods(r) { this.dispatchMethods = new Array(); if (this.generateListener) { this.dispatchMethods.push(new ListenerDispatchMethod(this.factory, true)); this.dispatchMethods.push(new ListenerDispatchMethod(this.factory, false)); } if (this.generateVisitor) { this.dispatchMethods.push(new VisitorDispatchMethod(this.factory)); } } hashCode() { return MurmurHash.hashCode(this.name); } equals(obj) { if (obj === this) { return true; } if (!(obj instanceof AltLabelStructDecl)) { return false; } return this.name === obj.name; } } export { AltLabelStructDecl };