UNPKG

@elastic/eui

Version:

Elastic UI Component Library

1,587 lines (1,582 loc) 92.4 kB
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); } function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _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(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } /* * 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. */ import { AST } from './ast'; import { isArray, isString, isDateLike } from '../../../services/predicate'; import { dateFormat as defaultDateFormat } from './date_format'; import { dateValueParser, isDateValue } from './date_value'; // @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() { return unescapeValue(text()); }, peg$c50 = /^[\-_]/, peg$c51 = peg$classExpectation(["-", "_"], false, false), peg$c52 = peg$otherExpectation("field value"), peg$c53 = peg$otherExpectation("term"), peg$c54 = function peg$c54(value) { return value.expression; }, peg$c55 = function peg$c55(head, value) { return value; }, peg$c56 = function peg$c56(head, tail) { return [head].concat(_toConsumableArray(tail)); }, peg$c57 = "\"", peg$c58 = peg$literalExpectation("\"", false), peg$c59 = function peg$c59() { return unescapePhraseValue(text()); }, peg$c60 = function peg$c60(phrase) { return Exp.string(phrase, location()); }, peg$c61 = /^[^\\" ]/, peg$c62 = peg$classExpectation(["\\", "\"", " "], true, false), peg$c63 = "\\", peg$c64 = peg$literalExpectation("\\", false), peg$c65 = peg$anyExpectation(), peg$c66 = function peg$c66() { 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$c67 = /^[\-_*:\/]/, peg$c68 = peg$classExpectation(["-", "_", "*", ":", "/"], false, false), peg$c69 = /^[\xC0-\uFFFF]/, peg$c70 = peg$classExpectation([["\xC0", "\uFFFF"]], false, false), peg$c71 = /^[\-:\\()]/, peg$c72 = peg$classExpectation(["-", ":", "\\", "(", ")"], false, false), peg$c73 = /^[oO]/, peg$c74 = peg$classExpectation(["o", "O"], false, false), peg$c75 = /^[rR]/, peg$c76 = peg$classExpectation(["r", "R"], false, false), peg$c77 = function peg$c77(bool) { return bool; }, peg$c78 = /^[tT]/, peg$c79 = peg$classExpectation(["t", "T"], false, false), peg$c80 = /^[uU]/, peg$c81 = peg$classExpectation(["u", "U"], false, false), peg$c82 = /^[eE]/, peg$c83 = peg$classExpectation(["e", "E"], false, false), peg$c84 = function peg$c84() { return Exp.boolean(text(), location()); }, peg$c85 = /^[fF]/, peg$c86 = peg$classExpectation(["f", "F"], false, false), peg$c87 = /^[aA]/, peg$c88 = peg$classExpectation(["a", "A"], false, false), peg$c89 = /^[lL]/, peg$c90 = peg$classExpectation(["l", "L"], false, false), peg$c91 = /^[sS]/, peg$c92 = peg$classExpectation(["s", "S"], false, false), peg$c93 = /^[yY]/, peg$c94 = peg$classExpectation(["y", "Y"], false, false), peg$c95 = /^[nN]/, peg$c96 = peg$classExpectation(["n", "N"], false, false), peg$c97 = /^[\-]/, peg$c98 = peg$classExpectation(["-"], false, false), peg$c99 = /^[0-9]/, peg$c100 = peg$classExpectation([["0", "9"]], false, false), peg$c101 = ".", peg$c102 = peg$literalExpectation(".", false), peg$c103 = function peg$c103() { return Exp.number(text(), location()); }, peg$c104 = function peg$c104(num) { return num; }, peg$c105 = "'", peg$c106 = peg$literalExpectation("'", false), peg$c107 = function peg$c107() { return text(); }, peg$c108 = function peg$c108(expression) { return Exp.date(expression, location()); }, peg$c109 = peg$otherExpectation("alpha numeric"), peg$c110 = /^[a-zA-Z0-9.]/, peg$c111 = peg$classExpectation([["a", "z"], ["A", "Z"], ["0", "9"], "."], false, false), peg$c112 = peg$otherExpectation("whitespace"), peg$c113 = /^[ \t\n\r]/, peg$c114 = 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; peg$silentFails++; s0 = peg$parseidentifier(); 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$c49(); } s0 = s1; return s0; } function peg$parseidentifierChar() { var s0; s0 = peg$parsealnum(); if (s0 === peg$FAILED) { if (peg$c50.test(input.charAt(peg$currPos))) { s0 = input.charAt(peg$currPos); peg$currPos++; } else { s0 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c51); } } 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$c52); } } 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$c54(s1); } s0 = s1; peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c53); } } 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$parsecontainsValue(); if (s3 !== peg$FAILED) { s4 = []; s5 = peg$currPos; s6 = peg$parsespace(); if (s6 !== peg$FAILED) { s7 = peg$parseorWord(); if (s7 !== peg$FAILED) { s8 = peg$parsespace(); if (s8 !== peg$FAILED) { s9 = peg$parsecontainsValue(); if (s9 !== peg$FAILED) { peg$savedPos = s5; s6 = peg$c55(s3, s9); s5 = s6; } else { peg$currPos = s5; s5 = peg$FAILED; } } else { peg$currPos = s5; s5 = peg$FAILED; } } else { peg$currPos = s5; s5 = peg$FAILED; }