UNPKG

@elastic/eui

Version:

Elastic UI Component Library

1,593 lines (1,590 loc) 93.8 kB
"use strict"; function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } Object.defineProperty(exports, "__esModule", { value: true }); exports.defaultSyntax = void 0; var _ast = require("./ast"); var _predicate = require("../../../services/predicate"); var _date_format = require("./date_format"); var _date_value = require("./date_value"); var _excluded = ["recognizedFields"]; function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; } function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; } function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.indexOf(n) >= 0) continue; t[n] = r[n]; } return t; } function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); } function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } } function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); } function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); } function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; } /* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License * 2.0 and the Server Side Public License, v 1; you may not use this file except * in compliance with, at your election, the Elastic License 2.0 or the Server * Side Public License, v 1. */ // @ts-ignore This is a Babel plugin that parses inline PEG grammars. // eslint-disable-line import/no-unresolved var parser = /* * Generated by PEG.js 0.10.0. * * http://pegjs.org/ */ function () { "use strict"; function peg$subclass(child, parent) { function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); } function peg$SyntaxError(message, expected, found, location) { this.message = message; this.expected = expected; this.found = found; this.location = location; this.name = "SyntaxError"; if (typeof Error.captureStackTrace === "function") { Error.captureStackTrace(this, peg$SyntaxError); } } peg$subclass(peg$SyntaxError, Error); peg$SyntaxError.buildMessage = function (expected, found) { var DESCRIBE_EXPECTATION_FNS = { literal: function literal(expectation) { return "\"" + literalEscape(expectation.text) + "\""; }, "class": function _class(expectation) { var escapedParts = "", i; for (i = 0; i < expectation.parts.length; i++) { escapedParts += expectation.parts[i] instanceof Array ? classEscape(expectation.parts[i][0]) + "-" + classEscape(expectation.parts[i][1]) : classEscape(expectation.parts[i]); } return "[" + (expectation.inverted ? "^" : "") + escapedParts + "]"; }, any: function any(expectation) { return "any character"; }, end: function end(expectation) { return "end of input"; }, other: function other(expectation) { return expectation.description; } }; function hex(ch) { return ch.charCodeAt(0).toString(16).toUpperCase(); } function literalEscape(s) { return s.replace(/\\/g, '\\\\').replace(/"/g, '\\"').replace(/\0/g, '\\0').replace(/\t/g, '\\t').replace(/\n/g, '\\n').replace(/\r/g, '\\r').replace(/[\x00-\x0F]/g, function (ch) { return '\\x0' + hex(ch); }).replace(/[\x10-\x1F\x7F-\x9F]/g, function (ch) { return '\\x' + hex(ch); }); } function classEscape(s) { return s.replace(/\\/g, '\\\\').replace(/\]/g, '\\]').replace(/\^/g, '\\^').replace(/-/g, '\\-').replace(/\0/g, '\\0').replace(/\t/g, '\\t').replace(/\n/g, '\\n').replace(/\r/g, '\\r').replace(/[\x00-\x0F]/g, function (ch) { return '\\x0' + hex(ch); }).replace(/[\x10-\x1F\x7F-\x9F]/g, function (ch) { return '\\x' + hex(ch); }); } function describeExpectation(expectation) { return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation); } function describeExpected(expected) { var descriptions = new Array(expected.length), i, j; for (i = 0; i < expected.length; i++) { descriptions[i] = describeExpectation(expected[i]); } descriptions.sort(); if (descriptions.length > 0) { for (i = 1, j = 1; i < descriptions.length; i++) { if (descriptions[i - 1] !== descriptions[i]) { descriptions[j] = descriptions[i]; j++; } } descriptions.length = j; } switch (descriptions.length) { case 1: return descriptions[0]; case 2: return descriptions[0] + " or " + descriptions[1]; default: return descriptions.slice(0, -1).join(", ") + ", or " + descriptions[descriptions.length - 1]; } } function describeFound(found) { return found ? "\"" + literalEscape(found) + "\"" : "end of input"; } return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found."; }; function peg$parse(input, options) { options = options !== void 0 ? options : {}; var peg$FAILED = {}, peg$startRuleFunctions = { Query: peg$parseQuery }, peg$startRuleFunction = peg$parseQuery, peg$c0 = function peg$c0(clauses) { return clauses; }, peg$c1 = function peg$c1() { return []; }, peg$c2 = function peg$c2(head, clause) { return clause; }, peg$c3 = function peg$c3(head, tail) { return [head].concat(_toConsumableArray(tail)); }, peg$c4 = "(", peg$c5 = peg$literalExpectation("(", false), peg$c6 = ")", peg$c7 = peg$literalExpectation(")", false), peg$c8 = function peg$c8(head, tail) { return [head].concat(_toConsumableArray(tail)); }, peg$c9 = "-", peg$c10 = peg$literalExpectation("-", false), peg$c11 = function peg$c11(group) { return AST.Group.mustNot(group); }, peg$c12 = function peg$c12(group) { return AST.Group.must(group); }, peg$c13 = function peg$c13(value) { return AST.Term.mustNot(value); }, peg$c14 = function peg$c14(value) { return AST.Term.must(value); }, peg$c15 = function peg$c15(flag) { return AST.Is.mustNot(flag); }, peg$c16 = function peg$c16(flag) { return AST.Is.must(flag); }, peg$c17 = "is:", peg$c18 = peg$literalExpectation("is:", false), peg$c19 = function peg$c19(flag) { validateFlag(flag, location(), ctx); return flag; }, peg$c20 = peg$otherExpectation("field"), peg$c21 = function peg$c21(fv) { return AST.Field.mustNot.eq(fv.field, fv.value); }, peg$c22 = function peg$c22(fv) { return AST.Field.mustNot.exact(fv.field, fv.value); }, peg$c23 = function peg$c23(fv) { return AST.Field.mustNot.gt(fv.field, fv.value); }, peg$c24 = function peg$c24(fv) { return AST.Field.mustNot.gte(fv.field, fv.value); }, peg$c25 = function peg$c25(fv) { return AST.Field.mustNot.lt(fv.field, fv.value); }, peg$c26 = function peg$c26(fv) { return AST.Field.mustNot.lte(fv.field, fv.value); }, peg$c27 = function peg$c27(fv) { return AST.Field.must.eq(fv.field, fv.value); }, peg$c28 = function peg$c28(fv) { return AST.Field.must.exact(fv.field, fv.value); }, peg$c29 = function peg$c29(fv) { return AST.Field.must.gt(fv.field, fv.value); }, peg$c30 = function peg$c30(fv) { return AST.Field.must.gte(fv.field, fv.value); }, peg$c31 = function peg$c31(fv) { return AST.Field.must.lt(fv.field, fv.value); }, peg$c32 = function peg$c32(fv) { return AST.Field.must.lte(fv.field, fv.value); }, peg$c33 = ":", peg$c34 = peg$literalExpectation(":", false), peg$c35 = function peg$c35(field, valueExpression) { return { field: field, value: resolveFieldValue(field, valueExpression, ctx) }; }, peg$c36 = "=", peg$c37 = peg$literalExpectation("=", false), peg$c38 = ">", peg$c39 = peg$literalExpectation(">", false), peg$c40 = function peg$c40(field, valueExpression) { return { field: field, value: resolveFieldValue(field, valueExpression, ctx) }; }, peg$c41 = ">=", peg$c42 = peg$literalExpectation(">=", false), peg$c43 = "<", peg$c44 = peg$literalExpectation("<", false), peg$c45 = "<=", peg$c46 = peg$literalExpectation("<=", false), peg$c47 = peg$otherExpectation("flag name"), peg$c48 = peg$otherExpectation("field name"), peg$c49 = function peg$c49(id) { return !hasRecognizedFields || recognizedFields.includes(id); }, peg$c50 = function peg$c50(id) { return id; }, peg$c51 = function peg$c51() { return unescapeValue(text()); }, peg$c52 = /^[\-_]/, peg$c53 = peg$classExpectation(["-", "_"], false, false), peg$c54 = peg$otherExpectation("field value"), peg$c55 = peg$otherExpectation("term"), peg$c56 = function peg$c56(value) { return value.expression; }, peg$c57 = function peg$c57(head, value) { return value; }, peg$c58 = function peg$c58(head, tail) { return [head].concat(_toConsumableArray(tail)); }, peg$c59 = "\"", peg$c60 = peg$literalExpectation("\"", false), peg$c61 = function peg$c61() { return unescapePhraseValue(text()); }, peg$c62 = function peg$c62(phrase) { return Exp.string(phrase, location()); }, peg$c63 = /^[^\\" ]/, peg$c64 = peg$classExpectation(["\\", "\"", " "], true, false), peg$c65 = "\\", peg$c66 = peg$literalExpectation("\\", false), peg$c67 = peg$anyExpectation(), peg$c68 = function peg$c68() { if (text().toLowerCase() === 'or') { error('To use OR in a text search, put it inside quotes: "or". To ' + 'perform a logical OR, enclose the words in parenthesis: (foo:bar or bar).'); } return Exp.string(unescapeValue(text()), location()); }, peg$c69 = /^[\-_*:\/@]/, peg$c70 = peg$classExpectation(["-", "_", "*", ":", "/", "@"], false, false), peg$c71 = /^[\xC0-\uFFFF]/, peg$c72 = peg$classExpectation([["\xC0", "\uFFFF"]], false, false), peg$c73 = /^[\-:\\()]/, peg$c74 = peg$classExpectation(["-", ":", "\\", "(", ")"], false, false), peg$c75 = /^[oO]/, peg$c76 = peg$classExpectation(["o", "O"], false, false), peg$c77 = /^[rR]/, peg$c78 = peg$classExpectation(["r", "R"], false, false), peg$c79 = function peg$c79(bool) { return bool; }, peg$c80 = /^[tT]/, peg$c81 = peg$classExpectation(["t", "T"], false, false), peg$c82 = /^[uU]/, peg$c83 = peg$classExpectation(["u", "U"], false, false), peg$c84 = /^[eE]/, peg$c85 = peg$classExpectation(["e", "E"], false, false), peg$c86 = function peg$c86() { return Exp.boolean(text(), location()); }, peg$c87 = /^[fF]/, peg$c88 = peg$classExpectation(["f", "F"], false, false), peg$c89 = /^[aA]/, peg$c90 = peg$classExpectation(["a", "A"], false, false), peg$c91 = /^[lL]/, peg$c92 = peg$classExpectation(["l", "L"], false, false), peg$c93 = /^[sS]/, peg$c94 = peg$classExpectation(["s", "S"], false, false), peg$c95 = /^[yY]/, peg$c96 = peg$classExpectation(["y", "Y"], false, false), peg$c97 = /^[nN]/, peg$c98 = peg$classExpectation(["n", "N"], false, false), peg$c99 = /^[\-]/, peg$c100 = peg$classExpectation(["-"], false, false), peg$c101 = /^[0-9]/, peg$c102 = peg$classExpectation([["0", "9"]], false, false), peg$c103 = ".", peg$c104 = peg$literalExpectation(".", false), peg$c105 = function peg$c105() { return Exp.number(text(), location()); }, peg$c106 = function peg$c106(num) { return num; }, peg$c107 = "'", peg$c108 = peg$literalExpectation("'", false), peg$c109 = function peg$c109() { return text(); }, peg$c110 = function peg$c110(expression) { return Exp.date(expression, location()); }, peg$c111 = peg$otherExpectation("alpha numeric"), peg$c112 = /^[a-zA-Z0-9.]/, peg$c113 = peg$classExpectation([["a", "z"], ["A", "Z"], ["0", "9"], "."], false, false), peg$c114 = peg$otherExpectation("whitespace"), peg$c115 = /^[ \t\n\r]/, peg$c116 = peg$classExpectation([" ", "\t", "\n", "\r"], false, false), peg$currPos = 0, peg$savedPos = 0, peg$posDetailsCache = [{ line: 1, column: 1 }], peg$maxFailPos = 0, peg$maxFailExpected = [], peg$silentFails = 0, peg$result; if ("startRule" in options) { if (!(options.startRule in peg$startRuleFunctions)) { throw new Error("Can't start parsing from rule \"" + options.startRule + "\"."); } peg$startRuleFunction = peg$startRuleFunctions[options.startRule]; } function text() { return input.substring(peg$savedPos, peg$currPos); } function location() { return peg$computeLocation(peg$savedPos, peg$currPos); } function expected(description, location) { location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos); throw peg$buildStructuredError([peg$otherExpectation(description)], input.substring(peg$savedPos, peg$currPos), location); } function error(message, location) { location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos); throw peg$buildSimpleError(message, location); } function peg$literalExpectation(text, ignoreCase) { return { type: "literal", text: text, ignoreCase: ignoreCase }; } function peg$classExpectation(parts, inverted, ignoreCase) { return { type: "class", parts: parts, inverted: inverted, ignoreCase: ignoreCase }; } function peg$anyExpectation() { return { type: "any" }; } function peg$endExpectation() { return { type: "end" }; } function peg$otherExpectation(description) { return { type: "other", description: description }; } function peg$computePosDetails(pos) { var details = peg$posDetailsCache[pos], p; if (details) { return details; } else { p = pos - 1; while (!peg$posDetailsCache[p]) { p--; } details = peg$posDetailsCache[p]; details = { line: details.line, column: details.column }; while (p < pos) { if (input.charCodeAt(p) === 10) { details.line++; details.column = 1; } else { details.column++; } p++; } peg$posDetailsCache[pos] = details; return details; } } function peg$computeLocation(startPos, endPos) { var startPosDetails = peg$computePosDetails(startPos), endPosDetails = peg$computePosDetails(endPos); return { start: { offset: startPos, line: startPosDetails.line, column: startPosDetails.column }, end: { offset: endPos, line: endPosDetails.line, column: endPosDetails.column } }; } function peg$fail(expected) { if (peg$currPos < peg$maxFailPos) { return; } if (peg$currPos > peg$maxFailPos) { peg$maxFailPos = peg$currPos; peg$maxFailExpected = []; } peg$maxFailExpected.push(expected); } function peg$buildSimpleError(message, location) { return new peg$SyntaxError(message, null, null, location); } function peg$buildStructuredError(expected, found, location) { return new peg$SyntaxError(peg$SyntaxError.buildMessage(expected, found), expected, found, location); } function peg$parseQuery() { var s0, s1; s0 = peg$currPos; s1 = peg$parseClauses(); if (s1 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c0(s1); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; s1 = peg$parsespace(); if (s1 === peg$FAILED) { s1 = null; } if (s1 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c1(); } s0 = s1; } return s0; } function peg$parseClauses() { var s0, s1, s2, s3, s4, s5, s6; s0 = peg$currPos; s1 = peg$parsespace(); if (s1 === peg$FAILED) { s1 = null; } if (s1 !== peg$FAILED) { s2 = peg$parseClause(); if (s2 !== peg$FAILED) { s3 = []; s4 = peg$currPos; s5 = peg$parsespace(); if (s5 !== peg$FAILED) { s6 = peg$parseClause(); if (s6 !== peg$FAILED) { peg$savedPos = s4; s5 = peg$c2(s2, s6); s4 = s5; } else { peg$currPos = s4; s4 = peg$FAILED; } } else { peg$currPos = s4; s4 = peg$FAILED; } while (s4 !== peg$FAILED) { s3.push(s4); s4 = peg$currPos; s5 = peg$parsespace(); if (s5 !== peg$FAILED) { s6 = peg$parseClause(); if (s6 !== peg$FAILED) { peg$savedPos = s4; s5 = peg$c2(s2, s6); s4 = s5; } else { peg$currPos = s4; s4 = peg$FAILED; } } else { peg$currPos = s4; s4 = peg$FAILED; } } if (s3 !== peg$FAILED) { s4 = peg$parsespace(); if (s4 === peg$FAILED) { s4 = null; } if (s4 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c3(s2, s3); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parseClause() { var s0; s0 = peg$parseGroupClause(); if (s0 === peg$FAILED) { s0 = peg$parseIsClause(); if (s0 === peg$FAILED) { s0 = peg$parseFieldClause(); if (s0 === peg$FAILED) { s0 = peg$parseTermClause(); } } } return s0; } function peg$parseSubGroupClause() { var s0, s1, s2, s3, s4, s5, s6, s7, s8; s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 40) { s1 = peg$c4; peg$currPos++; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c5); } } if (s1 !== peg$FAILED) { s2 = peg$parseClause(); if (s2 !== peg$FAILED) { s3 = []; s4 = peg$currPos; s5 = peg$parsespace(); if (s5 === peg$FAILED) { s5 = null; } if (s5 !== peg$FAILED) { s6 = peg$parseorWord(); if (s6 !== peg$FAILED) { s7 = peg$parsespace(); if (s7 === peg$FAILED) { s7 = null; } if (s7 !== peg$FAILED) { s8 = peg$parseClause(); if (s8 !== peg$FAILED) { peg$savedPos = s4; s5 = peg$c2(s2, s8); s4 = s5; } else { peg$currPos = s4; s4 = peg$FAILED; } } else { peg$currPos = s4; s4 = peg$FAILED; } } else { peg$currPos = s4; s4 = peg$FAILED; } } else { peg$currPos = s4; s4 = peg$FAILED; } while (s4 !== peg$FAILED) { s3.push(s4); s4 = peg$currPos; s5 = peg$parsespace(); if (s5 === peg$FAILED) { s5 = null; } if (s5 !== peg$FAILED) { s6 = peg$parseorWord(); if (s6 !== peg$FAILED) { s7 = peg$parsespace(); if (s7 === peg$FAILED) { s7 = null; } if (s7 !== peg$FAILED) { s8 = peg$parseClause(); if (s8 !== peg$FAILED) { peg$savedPos = s4; s5 = peg$c2(s2, s8); s4 = s5; } else { peg$currPos = s4; s4 = peg$FAILED; } } else { peg$currPos = s4; s4 = peg$FAILED; } } else { peg$currPos = s4; s4 = peg$FAILED; } } else { peg$currPos = s4; s4 = peg$FAILED; } } if (s3 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 41) { s4 = peg$c6; peg$currPos++; } else { s4 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c7); } } if (s4 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c8(s2, s3); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parseGroupClause() { var s0, s1, s2, s3; s0 = peg$currPos; s1 = peg$parsespace(); if (s1 === peg$FAILED) { s1 = null; } if (s1 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 45) { s2 = peg$c9; peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c10); } } if (s2 !== peg$FAILED) { s3 = peg$parseSubGroupClause(); if (s3 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c11(s3); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; s1 = peg$parsespace(); if (s1 === peg$FAILED) { s1 = null; } if (s1 !== peg$FAILED) { s2 = peg$parseSubGroupClause(); if (s2 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c12(s2); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } return s0; } function peg$parseTermClause() { var s0, s1, s2, s3; s0 = peg$currPos; s1 = peg$parsespace(); if (s1 === peg$FAILED) { s1 = null; } if (s1 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 45) { s2 = peg$c9; peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c10); } } if (s2 !== peg$FAILED) { s3 = peg$parsetermValue(); if (s3 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c13(s3); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; s1 = peg$parsespace(); if (s1 === peg$FAILED) { s1 = null; } if (s1 !== peg$FAILED) { s2 = peg$parsetermValue(); if (s2 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c14(s2); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } return s0; } function peg$parseIsClause() { var s0, s1, s2, s3; s0 = peg$currPos; s1 = peg$parsespace(); if (s1 === peg$FAILED) { s1 = null; } if (s1 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 45) { s2 = peg$c9; peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c10); } } if (s2 !== peg$FAILED) { s3 = peg$parseIsFlag(); if (s3 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c15(s3); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; s1 = peg$parsespace(); if (s1 === peg$FAILED) { s1 = null; } if (s1 !== peg$FAILED) { s2 = peg$parseIsFlag(); if (s2 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c16(s2); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } return s0; } function peg$parseIsFlag() { var s0, s1, s2; s0 = peg$currPos; if (input.substr(peg$currPos, 3) === peg$c17) { s1 = peg$c17; peg$currPos += 3; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c18); } } if (s1 !== peg$FAILED) { s2 = peg$parseflagName(); if (s2 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c19(s2); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parseFieldClause() { var s0, s1, s2, s3; peg$silentFails++; s0 = peg$currPos; s1 = peg$parsespace(); if (s1 === peg$FAILED) { s1 = null; } if (s1 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 45) { s2 = peg$c9; peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c10); } } if (s2 !== peg$FAILED) { s3 = peg$parseFieldEQValue(); if (s3 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c21(s3); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; s1 = peg$parsespace(); if (s1 === peg$FAILED) { s1 = null; } if (s1 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 45) { s2 = peg$c9; peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c10); } } if (s2 !== peg$FAILED) { s3 = peg$parseFieldEXACTValue(); if (s3 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c22(s3); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; s1 = peg$parsespace(); if (s1 === peg$FAILED) { s1 = null; } if (s1 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 45) { s2 = peg$c9; peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c10); } } if (s2 !== peg$FAILED) { s3 = peg$parseFieldGTValue(); if (s3 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c23(s3); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; s1 = peg$parsespace(); if (s1 === peg$FAILED) { s1 = null; } if (s1 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 45) { s2 = peg$c9; peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c10); } } if (s2 !== peg$FAILED) { s3 = peg$parseFieldGTEValue(); if (s3 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c24(s3); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; s1 = peg$parsespace(); if (s1 === peg$FAILED) { s1 = null; } if (s1 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 45) { s2 = peg$c9; peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c10); } } if (s2 !== peg$FAILED) { s3 = peg$parseFieldLTValue(); if (s3 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c25(s3); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; s1 = peg$parsespace(); if (s1 === peg$FAILED) { s1 = null; } if (s1 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 45) { s2 = peg$c9; peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c10); } } if (s2 !== peg$FAILED) { s3 = peg$parseFieldLTEValue(); if (s3 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c26(s3); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; s1 = peg$parsespace(); if (s1 === peg$FAILED) { s1 = null; } if (s1 !== peg$FAILED) { s2 = peg$parseFieldEQValue(); if (s2 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c27(s2); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; s1 = peg$parsespace(); if (s1 === peg$FAILED) { s1 = null; } if (s1 !== peg$FAILED) { s2 = peg$parseFieldEXACTValue(); if (s2 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c28(s2); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; s1 = peg$parsespace(); if (s1 === peg$FAILED) { s1 = null; } if (s1 !== peg$FAILED) { s2 = peg$parseFieldGTValue(); if (s2 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c29(s2); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; s1 = peg$parsespace(); if (s1 === peg$FAILED) { s1 = null; } if (s1 !== peg$FAILED) { s2 = peg$parseFieldGTEValue(); if (s2 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c30(s2); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; s1 = peg$parsespace(); if (s1 === peg$FAILED) { s1 = null; } if (s1 !== peg$FAILED) { s2 = peg$parseFieldLTValue(); if (s2 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c31(s2); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; s1 = peg$parsespace(); if (s1 === peg$FAILED) { s1 = null; } if (s1 !== peg$FAILED) { s2 = peg$parseFieldLTEValue(); if (s2 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c32(s2); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } } } } } } } } } } } peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c20); } } return s0; } function peg$parseFieldEQValue() { var s0, s1, s2, s3; s0 = peg$currPos; s1 = peg$parsefieldName(); if (s1 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 58) { s2 = peg$c33; peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c34); } } if (s2 !== peg$FAILED) { s3 = peg$parsefieldContainsValue(); if (s3 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c35(s1, s3); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parseFieldEXACTValue() { var s0, s1, s2, s3; s0 = peg$currPos; s1 = peg$parsefieldName(); if (s1 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 61) { s2 = peg$c36; peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c37); } } if (s2 !== peg$FAILED) { s3 = peg$parsefieldContainsValue(); if (s3 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c35(s1, s3); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parseFieldGTValue() { var s0, s1, s2, s3; s0 = peg$currPos; s1 = peg$parsefieldName(); if (s1 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 62) { s2 = peg$c38; peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c39); } } if (s2 !== peg$FAILED) { s3 = peg$parserangeValue(); if (s3 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c40(s1, s3); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parseFieldGTEValue() { var s0, s1, s2, s3; s0 = peg$currPos; s1 = peg$parsefieldName(); if (s1 !== peg$FAILED) { if (input.substr(peg$currPos, 2) === peg$c41) { s2 = peg$c41; peg$currPos += 2; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c42); } } if (s2 !== peg$FAILED) { s3 = peg$parserangeValue(); if (s3 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c40(s1, s3); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parseFieldLTValue() { var s0, s1, s2, s3; s0 = peg$currPos; s1 = peg$parsefieldName(); if (s1 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 60) { s2 = peg$c43; peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c44); } } if (s2 !== peg$FAILED) { s3 = peg$parserangeValue(); if (s3 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c40(s1, s3); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parseFieldLTEValue() { var s0, s1, s2, s3; s0 = peg$currPos; s1 = peg$parsefieldName(); if (s1 !== peg$FAILED) { if (input.substr(peg$currPos, 2) === peg$c45) { s2 = peg$c45; peg$currPos += 2; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c46); } } if (s2 !== peg$FAILED) { s3 = peg$parserangeValue(); if (s3 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c40(s1, s3); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parseflagName() { var s0, s1; peg$silentFails++; s0 = peg$parseidentifier(); peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c47); } } return s0; } function peg$parsefieldName() { var s0, s1, s2; peg$silentFails++; s0 = peg$currPos; s1 = peg$parseidentifier(); if (s1 !== peg$FAILED) { peg$savedPos = peg$currPos; s2 = peg$c49(s1); if (s2) { s2 = void 0; } else { s2 = peg$FAILED; } if (s2 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c50(s1); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c48); } } return s0; } function peg$parseidentifier() { var s0, s1, s2; s0 = peg$currPos; s1 = []; s2 = peg$parseidentifierChar(); if (s2 !== peg$FAILED) { while (s2 !== peg$FAILED) { s1.push(s2); s2 = peg$parseidentifierChar(); } } else { s1 = peg$FAILED; } if (s1 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c51(); } s0 = s1; return s0; } function peg$parseidentifierChar() { var s0; s0 = peg$parsealnum(); if (s0 === peg$FAILED) { if (peg$c52.test(input.charAt(peg$currPos))) { s0 = input.charAt(peg$currPos); peg$currPos++; } else { s0 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c53); } } if (s0 === peg$FAILED) { s0 = peg$parseescapedChar(); } } return s0; } function peg$parsefieldContainsValue() { var s0, s1; peg$silentFails++; s0 = peg$parsecontainsOrValues(); if (s0 === peg$FAILED) { s0 = peg$parsecontainsValue(); } peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c54); } } return s0; } function peg$parsetermValue() { var s0, s1; peg$silentFails++; s0 = peg$currPos; s1 = peg$parsecontainsValue(); if (s1 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c56(s1); } s0 = s1; peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c55); } } return s0; } function peg$parsecontainsOrValues() { var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9; s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 40) { s1 = peg$c4; peg$currPos++; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c5); } } if (s1 !== peg$FAILED) { s2 = peg$parsespace(); if (s2 === peg$FAILED) { s2 = null; } if (s2 !== peg$FAILED) { s3 = peg$parsecon