stepcode
Version:
A parser for StepCode
1,217 lines • 759 kB
JavaScript
var sf = Object.defineProperty;
var af = (g, t, a) => t in g ? sf(g, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : g[t] = a;
var m = (g, t, a) => (af(g, typeof t != "symbol" ? t + "" : t, a), a);
/*! For license information please see antlr4.web.js.LICENSE.txt */
var uf = { 92: () => {
} }, Yu = {};
function It(g) {
var t = Yu[g];
if (t !== void 0)
return t.exports;
var a = Yu[g] = { exports: {} };
return uf[g](a, a.exports, It), a.exports;
}
It.d = (g, t) => {
for (var a in t)
It.o(t, a) && !It.o(g, a) && Object.defineProperty(g, a, { enumerable: !0, get: t[a] });
}, It.o = (g, t) => Object.prototype.hasOwnProperty.call(g, t);
var F = {};
(() => {
function g(s) {
return g = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
return typeof e;
} : function(e) {
return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
}, g(s);
}
function t(s, e) {
for (var l = 0; l < e.length; l++) {
var r = e[l];
r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(s, (u = function(o, c) {
if (g(o) !== "object" || o === null)
return o;
var n = o[Symbol.toPrimitive];
if (n !== void 0) {
var i = n.call(o, "string");
if (g(i) !== "object")
return i;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return String(o);
}(r.key), g(u) === "symbol" ? u : String(u)), r);
}
var u;
}
It.d(F, { dx: () => K, q2: () => Go, FO: () => ju, xf: () => Dn, Gy: () => Hu, s4: () => yn, c7: () => Wu, _7: () => ku, gp: () => Lu, cK: () => hn, zs: () => Es, AV: () => Dn, Xp: () => M, VS: () => ct, ul: () => or, hW: () => rt, x1: () => Ee, z5: () => qr, oN: () => ds, TB: () => Cu, u1: () => Qr, _b: () => Ds, $F: () => _u, _T: () => Hs, db: () => Au, Zx: () => X, _x: () => Ct, r8: () => Pt, JI: () => Xe, TP: () => dt, WU: () => a, Nj: () => V, ZP: () => of });
var a = function() {
function s() {
(function(r, u) {
if (!(r instanceof u))
throw new TypeError("Cannot call a class as a function");
})(this, s), this.source = null, this.type = null, this.channel = null, this.start = null, this.stop = null, this.tokenIndex = null, this.line = null, this.column = null, this._text = null;
}
var e, l;
return e = s, (l = [{ key: "getTokenSource", value: function() {
return this.source[0];
} }, { key: "getInputStream", value: function() {
return this.source[1];
} }, { key: "text", get: function() {
return this._text;
}, set: function(r) {
this._text = r;
} }]) && t(e.prototype, l), Object.defineProperty(e, "prototype", { writable: !1 }), s;
}();
function h(s, e) {
if (!Array.isArray(s) || !Array.isArray(e))
return !1;
if (s === e)
return !0;
if (s.length !== e.length)
return !1;
for (var l = 0; l < s.length; l++)
if (!(s[l] === e[l] || s[l].equals && s[l].equals(e[l])))
return !1;
return !0;
}
function E(s) {
return E = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
return typeof e;
} : function(e) {
return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
}, E(s);
}
function w(s, e) {
for (var l = 0; l < e.length; l++) {
var r = e[l];
r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(s, (u = function(o, c) {
if (E(o) !== "object" || o === null)
return o;
var n = o[Symbol.toPrimitive];
if (n !== void 0) {
var i = n.call(o, "string");
if (E(i) !== "object")
return i;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return String(o);
}(r.key), E(u) === "symbol" ? u : String(u)), r);
}
var u;
}
a.INVALID_TYPE = 0, a.EPSILON = -2, a.MIN_USER_TOKEN_TYPE = 1, a.EOF = -1, a.DEFAULT_CHANNEL = 0, a.HIDDEN_CHANNEL = 1;
var P = function() {
function s() {
(function(u, o) {
if (!(u instanceof o))
throw new TypeError("Cannot call a class as a function");
})(this, s), this.count = 0, this.hash = 0;
}
var e, l, r;
return e = s, l = [{ key: "update", value: function() {
for (var u = 0; u < arguments.length; u++) {
var o = arguments[u];
if (o != null)
if (Array.isArray(o))
this.update.apply(this, o);
else {
var c = 0;
switch (E(o)) {
case "undefined":
case "function":
continue;
case "number":
case "boolean":
c = o;
break;
case "string":
c = o.hashCode();
break;
default:
o.updateHashCode ? o.updateHashCode(this) : console.log("No updateHashCode for " + o.toString());
continue;
}
c = (c *= 3432918353) << 15 | c >>> 17, c *= 461845907, this.count = this.count + 1;
var n = this.hash ^ c;
n = 5 * (n = n << 13 | n >>> 19) + 3864292196, this.hash = n;
}
}
} }, { key: "finish", value: function() {
var u = this.hash ^ 4 * this.count;
return u ^= u >>> 16, u *= 2246822507, u ^= u >>> 13, (u *= 3266489909) ^ u >>> 16;
} }], r = [{ key: "hashStuff", value: function() {
var u = new s();
return u.update.apply(u, arguments), u.finish();
} }], l && w(e.prototype, l), r && w(e, r), Object.defineProperty(e, "prototype", { writable: !1 }), s;
}();
function S(s) {
return s ? s.hashCode() : -1;
}
function D(s, e) {
return s ? s.equals(e) : s === e;
}
function j(s) {
return s === null ? "null" : s;
}
function V(s) {
return Array.isArray(s) ? "[" + s.map(j).join(", ") + "]" : "null";
}
function W(s) {
return W = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
return typeof e;
} : function(e) {
return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
}, W(s);
}
function tt(s, e) {
for (var l = 0; l < e.length; l++) {
var r = e[l];
r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(s, (u = function(o, c) {
if (W(o) !== "object" || o === null)
return o;
var n = o[Symbol.toPrimitive];
if (n !== void 0) {
var i = n.call(o, "string");
if (W(i) !== "object")
return i;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return String(o);
}(r.key), W(u) === "symbol" ? u : String(u)), r);
}
var u;
}
var et = "h-", H = function() {
function s(r, u) {
(function(o, c) {
if (!(o instanceof c))
throw new TypeError("Cannot call a class as a function");
})(this, s), this.data = {}, this.hashFunction = r || S, this.equalsFunction = u || D;
}
var e, l;
return e = s, (l = [{ key: "add", value: function(r) {
var u = et + this.hashFunction(r);
if (u in this.data) {
for (var o = this.data[u], c = 0; c < o.length; c++)
if (this.equalsFunction(r, o[c]))
return o[c];
return o.push(r), r;
}
return this.data[u] = [r], r;
} }, { key: "has", value: function(r) {
return this.get(r) != null;
} }, { key: "get", value: function(r) {
var u = et + this.hashFunction(r);
if (u in this.data) {
for (var o = this.data[u], c = 0; c < o.length; c++)
if (this.equalsFunction(r, o[c]))
return o[c];
}
return null;
} }, { key: "values", value: function() {
var r = this;
return Object.keys(this.data).filter(function(u) {
return u.startsWith(et);
}).flatMap(function(u) {
return r.data[u];
}, this);
} }, { key: "toString", value: function() {
return V(this.values());
} }, { key: "length", get: function() {
var r = this;
return Object.keys(this.data).filter(function(u) {
return u.startsWith(et);
}).map(function(u) {
return r.data[u].length;
}, this).reduce(function(u, o) {
return u + o;
}, 0);
} }]) && tt(e.prototype, l), Object.defineProperty(e, "prototype", { writable: !1 }), s;
}();
function Y(s, e) {
if (typeof e != "function" && e !== null)
throw new TypeError("Super expression must either be null or a function");
s.prototype = Object.create(e && e.prototype, { constructor: { value: s, writable: !0, configurable: !0 } }), Object.defineProperty(s, "prototype", { writable: !1 }), e && ot(s, e);
}
function ot(s, e) {
return ot = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(l, r) {
return l.__proto__ = r, l;
}, ot(s, e);
}
function ht(s) {
var e = function() {
if (typeof Reflect > "u" || !Reflect.construct || Reflect.construct.sham)
return !1;
if (typeof Proxy == "function")
return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
})), !0;
} catch {
return !1;
}
}();
return function() {
var l, r = pt(s);
if (e) {
var u = pt(this).constructor;
l = Reflect.construct(r, arguments, u);
} else
l = r.apply(this, arguments);
return function(o, c) {
if (c && (Z(c) === "object" || typeof c == "function"))
return c;
if (c !== void 0)
throw new TypeError("Derived constructors may only return object or undefined");
return function(n) {
if (n === void 0)
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return n;
}(o);
}(this, l);
};
}
function pt(s) {
return pt = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(e) {
return e.__proto__ || Object.getPrototypeOf(e);
}, pt(s);
}
function Z(s) {
return Z = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
return typeof e;
} : function(e) {
return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
}, Z(s);
}
function St(s, e) {
if (!(s instanceof e))
throw new TypeError("Cannot call a class as a function");
}
function yt(s, e) {
for (var l = 0; l < e.length; l++) {
var r = e[l];
r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(s, (u = function(o, c) {
if (Z(o) !== "object" || o === null)
return o;
var n = o[Symbol.toPrimitive];
if (n !== void 0) {
var i = n.call(o, "string");
if (Z(i) !== "object")
return i;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return String(o);
}(r.key), Z(u) === "symbol" ? u : String(u)), r);
}
var u;
}
function gt(s, e, l) {
return e && yt(s.prototype, e), l && yt(s, l), Object.defineProperty(s, "prototype", { writable: !1 }), s;
}
var B = function() {
function s() {
St(this, s);
}
return gt(s, [{ key: "hashCode", value: function() {
var e = new P();
return this.updateHashCode(e), e.finish();
} }, { key: "evaluate", value: function(e, l) {
} }, { key: "evalPrecedence", value: function(e, l) {
return this;
} }], [{ key: "andContext", value: function(e, l) {
if (e === null || e === s.NONE)
return l;
if (l === null || l === s.NONE)
return e;
var r = new ul(e, l);
return r.opnds.length === 1 ? r.opnds[0] : r;
} }, { key: "orContext", value: function(e, l) {
if (e === null)
return l;
if (l === null)
return e;
if (e === s.NONE || l === s.NONE)
return s.NONE;
var r = new cl(e, l);
return r.opnds.length === 1 ? r.opnds[0] : r;
} }]), s;
}(), ul = function(s) {
Y(l, s);
var e = ht(l);
function l(r, u) {
var o;
St(this, l), o = e.call(this);
var c = new H();
r instanceof l ? r.opnds.map(function(f) {
c.add(f);
}) : c.add(r), u instanceof l ? u.opnds.map(function(f) {
c.add(f);
}) : c.add(u);
var n = ba(c);
if (n.length > 0) {
var i = null;
n.map(function(f) {
(i === null || f.precedence < i.precedence) && (i = f);
}), c.add(i);
}
return o.opnds = Array.from(c.values()), o;
}
return gt(l, [{ key: "equals", value: function(r) {
return this === r || r instanceof l && h(this.opnds, r.opnds);
} }, { key: "updateHashCode", value: function(r) {
r.update(this.opnds, "AND");
} }, { key: "evaluate", value: function(r, u) {
for (var o = 0; o < this.opnds.length; o++)
if (!this.opnds[o].evaluate(r, u))
return !1;
return !0;
} }, { key: "evalPrecedence", value: function(r, u) {
for (var o = !1, c = [], n = 0; n < this.opnds.length; n++) {
var i = this.opnds[n], f = i.evalPrecedence(r, u);
if (o |= f !== i, f === null)
return null;
f !== B.NONE && c.push(f);
}
if (!o)
return this;
if (c.length === 0)
return B.NONE;
var y = null;
return c.map(function(p) {
y = y === null ? p : B.andContext(y, p);
}), y;
} }, { key: "toString", value: function() {
var r = this.opnds.map(function(u) {
return u.toString();
});
return (r.length > 3 ? r.slice(3) : r).join("&&");
} }]), l;
}(B), cl = function(s) {
Y(l, s);
var e = ht(l);
function l(r, u) {
var o;
St(this, l), o = e.call(this);
var c = new H();
r instanceof l ? r.opnds.map(function(y) {
c.add(y);
}) : c.add(r), u instanceof l ? u.opnds.map(function(y) {
c.add(y);
}) : c.add(u);
var n = ba(c);
if (n.length > 0) {
var i = n.sort(function(y, p) {
return y.compareTo(p);
}), f = i[i.length - 1];
c.add(f);
}
return o.opnds = Array.from(c.values()), o;
}
return gt(l, [{ key: "equals", value: function(r) {
return this === r || r instanceof l && h(this.opnds, r.opnds);
} }, { key: "updateHashCode", value: function(r) {
r.update(this.opnds, "OR");
} }, { key: "evaluate", value: function(r, u) {
for (var o = 0; o < this.opnds.length; o++)
if (this.opnds[o].evaluate(r, u))
return !0;
return !1;
} }, { key: "evalPrecedence", value: function(r, u) {
for (var o = !1, c = [], n = 0; n < this.opnds.length; n++) {
var i = this.opnds[n], f = i.evalPrecedence(r, u);
if (o |= f !== i, f === B.NONE)
return B.NONE;
f !== null && c.push(f);
}
return o ? (c.length === 0 || c.map(function(y) {
return y;
}), null) : this;
} }, { key: "toString", value: function() {
var r = this.opnds.map(function(u) {
return u.toString();
});
return (r.length > 3 ? r.slice(3) : r).join("||");
} }]), l;
}(B);
function ba(s) {
var e = [];
return s.values().map(function(l) {
l instanceof B.PrecedencePredicate && e.push(l);
}), e;
}
function Ge(s) {
return Ge = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
return typeof e;
} : function(e) {
return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
}, Ge(s);
}
function ll(s, e) {
for (var l = 0; l < e.length; l++) {
var r = e[l];
r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(s, (u = function(o, c) {
if (Ge(o) !== "object" || o === null)
return o;
var n = o[Symbol.toPrimitive];
if (n !== void 0) {
var i = n.call(o, "string");
if (Ge(i) !== "object")
return i;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return String(o);
}(r.key), Ge(u) === "symbol" ? u : String(u)), r);
}
var u;
}
function ga(s, e) {
if (s === null) {
var l = { state: null, alt: null, context: null, semanticContext: null };
return e && (l.reachesIntoOuterContext = 0), l;
}
var r = {};
return r.state = s.state || null, r.alt = s.alt === void 0 ? null : s.alt, r.context = s.context || null, r.semanticContext = s.semanticContext || null, e && (r.reachesIntoOuterContext = s.reachesIntoOuterContext || 0, r.precedenceFilterSuppressed = s.precedenceFilterSuppressed || !1), r;
}
var Q = function() {
function s(r, u) {
(function(o, c) {
if (!(o instanceof c))
throw new TypeError("Cannot call a class as a function");
})(this, s), this.checkContext(r, u), r = ga(r), u = ga(u, !0), this.state = r.state !== null ? r.state : u.state, this.alt = r.alt !== null ? r.alt : u.alt, this.context = r.context !== null ? r.context : u.context, this.semanticContext = r.semanticContext !== null ? r.semanticContext : u.semanticContext !== null ? u.semanticContext : B.NONE, this.reachesIntoOuterContext = u.reachesIntoOuterContext, this.precedenceFilterSuppressed = u.precedenceFilterSuppressed;
}
var e, l;
return e = s, (l = [{ key: "checkContext", value: function(r, u) {
r.context !== null && r.context !== void 0 || u !== null && u.context !== null && u.context !== void 0 || (this.context = null);
} }, { key: "hashCode", value: function() {
var r = new P();
return this.updateHashCode(r), r.finish();
} }, { key: "updateHashCode", value: function(r) {
r.update(this.state.stateNumber, this.alt, this.context, this.semanticContext);
} }, { key: "equals", value: function(r) {
return this === r || r instanceof s && this.state.stateNumber === r.state.stateNumber && this.alt === r.alt && (this.context === null ? r.context === null : this.context.equals(r.context)) && this.semanticContext.equals(r.semanticContext) && this.precedenceFilterSuppressed === r.precedenceFilterSuppressed;
} }, { key: "hashCodeForConfigSet", value: function() {
var r = new P();
return r.update(this.state.stateNumber, this.alt, this.semanticContext), r.finish();
} }, { key: "equalsForConfigSet", value: function(r) {
return this === r || r instanceof s && this.state.stateNumber === r.state.stateNumber && this.alt === r.alt && this.semanticContext.equals(r.semanticContext);
} }, { key: "toString", value: function() {
return "(" + this.state + "," + this.alt + (this.context !== null ? ",[" + this.context.toString() + "]" : "") + (this.semanticContext !== B.NONE ? "," + this.semanticContext.toString() : "") + (this.reachesIntoOuterContext > 0 ? ",up=" + this.reachesIntoOuterContext : "") + ")";
} }]) && ll(e.prototype, l), Object.defineProperty(e, "prototype", { writable: !1 }), s;
}();
function Ye(s) {
return Ye = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
return typeof e;
} : function(e) {
return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
}, Ye(s);
}
function fl(s, e) {
for (var l = 0; l < e.length; l++) {
var r = e[l];
r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(s, (u = function(o, c) {
if (Ye(o) !== "object" || o === null)
return o;
var n = o[Symbol.toPrimitive];
if (n !== void 0) {
var i = n.call(o, "string");
if (Ye(i) !== "object")
return i;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return String(o);
}(r.key), Ye(u) === "symbol" ? u : String(u)), r);
}
var u;
}
var M = function() {
function s(r, u) {
(function(o, c) {
if (!(o instanceof c))
throw new TypeError("Cannot call a class as a function");
})(this, s), this.start = r, this.stop = u;
}
var e, l;
return e = s, (l = [{ key: "clone", value: function() {
return new s(this.start, this.stop);
} }, { key: "contains", value: function(r) {
return r >= this.start && r < this.stop;
} }, { key: "toString", value: function() {
return this.start === this.stop - 1 ? this.start.toString() : this.start.toString() + ".." + (this.stop - 1).toString();
} }, { key: "length", get: function() {
return this.stop - this.start;
} }]) && fl(e.prototype, l), Object.defineProperty(e, "prototype", { writable: !1 }), s;
}();
function qe(s) {
return qe = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
return typeof e;
} : function(e) {
return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
}, qe(s);
}
function hl(s, e) {
for (var l = 0; l < e.length; l++) {
var r = e[l];
r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(s, (u = function(o, c) {
if (qe(o) !== "object" || o === null)
return o;
var n = o[Symbol.toPrimitive];
if (n !== void 0) {
var i = n.call(o, "string");
if (qe(i) !== "object")
return i;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return String(o);
}(r.key), qe(u) === "symbol" ? u : String(u)), r);
}
var u;
}
M.INVALID_INTERVAL = new M(-1, -2);
var ct = function() {
function s() {
(function(r, u) {
if (!(r instanceof u))
throw new TypeError("Cannot call a class as a function");
})(this, s), this.intervals = null, this.readOnly = !1;
}
var e, l;
return e = s, (l = [{ key: "first", value: function(r) {
return this.intervals === null || this.intervals.length === 0 ? a.INVALID_TYPE : this.intervals[0].start;
} }, { key: "addOne", value: function(r) {
this.addInterval(new M(r, r + 1));
} }, { key: "addRange", value: function(r, u) {
this.addInterval(new M(r, u + 1));
} }, { key: "addInterval", value: function(r) {
if (this.intervals === null)
this.intervals = [], this.intervals.push(r.clone());
else {
for (var u = 0; u < this.intervals.length; u++) {
var o = this.intervals[u];
if (r.stop < o.start)
return void this.intervals.splice(u, 0, r);
if (r.stop === o.start)
return void (this.intervals[u] = new M(r.start, o.stop));
if (r.start <= o.stop)
return this.intervals[u] = new M(Math.min(o.start, r.start), Math.max(o.stop, r.stop)), void this.reduce(u);
}
this.intervals.push(r.clone());
}
} }, { key: "addSet", value: function(r) {
var u = this;
return r.intervals !== null && r.intervals.forEach(function(o) {
return u.addInterval(o);
}, this), this;
} }, { key: "reduce", value: function(r) {
if (r < this.intervals.length - 1) {
var u = this.intervals[r], o = this.intervals[r + 1];
u.stop >= o.stop ? (this.intervals.splice(r + 1, 1), this.reduce(r)) : u.stop >= o.start && (this.intervals[r] = new M(u.start, o.stop), this.intervals.splice(r + 1, 1));
}
} }, { key: "complement", value: function(r, u) {
var o = new s();
return o.addInterval(new M(r, u + 1)), this.intervals !== null && this.intervals.forEach(function(c) {
return o.removeRange(c);
}), o;
} }, { key: "contains", value: function(r) {
if (this.intervals === null)
return !1;
for (var u = 0; u < this.intervals.length; u++)
if (this.intervals[u].contains(r))
return !0;
return !1;
} }, { key: "removeRange", value: function(r) {
if (r.start === r.stop - 1)
this.removeOne(r.start);
else if (this.intervals !== null)
for (var u = 0, o = 0; o < this.intervals.length; o++) {
var c = this.intervals[u];
if (r.stop <= c.start)
return;
if (r.start > c.start && r.stop < c.stop) {
this.intervals[u] = new M(c.start, r.start);
var n = new M(r.stop, c.stop);
return void this.intervals.splice(u, 0, n);
}
r.start <= c.start && r.stop >= c.stop ? (this.intervals.splice(u, 1), u -= 1) : r.start < c.stop ? this.intervals[u] = new M(c.start, r.start) : r.stop < c.stop && (this.intervals[u] = new M(r.stop, c.stop)), u += 1;
}
} }, { key: "removeOne", value: function(r) {
if (this.intervals !== null)
for (var u = 0; u < this.intervals.length; u++) {
var o = this.intervals[u];
if (r < o.start)
return;
if (r === o.start && r === o.stop - 1)
return void this.intervals.splice(u, 1);
if (r === o.start)
return void (this.intervals[u] = new M(o.start + 1, o.stop));
if (r === o.stop - 1)
return void (this.intervals[u] = new M(o.start, o.stop - 1));
if (r < o.stop - 1) {
var c = new M(o.start, r);
return o.start = r + 1, void this.intervals.splice(u, 0, c);
}
}
} }, { key: "toString", value: function(r, u, o) {
return r = r || null, u = u || null, o = o || !1, this.intervals === null ? "{}" : r !== null || u !== null ? this.toTokenString(r, u) : o ? this.toCharString() : this.toIndexString();
} }, { key: "toCharString", value: function() {
for (var r = [], u = 0; u < this.intervals.length; u++) {
var o = this.intervals[u];
o.stop === o.start + 1 ? o.start === a.EOF ? r.push("<EOF>") : r.push("'" + String.fromCharCode(o.start) + "'") : r.push("'" + String.fromCharCode(o.start) + "'..'" + String.fromCharCode(o.stop - 1) + "'");
}
return r.length > 1 ? "{" + r.join(", ") + "}" : r[0];
} }, { key: "toIndexString", value: function() {
for (var r = [], u = 0; u < this.intervals.length; u++) {
var o = this.intervals[u];
o.stop === o.start + 1 ? o.start === a.EOF ? r.push("<EOF>") : r.push(o.start.toString()) : r.push(o.start.toString() + ".." + (o.stop - 1).toString());
}
return r.length > 1 ? "{" + r.join(", ") + "}" : r[0];
} }, { key: "toTokenString", value: function(r, u) {
for (var o = [], c = 0; c < this.intervals.length; c++)
for (var n = this.intervals[c], i = n.start; i < n.stop; i++)
o.push(this.elementName(r, u, i));
return o.length > 1 ? "{" + o.join(", ") + "}" : o[0];
} }, { key: "elementName", value: function(r, u, o) {
return o === a.EOF ? "<EOF>" : o === a.EPSILON ? "<EPSILON>" : r[o] || u[o];
} }, { key: "length", get: function() {
return this.intervals.map(function(r) {
return r.length;
}).reduce(function(r, u) {
return r + u;
});
} }]) && hl(e.prototype, l), Object.defineProperty(e, "prototype", { writable: !1 }), s;
}();
function ze(s) {
return ze = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
return typeof e;
} : function(e) {
return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
}, ze(s);
}
function pl(s, e) {
for (var l = 0; l < e.length; l++) {
var r = e[l];
r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(s, (u = function(o, c) {
if (ze(o) !== "object" || o === null)
return o;
var n = o[Symbol.toPrimitive];
if (n !== void 0) {
var i = n.call(o, "string");
if (ze(i) !== "object")
return i;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return String(o);
}(r.key), ze(u) === "symbol" ? u : String(u)), r);
}
var u;
}
var C = function() {
function s() {
(function(r, u) {
if (!(r instanceof u))
throw new TypeError("Cannot call a class as a function");
})(this, s), this.atn = null, this.stateNumber = s.INVALID_STATE_NUMBER, this.stateType = null, this.ruleIndex = 0, this.epsilonOnlyTransitions = !1, this.transitions = [], this.nextTokenWithinRule = null;
}
var e, l;
return e = s, (l = [{ key: "toString", value: function() {
return this.stateNumber;
} }, { key: "equals", value: function(r) {
return r instanceof s && this.stateNumber === r.stateNumber;
} }, { key: "isNonGreedyExitState", value: function() {
return !1;
} }, { key: "addTransition", value: function(r, u) {
u === void 0 && (u = -1), this.transitions.length === 0 ? this.epsilonOnlyTransitions = r.isEpsilon : this.epsilonOnlyTransitions !== r.isEpsilon && (this.epsilonOnlyTransitions = !1), u === -1 ? this.transitions.push(r) : this.transitions.splice(u, 1, r);
} }]) && pl(e.prototype, l), Object.defineProperty(e, "prototype", { writable: !1 }), s;
}();
function Ri(s) {
return Ri = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
return typeof e;
} : function(e) {
return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
}, Ri(s);
}
function xi(s, e) {
return xi = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(l, r) {
return l.__proto__ = r, l;
}, xi(s, e);
}
function Ea(s, e) {
if (e && (Ri(e) === "object" || typeof e == "function"))
return e;
if (e !== void 0)
throw new TypeError("Derived constructors may only return object or undefined");
return Ra(s);
}
function Ra(s) {
if (s === void 0)
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return s;
}
function Vn(s) {
return Vn = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(e) {
return e.__proto__ || Object.getPrototypeOf(e);
}, Vn(s);
}
C.INVALID_TYPE = 0, C.BASIC = 1, C.RULE_START = 2, C.BLOCK_START = 3, C.PLUS_BLOCK_START = 4, C.STAR_BLOCK_START = 5, C.TOKEN_START = 6, C.RULE_STOP = 7, C.BLOCK_END = 8, C.STAR_LOOP_BACK = 9, C.STAR_LOOP_ENTRY = 10, C.PLUS_LOOP_BACK = 11, C.LOOP_END = 12, C.serializationNames = ["INVALID", "BASIC", "RULE_START", "BLOCK_START", "PLUS_BLOCK_START", "STAR_BLOCK_START", "TOKEN_START", "RULE_STOP", "BLOCK_END", "STAR_LOOP_BACK", "STAR_LOOP_ENTRY", "PLUS_LOOP_BACK", "LOOP_END"], C.INVALID_STATE_NUMBER = -1;
var st = function(s) {
(function(c, n) {
if (typeof n != "function" && n !== null)
throw new TypeError("Super expression must either be null or a function");
c.prototype = Object.create(n && n.prototype, { constructor: { value: c, writable: !0, configurable: !0 } }), Object.defineProperty(c, "prototype", { writable: !1 }), n && xi(c, n);
})(o, s);
var e, l, r, u = (l = o, r = function() {
if (typeof Reflect > "u" || !Reflect.construct || Reflect.construct.sham)
return !1;
if (typeof Proxy == "function")
return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
})), !0;
} catch {
return !1;
}
}(), function() {
var c, n = Vn(l);
if (r) {
var i = Vn(this).constructor;
c = Reflect.construct(n, arguments, i);
} else
c = n.apply(this, arguments);
return Ea(this, c);
});
function o() {
var c;
return function(n, i) {
if (!(n instanceof i))
throw new TypeError("Cannot call a class as a function");
}(this, o), (c = u.call(this)).stateType = C.RULE_STOP, Ea(c, Ra(c));
}
return e = o, Object.defineProperty(e, "prototype", { writable: !1 }), e;
}(C);
function $e(s) {
return $e = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
return typeof e;
} : function(e) {
return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
}, $e(s);
}
function xa(s, e) {
for (var l = 0; l < e.length; l++) {
var r = e[l];
r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(s, (u = function(o, c) {
if ($e(o) !== "object" || o === null)
return o;
var n = o[Symbol.toPrimitive];
if (n !== void 0) {
var i = n.call(o, "string");
if ($e(i) !== "object")
return i;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return String(o);
}(r.key), $e(u) === "symbol" ? u : String(u)), r);
}
var u;
}
function yl(s, e, l) {
return e && xa(s.prototype, e), l && xa(s, l), Object.defineProperty(s, "prototype", { writable: !1 }), s;
}
var k = yl(function s(e) {
if (function(l, r) {
if (!(l instanceof r))
throw new TypeError("Cannot call a class as a function");
}(this, s), e == null)
throw "target cannot be null.";
this.target = e, this.isEpsilon = !1, this.label = null;
});
function jt(s) {
return jt = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
return typeof e;
} : function(e) {
return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
}, jt(s);
}
function dl(s, e) {
for (var l = 0; l < e.length; l++) {
var r = e[l];
r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(s, (u = function(o, c) {
if (jt(o) !== "object" || o === null)
return o;
var n = o[Symbol.toPrimitive];
if (n !== void 0) {
var i = n.call(o, "string");
if (jt(i) !== "object")
return i;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return String(o);
}(r.key), jt(u) === "symbol" ? u : String(u)), r);
}
var u;
}
function Ti(s, e) {
return Ti = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(l, r) {
return l.__proto__ = r, l;
}, Ti(s, e);
}
function Wn(s) {
return Wn = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(e) {
return e.__proto__ || Object.getPrototypeOf(e);
}, Wn(s);
}
k.EPSILON = 1, k.RANGE = 2, k.RULE = 3, k.PREDICATE = 4, k.ATOM = 5, k.ACTION = 6, k.SET = 7, k.NOT_SET = 8, k.WILDCARD = 9, k.PRECEDENCE = 10, k.serializationNames = ["INVALID", "EPSILON", "RANGE", "RULE", "PREDICATE", "ATOM", "ACTION", "SET", "NOT_SET", "WILDCARD", "PRECEDENCE"], k.serializationTypes = { EpsilonTransition: k.EPSILON, RangeTransition: k.RANGE, RuleTransition: k.RULE, PredicateTransition: k.PREDICATE, AtomTransition: k.ATOM, ActionTransition: k.ACTION, SetTransition: k.SET, NotSetTransition: k.NOT_SET, WildcardTransition: k.WILDCARD, PrecedencePredicateTransition: k.PRECEDENCE };
var Kn = function(s) {
(function(n, i) {
if (typeof i != "function" && i !== null)
throw new TypeError("Super expression must either be null or a function");
n.prototype = Object.create(i && i.prototype, { constructor: { value: n, writable: !0, configurable: !0 } }), Object.defineProperty(n, "prototype", { writable: !1 }), i && Ti(n, i);
})(c, s);
var e, l, r, u, o = (r = c, u = function() {
if (typeof Reflect > "u" || !Reflect.construct || Reflect.construct.sham)
return !1;
if (typeof Proxy == "function")
return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
})), !0;
} catch {
return !1;
}
}(), function() {
var n, i = Wn(r);
if (u) {
var f = Wn(this).constructor;
n = Reflect.construct(i, arguments, f);
} else
n = i.apply(this, arguments);
return function(y, p) {
if (p && (jt(p) === "object" || typeof p == "function"))
return p;
if (p !== void 0)
throw new TypeError("Derived constructors may only return object or undefined");
return function(v) {
if (v === void 0)
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return v;
}(y);
}(this, n);
});
function c(n, i, f, y) {
var p;
return function(v, R) {
if (!(v instanceof R))
throw new TypeError("Cannot call a class as a function");
}(this, c), (p = o.call(this, n)).ruleIndex = i, p.precedence = f, p.followState = y, p.serializationType = k.RULE, p.isEpsilon = !0, p;
}
return e = c, (l = [{ key: "matches", value: function(n, i, f) {
return !1;
} }]) && dl(e.prototype, l), Object.defineProperty(e, "prototype", { writable: !1 }), c;
}(k);
function Dt(s) {
return Dt = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
return typeof e;
} : function(e) {
return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
}, Dt(s);
}
function ml(s, e) {
for (var l = 0; l < e.length; l++) {
var r = e[l];
r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(s, (u = function(o, c) {
if (Dt(o) !== "object" || o === null)
return o;
var n = o[Symbol.toPrimitive];
if (n !== void 0) {
var i = n.call(o, "string");
if (Dt(i) !== "object")
return i;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return String(o);
}(r.key), Dt(u) === "symbol" ? u : String(u)), r);
}
var u;
}
function Oi(s, e) {
return Oi = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(l, r) {
return l.__proto__ = r, l;
}, Oi(s, e);
}
function Gn(s) {
return Gn = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(e) {
return e.__proto__ || Object.getPrototypeOf(e);
}, Gn(s);
}
var Si = function(s) {
(function(n, i) {
if (typeof i != "function" && i !== null)
throw new TypeError("Super expression must either be null or a function");
n.prototype = Object.create(i && i.prototype, { constructor: { value: n, writable: !0, configurable: !0 } }), Object.defineProperty(n, "prototype", { writable: !1 }), i && Oi(n, i);
})(c, s);
var e, l, r, u, o = (r = c, u = function() {
if (typeof Reflect > "u" || !Reflect.construct || Reflect.construct.sham)
return !1;
if (typeof Proxy == "function")
return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
})), !0;
} catch {
return !1;
}
}(), function() {
var n, i = Gn(r);
if (u) {
var f = Gn(this).constructor;
n = Reflect.construct(i, arguments, f);
} else
n = i.apply(this, arguments);
return function(y, p) {
if (p && (Dt(p) === "object" || typeof p == "function"))
return p;
if (p !== void 0)
throw new TypeError("Derived constructors may only return object or undefined");
return function(v) {
if (v === void 0)
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return v;
}(y);
}(this, n);
});
function c(n, i) {
var f;
return function(y, p) {
if (!(y instanceof p))
throw new TypeError("Cannot call a class as a function");
}(this, c), (f = o.call(this, n)).serializationType = k.SET, i != null ? f.label = i : (f.label = new ct(), f.label.addOne(a.INVALID_TYPE)), f;
}
return e = c, (l = [{ key: "matches", value: function(n, i, f) {
return this.label.contains(n);
} }, { key: "toString", value: function() {
return this.label.toString();
} }]) && ml(e.prototype, l), Object.defineProperty(e, "prototype", { writable: !1 }), c;
}(k);
function Ut(s) {
return Ut = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
return typeof e;
} : function(e) {
return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
}, Ut(s);
}
function vl(s, e) {
for (var l = 0; l < e.length; l++) {
var r = e[l];
r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(s, (u = function(o, c) {
if (Ut(o) !== "object" || o === null)
return o;
var n = o[Symbol.toPrimitive];
if (n !== void 0) {
var i = n.call(o, "string");
if (Ut(i) !== "object")
return i;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return String(o);
}(r.key), Ut(u) === "symbol" ? u : String(u)), r);
}
var u;
}
function Yn() {
return Yn = typeof Reflect < "u" && Reflect.get ? Reflect.get.bind() : function(s, e, l) {
var r = function(o, c) {
for (; !Object.prototype.hasOwnProperty.call(o, c) && (o = At(o)) !== null; )
;
return o;
}(s, e);
if (r) {
var u = Object.getOwnPropertyDescriptor(r, e);
return u.get ? u.get.call(arguments.length < 3 ? s : l) : u.value;
}
}, Yn.apply(this, arguments);
}
function wi(s, e) {
return wi = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(l, r) {
return l.__proto__ = r, l;
}, wi(s, e);
}
function At(s) {
return At = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(e) {
return e.__proto__ || Object.getPrototypeOf(e);
}, At(s);
}
var _i = function(s) {
(function(n, i) {
if (typeof i != "function" && i !== null)
throw new TypeError("Super expression must either be null or a function");
n.prototype = Object.create(i && i.prototype, { constructor: { value: n, writable: !0, configurable: !0 } }), Object.defineProperty(n, "prototype", { writable: !1 }), i && wi(n, i);
})(c, s);
var e, l, r, u, o = (r = c, u = function() {
if (typeof Reflect > "u" || !Reflect.construct || Reflect.construct.sham)
return !1;
if (typeof Proxy == "function")
return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
})), !0;
} catch {
return !1;
}
}(), function() {
var n, i = At(r);
if (u) {
var f = At(this).constructor;
n = Reflect.construct(i, arguments, f);
} else
n = i.apply(this, arguments);
return function(y, p) {
if (p && (Ut(p) === "object" || typeof p == "function"))
return p;
if (p !== void 0)
throw new TypeError("Derived constructors may only return object or undefined");
return function(v) {
if (v === void 0)
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return v;
}(y);
}(this, n);
});
function c(n, i) {
var f;
return function(y, p) {
if (!(y instanceof p))
throw new TypeError("Cannot call a class as a function");
}(this, c), (f = o.call(this, n, i)).serializationType = k.NOT_SET, f;
}
return e = c, (l = [{ key: "matches", value: function(n, i, f) {
return n >= i && n <= f && !Yn(At(c.prototype), "matches", this).call(this, n, i, f);
} }, { key: "toString", value: function() {
return "~" + Yn(At(c.prototype), "toString", this).call(this);
} }]) && vl(e.prototype, l), Object.defineProperty(e, "prototype", { writable: !1 }), c;
}(Si);
function Ft(s) {
return Ft = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
return typeof e;
} : function(e) {
return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
}, Ft(s);
}
function bl(s, e) {
for (var l = 0; l < e.length; l++) {
var r = e[l];
r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(s, (u = function(o, c) {
if (Ft(o) !== "object" || o === null)
return o;
var n = o[Symbol.toPrimitive];
if (n !== void 0) {
var i = n.call(o, "string");
if (Ft(i) !== "object")
return i;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return String(o);
}(r.key), Ft(u) === "symbol" ? u : String(u)), r);
}
var u;
}
function Ai(s, e) {
return Ai = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(l, r) {
return l.__proto__ = r, l;
}, Ai(s, e);
}
function qn(s) {
return qn = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(e) {
return e.__proto__ || Object.getPrototypeOf(e);
}, qn(s);
}
var Ta = function(s) {
(function(n, i) {
if (typeof i != "function" && i !== null)
throw new TypeError("Super expression must either be null or a function");
n.prototype = Object.create(i && i.prototype, { constructor: { value: n, writable: !0, configurable: !0 } }), Object.defineProperty(n, "prototype", { writable: !1 }), i && Ai(n, i);
})(c, s);
var e, l, r, u, o = (r = c, u = function() {
if (typeof Reflect > "u" || !Reflect.construct || Reflect.construct.sham)
return !1;
if (typeof Proxy == "function")
return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
})), !0;
} catch {
return !1;
}
}(), function() {
var n, i = qn(r);
if (u) {
var f = qn(this).constructor;
n = Reflect.construct(i, arguments, f);
} else
n = i.apply(this, arguments);
return function(y, p) {
if (p && (Ft(p) === "object" || typeof p == "function"))
return p;
if (p !== void 0)
throw new TypeError("Derived constructors may only return object or undefined");
return function(v) {
if (v === void 0)
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return v;
}(y);
}(this, n);
});
function c(n) {
var i;
return function(f, y) {
if (!(f instanceof y))
throw new TypeError("Cannot call a class as a function");
}(this, c), (i = o.call(this, n)).serializationType = k.WILDCARD, i;
}
return e = c, (l = [{ key: "matches", value: function(n, i, f) {
return n >= i && n <= f;
} }, { key: "toString", value: function() {
return ".";
} }]) && bl(e.prototype, l), Object.defineProperty(e, "prototype", { writable: !1 }), c;
}(k);
function Pi(s) {
return Pi = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
return typeof e;
} : function(e) {
return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
}, Pi(s);
}
function ki(s, e) {
return ki = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(l, r) {
return l.__proto__ = r, l;
}, ki(s, e);
}
function zn(s) {
return zn = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(e) {
return e.__proto__ || Object.getPrototypeOf(e);
}, zn(s);
}
var Ci = function(s) {
(function(c, n) {
if (typeof n != "function" && n !== null)
throw new TypeError("Super expression must either be null or a function");
c.prototype = Object.create(n && n.prototype, { constructor: { value: c, writable: !0, configurable: !0 } }), Object.defineProperty(c, "prototype", { writable: !1 }), n && ki(c, n);
})(o, s);
var e, l, r, u = (l = o, r = function() {
if (typeof Reflect > "u" || !Reflect.construct || Reflect.construct.sham)
return !1;
if (typeof Proxy == "function")
return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
})), !0;
} catch {
return !1;
}
}(), function() {
var c, n = zn(l);
if (r) {
var i = zn(this).constructor;
c = Reflect.construct(n, arguments, i);
} else
c = n.apply(this, arguments);
return function(f, y) {
if (y && (Pi(y) === "object" || typeof y == "function"))
return y;
if (y !== voi