UNPKG

antlr4ng

Version:

Alternative JavaScript/TypeScript runtime for ANTLR4

118 lines (113 loc) 3.67 kB
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/StarLoopEntryState.ts var StarLoopEntryState_exports = {}; __export(StarLoopEntryState_exports, { StarLoopEntryState: () => StarLoopEntryState }); module.exports = __toCommonJS(StarLoopEntryState_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/DecisionState.ts var DecisionState = class extends ATNState { static { __name(this, "DecisionState"); } decision = -1; nonGreedy = false; }; // src/atn/StarLoopEntryState.ts var StarLoopEntryState = class extends DecisionState { static { __name(this, "StarLoopEntryState"); } static stateType = ATNState.STAR_LOOP_ENTRY; // This is always set during ATN deserialization loopBackState; /** * Indicates whether this state can benefit from a precedence DFA during SLL * decision making. * * This is a computed property that is calculated during ATN deserialization * and stored for use in {@link ParserATNSimulator} and * {@link ParserInterpreter}. * * @see `DFA.isPrecedenceDfa` */ precedenceRuleDecision = false; };