antlr4ng
Version:
Alternative JavaScript/TypeScript runtime for ANTLR4
97 lines (93 loc) • 3.03 kB
JavaScript
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/atn/LoopEndState.ts
var LoopEndState_exports = {};
__export(LoopEndState_exports, {
LoopEndState: () => LoopEndState
});
module.exports = __toCommonJS(LoopEndState_exports);
// src/atn/ATNState.ts
var ATNState = class _ATNState {
static {
__name(this, "ATNState");
}
static INVALID_STATE_NUMBER = -1;
static INVALID_TYPE = 0;
static BASIC = 1;
static RULE_START = 2;
static BLOCK_START = 3;
static PLUS_BLOCK_START = 4;
static STAR_BLOCK_START = 5;
static TOKEN_START = 6;
static RULE_STOP = 7;
static BLOCK_END = 8;
static STAR_LOOP_BACK = 9;
static STAR_LOOP_ENTRY = 10;
static PLUS_LOOP_BACK = 11;
static LOOP_END = 12;
static stateType = _ATNState.INVALID_STATE_NUMBER;
stateNumber = 0;
ruleIndex = 0;
// at runtime, we don't have Rule objects
epsilonOnlyTransitions = false;
/** Used to cache lookahead during parsing, not used during construction */
nextTokenWithinRule;
/** Track the transitions emanating from this ATN state. */
transitions = [];
hashCode() {
return this.stateNumber;
}
equals(other) {
return this.stateNumber === other.stateNumber;
}
toString() {
return `${this.stateNumber}`;
}
addTransitionAtIndex(index, transition) {
if (this.transitions.length === 0) {
this.epsilonOnlyTransitions = transition.isEpsilon;
} else if (this.epsilonOnlyTransitions !== transition.isEpsilon) {
this.epsilonOnlyTransitions = false;
}
this.transitions.splice(index, 1, transition);
}
addTransition(transition) {
if (this.transitions.length === 0) {
this.epsilonOnlyTransitions = transition.isEpsilon;
} else if (this.epsilonOnlyTransitions !== transition.isEpsilon) {
this.epsilonOnlyTransitions = false;
}
this.transitions.push(transition);
}
setTransition(i, e) {
this.transitions.splice(i, 1, e);
}
removeTransition(index) {
const t = this.transitions.splice(index, 1);
return t[0];
}
};
// src/atn/LoopEndState.ts
var LoopEndState = class extends ATNState {
static {
__name(this, "LoopEndState");
}
static stateType = ATNState.LOOP_END;
loopBackState;
};