UNPKG

igniteui-react-core

Version:
758 lines (757 loc) 23.4 kB
/* THIS INFRAGISTICS ULTIMATE SOFTWARE LICENSE AGREEMENT ("AGREEMENT") LOCATED HERE: https://www.infragistics.com/legal/license/igultimate-la https://www.infragistics.com/legal/license/igultimate-eula GOVERNS THE LICENSING, INSTALLATION AND USE OF INFRAGISTICS SOFTWARE. BY DOWNLOADING AND/OR INSTALLING AND USING INFRAGISTICS SOFTWARE: you are indicating that you have read and understand this Agreement, and agree to be legally bound by it on behalf of the yourself and your company. */ import { __extends } from "tslib"; import { Base, markType } from "./type"; import { FilterSyntaxParseResult } from "./FilterSyntaxParseResult"; import { FilterSyntaxLexer } from "./FilterSyntaxLexer"; import { List$1 } from "./List$1"; import { FilterSyntaxExpressionSyntax } from "./FilterSyntaxExpressionSyntax"; import { FilterSyntaxBinaryOperatorExpressionSyntax } from "./FilterSyntaxBinaryOperatorExpressionSyntax"; import { FilterSyntaxUnaryOperatorExpressionSyntax } from "./FilterSyntaxUnaryOperatorExpressionSyntax"; import { FilterSyntaxParenthesisExpressionSyntax } from "./FilterSyntaxParenthesisExpressionSyntax"; import { FilterSyntaxMemberExpressionSyntax } from "./FilterSyntaxMemberExpressionSyntax"; import { FilterSyntaxIdentifierExpressionSyntax } from "./FilterSyntaxIdentifierExpressionSyntax"; import { FilterSyntaxMethodCallExpressionSyntax } from "./FilterSyntaxMethodCallExpressionSyntax"; import { InvalidOperationException } from "./InvalidOperationException"; import { FilterSyntaxNullExpressionSyntax } from "./FilterSyntaxNullExpressionSyntax"; import { FilterSyntaxPrimitiveValueExpressionSyntax } from "./FilterSyntaxPrimitiveValueExpressionSyntax"; import { StringBuilder } from "./StringBuilder"; /** * @hidden */ var FilterSyntaxParser = /** @class */ /*@__PURE__*/ (function (_super) { __extends(FilterSyntaxParser, _super); function FilterSyntaxParser() { return _super !== null && _super.apply(this, arguments) || this; } FilterSyntaxParser.prototype.d = function (a) { var b = new FilterSyntaxLexer(); var c = b.e(a); var d = this.t(c); if (d.d != c.count) { this.ao(d, "content past expected end at: " + d.d); } return d; }; FilterSyntaxParser.prototype.ao = function (a, b) { a.c.add(b); }; FilterSyntaxParser.prototype.a = function (a, b) { var c = ((function () { var $ret = new FilterSyntaxParseResult(); $ret.d = b; return $ret; })()); c.c.add(a); return c; }; FilterSyntaxParser.prototype.t = function (a) { var b = 0; var c = a.count; return this.i(a, b, c, 0); }; FilterSyntaxParser.prototype.b = function (a, b, c, d) { if (b > c - 1) { return this.a("expected op", b); } if (!this.v(a, b, c)) { return this.a("expected op", b); } var e = a._inner[b]; var f = this.am(a, b, c); if (e.a == 10) { return this.l(a, b, c, d); } b++; var g = this.i(a, b, c, f); if (g.b) { return g; } b = g.d; return ((function () { var $ret = new FilterSyntaxParseResult(); $ret.a = ((function () { var $ret = new FilterSyntaxBinaryOperatorExpressionSyntax(); $ret.b = d; $ret.d = e.a; $ret.c = g.a; return $ret; })()); $ret.d = b; return $ret; })()); }; FilterSyntaxParser.prototype.c = function (a, b, c) { if (b > c - 1) { return this.a("expected op or expression", b); } if (this.w(a, b, c)) { var d_1 = a._inner[b]; var e = this.am(a, b, c); b++; var f_1 = this.i(a, b, c, e); if (f_1.b) { return f_1; } b = f_1.d; return ((function () { var $ret = new FilterSyntaxParseResult(); $ret.a = ((function () { var $ret = new FilterSyntaxUnaryOperatorExpressionSyntax(); $ret.c = d_1.a; $ret.b = f_1.a; return $ret; })()); $ret.d = b; return $ret; })()); } else if (this.u(a, b, c, 10)) { b++; var g_1 = this.i(a, b, c, 0); if (g_1.b) { return g_1; } b = g_1.d; if (this.u(a, b, c, 11)) { b++; } return ((function () { var $ret = new FilterSyntaxParseResult(); $ret.a = ((function () { var $ret = new FilterSyntaxParenthesisExpressionSyntax(); $ret.b = g_1.a; return $ret; })()); $ret.d = b; return $ret; })()); } else { if (this.ae(a, b, c)) { return this.m(a, b, c); } else if (this.ac(a, b, c)) { return this.k(a, b, c); } else if (this.aj(a, b, c)) { return this.r(a, b, c); } } return this.a("expected lhs for expression", b); }; FilterSyntaxParser.prototype.i = function (a, b, c, d) { if (d === void 0) { d = 0; } var e = this.c(a, b, c); if (e.b) { return e; } b = e.d; while (this.am(a, b, c) > d) { e = this.b(a, b, c, e.a); if (e.b) { return e; } b = e.d; } return ((function () { var $ret = new FilterSyntaxParseResult(); $ret.a = e.a; $ret.d = b; return $ret; })()); }; FilterSyntaxParser.prototype.am = function (a, b, c) { if (b >= c) { return 0; } var d = a._inner[b].a; switch (d) { case 52: return 20; case 53: return 10; case 54: return 40; case 55: return 30; case 56: return 80; case 57: return 60; case 58: return 70; case 59: return 50; case 61: return 100; case 62: return 90; case 63: return 130; case 64: return 120; case 65: return 110; case 10: return 140; } return 0; }; FilterSyntaxParser.prototype.k = function (a, b, c) { if (b > c - 1) { return this.a("expected identifier", b); } if (a._inner[b].a != 74) { return this.a("expected identifier", b); } var d = this.j(a, b, c); if (d.b) { return d; } b = d.d; if (this.u(a, b, c, 17) || this.u(a, b, c, 16)) { return this.g(d.a, a, b, c); } return d; }; FilterSyntaxParser.prototype.g = function (a, b, c, d) { if (c > d - 1) { return this.a("expected member separator", c); } if (b._inner[c].a != 17 && b._inner[c].a != 16) { return this.a("expected member separator", c); } c++; var e = this.k(b, c, d); if (e.b) { return e; } c = e.d; return ((function () { var $ret = new FilterSyntaxParseResult(); $ret.a = ((function () { var $ret = new FilterSyntaxMemberExpressionSyntax(); $ret.b = a; $ret.c = e.a; return $ret; })()); $ret.d = c; return $ret; })()); }; FilterSyntaxParser.prototype.j = function (a, b, c) { if (b > c - 1) { return this.a("expected identifier", b); } if (a._inner[b].a != 74) { return this.a("expected identifier", b); } return ((function () { var $ret = new FilterSyntaxParseResult(); $ret.a = ((function () { var $ret = new FilterSyntaxIdentifierExpressionSyntax(); $ret.b = 74; $ret.c = a._inner[b].b; return $ret; })()); $ret.d = b + 1; return $ret; })()); }; FilterSyntaxParser.prototype.ac = function (a, b, c) { if (b > c - 1) { return false; } if (a._inner[b].a != 74) { return false; } return true; }; FilterSyntaxParser.prototype.q = function (a, b, c) { if (b > c - 1) { return this.a("expected open paren at: " + b, b); } if (a._inner[b].a != 10) { return this.a("expected open paren at: " + b, b); } b++; var d = this.i(a, b, c, 0); if (d.b) { return d; } b = d.d; if (b > c - 1) { return this.a("expected close paren at: " + b, b); } if (a._inner[b].a != 11) { return this.a("expected close paren at: " + b, b); } b++; var e = ((function () { var $ret = new FilterSyntaxParenthesisExpressionSyntax(); $ret.b = d.a; return $ret; })()); return ((function () { var $ret = new FilterSyntaxParseResult(); $ret.a = e; $ret.d = b; return $ret; })()); }; FilterSyntaxParser.prototype.ai = function (a, b, c) { if (b > c - 1) { return false; } if (a._inner[b].a == 10) { return true; } return false; }; FilterSyntaxParser.prototype.l = function (a, b, c, d) { if (!this.u(a, b, c, 10)) { return this.a("expected open paren", b); } b++; var e = new List$1(FilterSyntaxExpressionSyntax.$, 0); while (b < c && a._inner[b].a != 11) { var f = this.i(a, b, c, 0); if (f.b) { return f; } b = f.d; e.add(f.a); if (b < c && a._inner[b].a == 6) { b++; } } if (a._inner[b].a != 11) { return this.a("expected close paren", b); } if (b < c && a._inner[b].a == 11) { b++; } var g = ((function () { var $ret = new FilterSyntaxParseResult(); $ret.a = ((function () { var $ret = new FilterSyntaxMethodCallExpressionSyntax(); $ret.c = d; $ret.b = e.toArray(); return $ret; })()); $ret.d = b; return $ret; })()); return g; }; FilterSyntaxParser.prototype.ae = function (a, b, c) { if (this.x(a._inner[b]) && this.al(a, b, c, 10)) { return true; } return false; }; FilterSyntaxParser.prototype.m = function (a, b, c) { if (!this.x(a._inner[b])) { return this.a("expected method name", b); } return ((function () { var $ret = new FilterSyntaxParseResult(); $ret.a = ((function () { var $ret = new FilterSyntaxIdentifierExpressionSyntax(); $ret.b = a._inner[b].a; $ret.c = a._inner[b].b; return $ret; })()); $ret.d = b + 1; return $ret; })()); }; FilterSyntaxParser.prototype.ad = function (a, b, c) { if (this.x(a._inner[b]) && this.al(a, b, c, 10)) { return true; } return false; }; FilterSyntaxParser.prototype.u = function (a, b, c, d) { if (b >= c) { return false; } return a._inner[b].a == d; }; FilterSyntaxParser.prototype.al = function (a, b, c, d) { if (b + 1 >= c) { return false; } return a._inner[b + 1].a == d; }; FilterSyntaxParser.prototype.x = function (a) { switch (a.a) { case 23: return true; case 24: return true; case 46: return true; case 31: return true; case 27: return true; case 42: return true; case 35: return true; case 34: return true; case 22: return true; case 47: return true; case 37: return true; case 36: return true; case 74: return true; case 25: return true; case 67: return true; case 50: return true; case 49: return true; case 39: return true; case 38: return true; case 33: return true; case 51: return true; case 44: return true; case 41: return true; case 40: return true; case 21: return true; case 20: return true; case 26: return true; case 43: return true; case 28: return true; case 48: return true; case 29: return true; case 30: return true; case 32: return true; case 45: return true; case 68: return true; case 75: return true; } return false; }; FilterSyntaxParser.prototype.n = function (a, b, c) { if (!this.u(a, b, c, 66)) { return this.a("expected token not", b); } b++; var d = this.i(a, b, c, 0); if (d.b) { return d; } b = d.d; return ((function () { var $ret = new FilterSyntaxParseResult(); $ret.a = ((function () { var $ret = new FilterSyntaxUnaryOperatorExpressionSyntax(); $ret.c = 66; $ret.b = d.a; return $ret; })()); $ret.d = b; return $ret; })()); }; FilterSyntaxParser.prototype.af = function (a, b, c) { if (this.u(a, b, c, 66)) { return true; } return false; }; FilterSyntaxParser.prototype.e = function (a, b, c, d) { if (!this.v(b, c, d)) { return this.a("expected binary expression operator", c); } var e = b._inner[c].a; c++; var f = this.i(b, c, d, 0); if (f.b) { return f; } c = f.d; return ((function () { var $ret = new FilterSyntaxParseResult(); $ret.a = ((function () { var $ret = new FilterSyntaxBinaryOperatorExpressionSyntax(); $ret.b = a; $ret.c = f.a; $ret.d = e; return $ret; })()); $ret.d = c; return $ret; })()); }; FilterSyntaxParser.prototype.v = function (a, b, c) { if (b >= c) { return false; } var d = a._inner[b].a; switch (d) { case 10: return true; case 52: return true; case 53: return true; case 54: return true; case 55: return true; case 56: return true; case 57: return true; case 58: return true; case 59: return true; case 61: return true; case 62: return true; case 63: return true; case 64: return true; case 65: return true; } return false; }; FilterSyntaxParser.prototype.w = function (a, b, c) { if (b >= c) { return false; } var d = a._inner[b].a; switch (d) { case 66: return true; } return false; }; FilterSyntaxParser.prototype.r = function (a, b, c) { if (this.ak(a, b, c)) { return this.s(a, b, c); } else if (this.ab(a, b, c)) { return this.h(a, b, c); } else if (this.ah(a, b, c)) { return this.p(a, b, c); } else if (this.y(a, b, c)) { return this.f(a, b, c); } else if (this.ag(a, b, c)) { return this.o(a, b, c); } else { throw new InvalidOperationException(1, "expected json value at: " + b); } }; FilterSyntaxParser.prototype.aj = function (a, b, c) { if (this.ak(a, b, c)) { return true; } else if (this.ab(a, b, c)) { return true; } else if (this.ah(a, b, c)) { return true; } else if (this.y(a, b, c)) { return true; } else if (this.ag(a, b, c)) { return true; } else { return false; } }; FilterSyntaxParser.prototype.o = function (a, b, c) { var d = a._inner[b]; b++; if (d.a != 71) { throw new InvalidOperationException(1, "expected null value at: " + b); } var e = ((function () { var $ret = new FilterSyntaxNullExpressionSyntax(); $ret.c = d.b; $ret.b = d.a; return $ret; })()); return ((function () { var $ret = new FilterSyntaxParseResult(); $ret.a = e; $ret.d = b; return $ret; })()); }; FilterSyntaxParser.prototype.ag = function (a, b, c) { if (b > c - 1) { return false; } if (a._inner[b].a == 71) { return true; } return false; }; FilterSyntaxParser.prototype.f = function (a, b, c) { var d = a._inner[b]; b++; if (d.a != 72 && d.a != 73) { throw new InvalidOperationException(1, "expected boolean at: " + b); } var e = ((function () { var $ret = new FilterSyntaxPrimitiveValueExpressionSyntax(); $ret.c = d.b; $ret.b = d.a; return $ret; })()); return ((function () { var $ret = new FilterSyntaxParseResult(); $ret.a = e; $ret.d = b; return $ret; })()); }; FilterSyntaxParser.prototype.y = function (a, b, c) { if (b > c - 1) { return false; } if (a._inner[b].a == 72 || a._inner[b].a == 73) { return true; } return false; }; FilterSyntaxParser.prototype.p = function (a, b, c) { var d = a._inner[b]; b++; if (d.a != 1 && d.a != 0) { throw new InvalidOperationException(1, "expected number at: " + b); } var e = ((function () { var $ret = new FilterSyntaxPrimitiveValueExpressionSyntax(); $ret.c = d.b; $ret.b = d.a; return $ret; })()); return ((function () { var $ret = new FilterSyntaxParseResult(); $ret.a = e; $ret.d = b; return $ret; })()); }; FilterSyntaxParser.prototype.ah = function (a, b, c) { if (b > c - 1) { return false; } if (a._inner[b].a == 1 || a._inner[b].a == 0) { return true; } return false; }; FilterSyntaxParser.prototype.aa = function (a, b, c) { if (b > c - 1) { return false; } if (a._inner[b].a == 6) { return true; } return false; }; FilterSyntaxParser.prototype.z = function (a, b, c) { if (b > c - 1) { return false; } if (a._inner[b].a == 18) { return true; } return false; }; FilterSyntaxParser.prototype.s = function (a, b, c) { var _this = this; var d = a._inner[b]; b++; if (d.a != 2) { return this.a("expected string at: " + b, b); } var e = ((function () { var $ret = new FilterSyntaxPrimitiveValueExpressionSyntax(); $ret.c = _this.an(d.b); $ret.b = 2; return $ret; })()); return ((function () { var $ret = new FilterSyntaxParseResult(); $ret.a = e; $ret.d = b; return $ret; })()); }; FilterSyntaxParser.prototype.h = function (a, b, c) { var d = a._inner[b]; b++; if (d.a != 3 && d.a != 4 && d.a != 5) { return this.a("expected datetime literal at: " + b, b); } var e = ((function () { var $ret = new FilterSyntaxPrimitiveValueExpressionSyntax(); $ret.b = d.a; return $ret; })()); e.c = d.b; return ((function () { var $ret = new FilterSyntaxParseResult(); $ret.a = e; $ret.d = b; return $ret; })()); }; FilterSyntaxParser.prototype.an = function (a) { if (a == null) { return null; } var b = -1; var c = new StringBuilder(0); var d = 0; for (d = 0; d < a.length; d++) { if (a.charAt(d) == '\\' && b == -1) { b = d; } else if (a.charAt(d) == '\'' && b == -1 && d + 1 < a.length && a.charAt(d + 1) == '\'') { c.h('\''); d++; } else { if (b == -1) { c.h(a.charAt(d)); } else { if (a.charAt(d) == 'n') { c.l("\n"); b = -1; } else if (a.charAt(d) == 'r') { c.l("\r"); b = -1; } else if (a.charAt(d) == 't') { c.l("\t"); b = -1; } else if (a.charAt(d) == '\"') { c.l("\""); b = -1; } else if (a.charAt(d) == '\\') { c.l("\\"); b = -1; } else { c.l("\\" + a.charAt(d)); b = -1; } } } } return c.toString(); }; FilterSyntaxParser.prototype.ak = function (a, b, c) { if (b > c - 1) { return false; } if (a._inner[b].a == 2) { return true; } return false; }; FilterSyntaxParser.prototype.ab = function (a, b, c) { if (b > c - 1) { return false; } if (a._inner[b].a == 3 || a._inner[b].a == 4 || a._inner[b].a == 5) { return true; } return false; }; FilterSyntaxParser.$t = markType(FilterSyntaxParser, 'FilterSyntaxParser'); return FilterSyntaxParser; }(Base)); export { FilterSyntaxParser };