igniteui-react-core
Version:
Ignite UI React Core.
750 lines (749 loc) • 24.1 kB
JavaScript
/*
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 { 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
*/
export let FilterSyntaxParser = /*@__PURE__*/ (() => {
class FilterSyntaxParser extends Base {
d(a) {
let b = new FilterSyntaxLexer();
let c = b.e(a);
let d = this.t(c);
if (d.d != c.count) {
this.ao(d, "content past expected end at: " + d.d);
}
return d;
}
ao(a, b) {
a.c.add(b);
}
a(a, b) {
let c = ((() => {
let $ret = new FilterSyntaxParseResult();
$ret.d = b;
return $ret;
})());
c.c.add(a);
return c;
}
t(a) {
let b = 0;
let c = a.count;
return this.i(a, b, c, 0);
}
b(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);
}
let e = a._inner[b];
let f = this.am(a, b, c);
if (e.a == 10) {
return this.l(a, b, c, d);
}
b++;
let g = this.i(a, b, c, f);
if (g.b) {
return g;
}
b = g.d;
return ((() => {
let $ret = new FilterSyntaxParseResult();
$ret.a = ((() => {
let $ret = new FilterSyntaxBinaryOperatorExpressionSyntax();
$ret.b = d;
$ret.d = e.a;
$ret.c = g.a;
return $ret;
})());
$ret.d = b;
return $ret;
})());
}
c(a, b, c) {
if (b > c - 1) {
return this.a("expected op or expression", b);
}
if (this.w(a, b, c)) {
let d = a._inner[b];
let e = this.am(a, b, c);
b++;
let f = this.i(a, b, c, e);
if (f.b) {
return f;
}
b = f.d;
return ((() => {
let $ret = new FilterSyntaxParseResult();
$ret.a = ((() => {
let $ret = new FilterSyntaxUnaryOperatorExpressionSyntax();
$ret.c = d.a;
$ret.b = f.a;
return $ret;
})());
$ret.d = b;
return $ret;
})());
}
else if (this.u(a, b, c, 10)) {
b++;
let g = this.i(a, b, c, 0);
if (g.b) {
return g;
}
b = g.d;
if (this.u(a, b, c, 11)) {
b++;
}
return ((() => {
let $ret = new FilterSyntaxParseResult();
$ret.a = ((() => {
let $ret = new FilterSyntaxParenthesisExpressionSyntax();
$ret.b = g.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);
}
i(a, b, c, d = 0) {
let 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 ((() => {
let $ret = new FilterSyntaxParseResult();
$ret.a = e.a;
$ret.d = b;
return $ret;
})());
}
am(a, b, c) {
if (b >= c) {
return 0;
}
let 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;
}
k(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);
}
let 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;
}
g(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++;
let e = this.k(b, c, d);
if (e.b) {
return e;
}
c = e.d;
return ((() => {
let $ret = new FilterSyntaxParseResult();
$ret.a = ((() => {
let $ret = new FilterSyntaxMemberExpressionSyntax();
$ret.b = a;
$ret.c = e.a;
return $ret;
})());
$ret.d = c;
return $ret;
})());
}
j(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 ((() => {
let $ret = new FilterSyntaxParseResult();
$ret.a = ((() => {
let $ret = new FilterSyntaxIdentifierExpressionSyntax();
$ret.b = 74;
$ret.c = a._inner[b].b;
return $ret;
})());
$ret.d = b + 1;
return $ret;
})());
}
ac(a, b, c) {
if (b > c - 1) {
return false;
}
if (a._inner[b].a != 74) {
return false;
}
return true;
}
q(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++;
let 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++;
let e = ((() => {
let $ret = new FilterSyntaxParenthesisExpressionSyntax();
$ret.b = d.a;
return $ret;
})());
return ((() => {
let $ret = new FilterSyntaxParseResult();
$ret.a = e;
$ret.d = b;
return $ret;
})());
}
ai(a, b, c) {
if (b > c - 1) {
return false;
}
if (a._inner[b].a == 10) {
return true;
}
return false;
}
l(a, b, c, d) {
if (!this.u(a, b, c, 10)) {
return this.a("expected open paren", b);
}
b++;
let e = new List$1(FilterSyntaxExpressionSyntax.$, 0);
while (b < c && a._inner[b].a != 11) {
let 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++;
}
let g = ((() => {
let $ret = new FilterSyntaxParseResult();
$ret.a = ((() => {
let $ret = new FilterSyntaxMethodCallExpressionSyntax();
$ret.c = d;
$ret.b = e.toArray();
return $ret;
})());
$ret.d = b;
return $ret;
})());
return g;
}
ae(a, b, c) {
if (this.x(a._inner[b]) && this.al(a, b, c, 10)) {
return true;
}
return false;
}
m(a, b, c) {
if (!this.x(a._inner[b])) {
return this.a("expected method name", b);
}
return ((() => {
let $ret = new FilterSyntaxParseResult();
$ret.a = ((() => {
let $ret = new FilterSyntaxIdentifierExpressionSyntax();
$ret.b = a._inner[b].a;
$ret.c = a._inner[b].b;
return $ret;
})());
$ret.d = b + 1;
return $ret;
})());
}
ad(a, b, c) {
if (this.x(a._inner[b]) && this.al(a, b, c, 10)) {
return true;
}
return false;
}
u(a, b, c, d) {
if (b >= c) {
return false;
}
return a._inner[b].a == d;
}
al(a, b, c, d) {
if (b + 1 >= c) {
return false;
}
return a._inner[b + 1].a == d;
}
x(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;
}
n(a, b, c) {
if (!this.u(a, b, c, 66)) {
return this.a("expected token not", b);
}
b++;
let d = this.i(a, b, c, 0);
if (d.b) {
return d;
}
b = d.d;
return ((() => {
let $ret = new FilterSyntaxParseResult();
$ret.a = ((() => {
let $ret = new FilterSyntaxUnaryOperatorExpressionSyntax();
$ret.c = 66;
$ret.b = d.a;
return $ret;
})());
$ret.d = b;
return $ret;
})());
}
af(a, b, c) {
if (this.u(a, b, c, 66)) {
return true;
}
return false;
}
e(a, b, c, d) {
if (!this.v(b, c, d)) {
return this.a("expected binary expression operator", c);
}
let e = b._inner[c].a;
c++;
let f = this.i(b, c, d, 0);
if (f.b) {
return f;
}
c = f.d;
return ((() => {
let $ret = new FilterSyntaxParseResult();
$ret.a = ((() => {
let $ret = new FilterSyntaxBinaryOperatorExpressionSyntax();
$ret.b = a;
$ret.c = f.a;
$ret.d = e;
return $ret;
})());
$ret.d = c;
return $ret;
})());
}
v(a, b, c) {
if (b >= c) {
return false;
}
let 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;
}
w(a, b, c) {
if (b >= c) {
return false;
}
let d = a._inner[b].a;
switch (d) {
case 66: return true;
}
return false;
}
r(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);
}
}
aj(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;
}
}
o(a, b, c) {
let d = a._inner[b];
b++;
if (d.a != 71) {
throw new InvalidOperationException(1, "expected null value at: " + b);
}
let e = ((() => {
let $ret = new FilterSyntaxNullExpressionSyntax();
$ret.c = d.b;
$ret.b = d.a;
return $ret;
})());
return ((() => {
let $ret = new FilterSyntaxParseResult();
$ret.a = e;
$ret.d = b;
return $ret;
})());
}
ag(a, b, c) {
if (b > c - 1) {
return false;
}
if (a._inner[b].a == 71) {
return true;
}
return false;
}
f(a, b, c) {
let d = a._inner[b];
b++;
if (d.a != 72 && d.a != 73) {
throw new InvalidOperationException(1, "expected boolean at: " + b);
}
let e = ((() => {
let $ret = new FilterSyntaxPrimitiveValueExpressionSyntax();
$ret.c = d.b;
$ret.b = d.a;
return $ret;
})());
return ((() => {
let $ret = new FilterSyntaxParseResult();
$ret.a = e;
$ret.d = b;
return $ret;
})());
}
y(a, b, c) {
if (b > c - 1) {
return false;
}
if (a._inner[b].a == 72 || a._inner[b].a == 73) {
return true;
}
return false;
}
p(a, b, c) {
let d = a._inner[b];
b++;
if (d.a != 1 && d.a != 0) {
throw new InvalidOperationException(1, "expected number at: " + b);
}
let e = ((() => {
let $ret = new FilterSyntaxPrimitiveValueExpressionSyntax();
$ret.c = d.b;
$ret.b = d.a;
return $ret;
})());
return ((() => {
let $ret = new FilterSyntaxParseResult();
$ret.a = e;
$ret.d = b;
return $ret;
})());
}
ah(a, b, c) {
if (b > c - 1) {
return false;
}
if (a._inner[b].a == 1 || a._inner[b].a == 0) {
return true;
}
return false;
}
aa(a, b, c) {
if (b > c - 1) {
return false;
}
if (a._inner[b].a == 6) {
return true;
}
return false;
}
z(a, b, c) {
if (b > c - 1) {
return false;
}
if (a._inner[b].a == 18) {
return true;
}
return false;
}
s(a, b, c) {
let d = a._inner[b];
b++;
if (d.a != 2) {
return this.a("expected string at: " + b, b);
}
let e = ((() => {
let $ret = new FilterSyntaxPrimitiveValueExpressionSyntax();
$ret.c = this.an(d.b);
$ret.b = 2;
return $ret;
})());
return ((() => {
let $ret = new FilterSyntaxParseResult();
$ret.a = e;
$ret.d = b;
return $ret;
})());
}
h(a, b, c) {
let d = a._inner[b];
b++;
if (d.a != 3 && d.a != 4 && d.a != 5) {
return this.a("expected datetime literal at: " + b, b);
}
let e = ((() => {
let $ret = new FilterSyntaxPrimitiveValueExpressionSyntax();
$ret.b = d.a;
return $ret;
})());
e.c = d.b;
return ((() => {
let $ret = new FilterSyntaxParseResult();
$ret.a = e;
$ret.d = b;
return $ret;
})());
}
an(a) {
if (a == null) {
return null;
}
let b = -1;
let c = new StringBuilder(0);
let 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();
}
ak(a, b, c) {
if (b > c - 1) {
return false;
}
if (a._inner[b].a == 2) {
return true;
}
return false;
}
ab(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 = /*@__PURE__*/ markType(FilterSyntaxParser, 'FilterSyntaxParser');
return FilterSyntaxParser;
})();