text: "use strict";
  
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (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 = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
  
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
  
  module.exports = function () {
    "use strict";
    /*
     * Generated by PEG.js 0.9.0.
     *
     * http://pegjs.org/
     */
  
    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);
  
    function peg$parse(input) {
      var options = arguments.length > 1 ? arguments[1] : {},
          parser = this,
          peg$FAILED = {},
          peg$startRuleFunctions = {
        start: peg$parsestart,
        Literal: peg$parseLiteral
      },
          peg$startRuleFunction = peg$parsestart,
          peg$c0 = function peg$c0(query, trailing) {
        if (trailing.type === 'cursor') {
          return _objectSpread({}, trailing, {
            suggestionTypes: ['conjunction']
          });
        }
  
        if (query !== null) return query;
        return nodeTypes.function.buildNode('is', '*', '*');
      },
          peg$c1 = function peg$c1() {
        return errorOnLuceneSyntax;
      },
          peg$c2 = function peg$c2(left, right) {
        var cursor = [left, right].find(function (node) {
          return node.type === 'cursor';
        });
        if (cursor) return cursor;
        return buildFunctionNode('or', [left, right]);
      },
          peg$c3 = function peg$c3(left, right) {
        var cursor = [left, right].find(function (node) {
          return node.type === 'cursor';
        });
        if (cursor) return cursor;
        return buildFunctionNode('and', [left, right]);
      },
          peg$c4 = function peg$c4(query) {
        if (query.type === 'cursor') return query;
        return buildFunctionNode('not', [query]);
      },
          peg$c5 = "(",
          peg$c6 = {
        type: "literal",
        value: "(",
        description: "\"(\""
      },
          peg$c7 = ")",
          peg$c8 = {
        type: "literal",
        value: ")",
        description: "\")\""
      },
          peg$c9 = function peg$c9(query, trailing) {
        if (trailing.type === 'cursor') {
          return _objectSpread({}, trailing, {
            suggestionTypes: ['conjunction']
          });
        }
  
        return query;
      },
          peg$c10 = {
        type: "other",
        description: "fieldName"
      },
          peg$c11 = function peg$c11(field, operator, value) {
        if (value.type === 'cursor') {
          return _objectSpread({}, value, {
            suggestionTypes: ['conjunction']
          });
        }
  
        var range = buildNamedArgNode(operator, value);
        return buildFunctionNode('range', [field, range]);
      },
          peg$c12 = ":",
          peg$c13 = {
        type: "literal",
        value: ":",
        description: "\":\""
      },
          peg$c14 = function peg$c14(field, partial) {
        if (partial.type === 'cursor') {
          return _objectSpread({}, partial, {
            fieldName: field.value,
            suggestionTypes: ['value', 'conjunction']
          });
        }
  
        return partial(field);
      },
          peg$c15 = function peg$c15(partial) {
        if (partial.type === 'cursor') {
          var fieldName = "".concat(partial.prefix).concat(partial.suffix).trim();
          return _objectSpread({}, partial, {
            fieldName: fieldName,
            suggestionTypes: ['field', 'operator', 'conjunction']
          });
        }
  
        var field = buildLiteralNode(null);
        return partial(field);
      },
          peg$c16 = function peg$c16(partial, trailing) {
        if (trailing.type === 'cursor') {
          return _objectSpread({}, trailing, {
            suggestionTypes: ['conjunction']
          });
        }
  
        return partial;
      },
          peg$c17 = function peg$c17(partialLeft, partialRight) {
        var cursor = [partialLeft, partialRight].find(function (node) {
          return node.type === 'cursor';
        });
  
        if (cursor) {
          return _objectSpread({}, cursor, {
            suggestionTypes: ['value']
          });
        }
  
        return function (field) {
          return buildFunctionNode('or', [partialLeft(field), partialRight(field)]);
        };
      },
          peg$c18 = function peg$c18(partialLeft, partialRight) {
        var cursor = [partialLeft, partialRight].find(function (node) {
          return node.type === 'cursor';
        });
  
        if (cursor) {
          return _objectSpread({}, cursor, {
            suggestionTypes: ['value']
          });
        }
  
        return function (field) {
          return buildFunctionNode('and', [partialLeft(field), partialRight(field)]);
        };
      },
          peg$c19 = function peg$c19(partial) {
        if (partial.type === 'cursor') {
          return _objectSpread({}, list, {
            suggestionTypes: ['value']
          });
        }
  
        return function (field) {
          return buildFunctionNode('not', [partial(field)]);
        };
      },
          peg$c20 = {
        type: "other",
        description: "value"
      },
          peg$c21 = function peg$c21(value) {
        if (value.type === 'cursor') return value;
        var isPhrase = buildLiteralNode(true);
        return function (field) {
          return buildFunctionNode('is', [field, value, isPhrase]);
        };
      },
          peg$c22 = function peg$c22(value) {
        if (value.type === 'cursor') return value;
  
        if (!allowLeadingWildcards && value.type === 'wildcard' && nodeTypes.wildcard.hasLeadingWildcard(value)) {
          error('Leading wildcards are disabled. See query:allowLeadingWildcards in Advanced Settings.');
        }
  
        var isPhrase = buildLiteralNode(false);
        return function (field) {
          return buildFunctionNode('is', [field, value, isPhrase]);
        };
      },
          peg$c23 = {
        type: "other",
        description: "OR"
      },
          peg$c24 = "or",
          peg$c25 = {
        type: "literal",
        value: "or",
        description: "\"or\""
      },
          peg$c26 = {
        type: "other",
        description: "AND"
      },
          peg$c27 = "and",
          peg$c28 = {
        type: "literal",
        value: "and",
        description: "\"and\""
      },
          peg$c29 = {
        type: "other",
        description: "NOT"
      },
          peg$c30 = "not",
          peg$c31 = {
        type: "literal",
        value: "not",
        description: "\"not\""
      },
          peg$c32 = {
        type: "other",
        description: "literal"
      },
          peg$c33 = "\"",
          peg$c34 = {
        type: "literal",
        value: "\"",
        description: "\"\\\"\""
      },
          peg$c35 = function peg$c35(prefix, cursor, suffix) {
        var _location = location(),
            start = _location.start,
            end = _location.end;
  
        return {
          type: 'cursor',
          start: start.offset,
          end: end.offset - cursor.length,
          prefix: prefix.join(''),
          suffix: suffix.join(''),
          text: text().replace(cursor, '')
        };
      },
          peg$c36 = function peg$c36(chars) {
        return buildLiteralNode(chars.join(''));
      },
          peg$c37 = "\\",
          peg$c38 = {
        type: "literal",
        value: "\\",
        description: "\"\\\\\""
      },
          peg$c39 = /^[\\"]/,
          peg$c40 = {
        type: "class",
        value: "[\\\\\"]",
        description: "[\\\\\"]"
      },
          peg$c41 = function peg$c41(char) {
        return char;
      },
          peg$c42 = /^[^"]/,
          peg$c43 = {
        type: "class",
        value: "[^\"]",
        description: "[^\"]"
      },
          peg$c44 = function peg$c44(chars) {
        var sequence = chars.join('').trim();
        if (sequence === 'null') return buildLiteralNode(null);
        if (sequence === 'true') return buildLiteralNode(true);
        if (sequence === 'false') return buildLiteralNode(false);
        if (chars.includes(wildcardSymbol)) return buildWildcardNode(sequence);
        var number = Number(sequence);
        var value = isNaN(number) ? sequence : number;
        return buildLiteralNode(value);
      },
          peg$c45 = {
        type: "any",
        description: "any character"
      },
          peg$c46 = "*",
          peg$c47 = {
        type: "literal",
        value: "*",
        description: "\"*\""
      },
          peg$c48 = function peg$c48() {
        return wildcardSymbol;
      },
          peg$c49 = "\\t",
          peg$c50 = {
        type: "literal",
        value: "\\t",
        description: "\"\\\\t\""
      },
          peg$c51 = function peg$c51() {
        return '\t';
      },
          peg$c52 = "\\r",
          peg$c53 = {
        type: "literal",
        value: "\\r",
        description: "\"\\\\r\""
      },
          peg$c54 = function peg$c54() {
        return '\r';
      },
          peg$c55 = "\\n",
          peg$c56 = {
        type: "literal",
        value: "\\n",
        description: "\"\\\\n\""
      },
          peg$c57 = function peg$c57() {
        return '\n';
      },
          peg$c58 = function peg$c58(keyword) {
        return keyword;
      },
          peg$c59 = /^[\\():<>"*]/,
          peg$c60 = {
        type: "class",
        value: "[\\\\():<>\"*]",
        description: "[\\\\():<>\"*]"
      },
          peg$c61 = "<=",
          peg$c62 = {
        type: "literal",
        value: "<=",
        description: "\"<=\""
      },
          peg$c63 = function peg$c63() {
        return 'lte';
      },
          peg$c64 = ">=",
          peg$c65 = {
        type: "literal",
        value: ">=",
        description: "\">=\""
      },
          peg$c66 = function peg$c66() {
        return 'gte';
      },
          peg$c67 = "<",
          peg$c68 = {
        type: "literal",
        value: "<",
        description: "\"<\""
      },
          peg$c69 = function peg$c69() {
        return 'lt';
      },
          peg$c70 = ">",
          peg$c71 = {
        type: "literal",
        value: ">",
        description: "\">\""
      },
          peg$c72 = function peg$c72() {
        return 'gt';
      },
          peg$c73 = {
        type: "other",
        description: "whitespace"
      },
          peg$c74 = /^[ \t\r\n]/,
          peg$c75 = {
        type: "class",
        value: "[\\ \\t\\r\\n]",
        description: "[\\ \\t\\r\\n]"
      },
          peg$c76 = function peg$c76() {
        return parseCursor;
      },
          peg$c77 = "@kuery-cursor@",
          peg$c78 = {
        type: "literal",
        value: "@kuery-cursor@",
        description: "\"@kuery-cursor@\""
      },
          peg$c79 = function peg$c79() {
        return cursorSymbol;
      },
          peg$c80 = "||",
          peg$c81 = {
        type: "literal",
        value: "||",
        description: "\"||\""
      },
          peg$c82 = function peg$c82() {
        error('LuceneOr');
      },
          peg$c83 = "&&",
          peg$c84 = {
        type: "literal",
        value: "&&",
        description: "\"&&\""
      },
          peg$c85 = function peg$c85() {
        error('LuceneAnd');
      },
          peg$c86 = "+",
          peg$c87 = {
        type: "literal",
        value: "+",
        description: "\"+\""
      },
          peg$c88 = "-",
          peg$c89 = {
        type: "literal",
        value: "-",
        description: "\"-\""
      },
          peg$c90 = function peg$c90() {
        error('LuceneNot');
      },
          peg$c91 = "!",
          peg$c92 = {
        type: "literal",
        value: "!",
        description: "\"!\""
      },
          peg$c93 = "_exists_",
          peg$c94 = {
        type: "literal",
        value: "_exists_",
        description: "\"_exists_\""
      },
          peg$c95 = function peg$c95() {
        error('LuceneExists');
      },
          peg$c96 = function peg$c96() {
        error('LuceneRange');
      },
          peg$c97 = "?",
          peg$c98 = {
        type: "literal",
        value: "?",
        description: "\"?\""
      },
          peg$c99 = function peg$c99() {
        error('LuceneWildcard');
      },
          peg$c100 = "/",
          peg$c101 = {
        type: "literal",
        value: "/",
        description: "\"/\""
      },
          peg$c102 = /^[^\/]/,
          peg$c103 = {
        type: "class",
        value: "[^/]",
        description: "[^/]"
      },
          peg$c104 = function peg$c104() {
        error('LuceneRegex');
      },
          peg$c105 = "~",
          peg$c106 = {
        type: "literal",
        value: "~",
        description: "\"~\""
      },
          peg$c107 = /^[0-9]/,
          peg$c108 = {
        type: "class",
        value: "[0-9]",
        description: "[0-9]"
      },
          peg$c109 = function peg$c109() {
        error('LuceneFuzzy');
      },
          peg$c110 = function peg$c110() {
        error('LuceneProximity');
      },
          peg$c111 = "^",
          peg$c112 = {
        type: "literal",
        value: "^",
        description: "\"^\""
      },
          peg$c113 = function peg$c113() {
        error('LuceneBoost');
      },
          peg$c114 = function peg$c114() {
        return char;
      },
          peg$c115 = "=",
          peg$c116 = {
        type: "literal",
        value: "=",
        description: "\"=\""
      },
          peg$c117 = "{",
          peg$c118 = {
        type: "literal",
        value: "{",
        description: "\"{\""
      },
          peg$c119 = "}",
          peg$c120 = {
        type: "literal",
        value: "}",
        description: "\"}\""
      },
          peg$c121 = "[",
          peg$c122 = {
        type: "literal",
        value: "[",
        description: "\"[\""
      },
          peg$c123 = "]",
          peg$c124 = {
        type: "literal",
        value: "]",
        description: "\"]\""
      },
          peg$c125 = "TO",
          peg$c126 = {
        type: "literal",
        value: "TO",
        description: "\"TO\""
      },
          peg$currPos = 0,
          peg$savedPos = 0,
          peg$posDetailsCache = [{
        line: 1,
        column: 1,
        seenCR: false
      }],
          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) {
        throw peg$buildException(null, [{
          type: "other",
          description: description
        }], input.substring(peg$savedPos, peg$currPos), peg$computeLocation(peg$savedPos, peg$currPos));
      }
  
      function error(message) {
        throw peg$buildException(message, null, input.substring(peg$savedPos, peg$currPos), peg$computeLocation(peg$savedPos, peg$currPos));
      }
  
      function peg$computePosDetails(pos) {
        var details = peg$posDetailsCache[pos],
            p,
            ch;
  
        if (details) {
          return details;
        } else {
          p = pos - 1;
  
          while (!peg$posDetailsCache[p]) {
            p--;
          }
  
          details = peg$posDetailsCache[p];
          details = {
            line: details.line,
            column: details.column,
            seenCR: details.seenCR
          };
  
          while (p < pos) {
            ch = input.charAt(p);
  
            if (ch === "\n") {
              if (!details.seenCR) {
                details.line++;
              }
  
              details.column = 1;
              details.seenCR = false;
            } else if (ch === "\r" || ch === "\u2028" || ch === "\u2029") {
              details.line++;
              details.column = 1;
              details.seenCR = true;
            } else {
              details.column++;
              details.seenCR = false;
            }
  
            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$buildException(message, expected, found, location) {
        function cleanupExpected(expected) {
          var i = 1;
          expected.sort(function (a, b) {
            if (a.description < b.description) {
              return -1;
            } else if (a.description > b.description) {
              return 1;
            } else {
              return 0;
            }
          });
  
          while (i < expected.length) {
            if (expected[i - 1] === expected[i]) {
              expected.splice(i, 1);
            } else {
              i++;
            }
          }
        }
  
        function buildMessage(expected, found) {
          function stringEscape(s) {
            function hex(ch) {
              return ch.charCodeAt(0).toString(16).toUpperCase();
            }
  
            return s.replace(/\\/g, '\\\\').replace(/"/g, '\\"').replace(/\x08/g, '\\b').replace(/\t/g, '\\t').replace(/\n/g, '\\n').replace(/\f/g, '\\f').replace(/\r/g, '\\r').replace(/[\x00-\x07\x0B\x0E\x0F]/g, function (ch) {
              return '\\x0' + hex(ch);
            }).replace(/[\x10-\x1F\x80-\xFF]/g, function (ch) {
              return '\\x' + hex(ch);
            }).replace(/[\u0100-\u0FFF]/g, function (ch) {
              return "\\u0" + hex(ch);
            }).replace(/[\u1000-\uFFFF]/g, function (ch) {
              return "\\u" + hex(ch);
            });
          }
  
          var expectedDescs = new Array(expected.length),
              expectedDesc,
              foundDesc,
              i;
  
          for (i = 0; i < expected.length; i++) {
            expectedDescs[i] = expected[i].description;
          }
  
          expectedDesc = expected.length > 1 ? expectedDescs.slice(0, -1).join(", ") + " or " + expectedDescs[expected.length - 1] : expectedDescs[0];
          foundDesc = found ? "\"" + stringEscape(found) + "\"" : "end of input";
          return "Expected " + expectedDesc + " but " + foundDesc + " found.";
        }
  
        if (expected !== null) {
          cleanupExpected(expected);
        }
  
        return new peg$SyntaxError(message !== null ? message : buildMessage(expected, found), expected, found, location);
      }
  
      function peg$parsestart() {
        var s0, s1, s2, s3;
        s0 = peg$currPos;
        s1 = [];
        s2 = peg$parseSpace();
  
        while (s2 !== peg$FAILED) {
          s1.push(s2);
          s2 = peg$parseSpace();
        }
  
        if (s1 !== peg$FAILED) {
          s2 = peg$parseOrQuery();
  
          if (s2 === peg$FAILED) {
            s2 = null;
          }
  
          if (s2 !== peg$FAILED) {
            s3 = peg$parseOptionalSpace();
  
            if (s3 !== peg$FAILED) {
              peg$savedPos = s0;
              s1 = peg$c0(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;
        }
  
        return s0;
      }
  
      function peg$parseOrQuery() {
        var s0, s1, s2, s3;
        s0 = peg$currPos;
        peg$savedPos = peg$currPos;
        s1 = peg$c1();
  
        if (s1) {
          s1 = void 0;
        } else {
          s1 = peg$FAILED;
        }
  
        if (s1 !== peg$FAILED) {
          s2 = peg$parseLuceneQuery();
  
          if (s2 !== peg$FAILED) {
            s1 = [s1, 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$parseAndQuery();
  
          if (s1 !== peg$FAILED) {
            s2 = peg$parseOr();
  
            if (s2 !== peg$FAILED) {
              s3 = peg$parseOrQuery();
  
              if (s3 !== peg$FAILED) {
                peg$savedPos = s0;
                s1 = peg$c2(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;
          }
  
          if (s0 === peg$FAILED) {
            s0 = peg$parseAndQuery();
          }
        }
  
        return s0;
      }
  
      function peg$parseAndQuery() {
        var s0, s1, s2, s3;
        s0 = peg$currPos;
        s1 = peg$parseNotQuery();
  
        if (s1 !== peg$FAILED) {
          s2 = peg$parseAnd();
  
          if (s2 !== peg$FAILED) {
            s3 = peg$parseAndQuery();
  
            if (s3 !== peg$FAILED) {
              peg$savedPos = s0;
              s1 = peg$c3(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;
        }
  
        if (s0 === peg$FAILED) {
          s0 = peg$parseNotQuery();
        }
  
        return s0;
      }
  
      function peg$parseNotQuery() {
        var s0, s1, s2;
        s0 = peg$currPos;
        s1 = peg$parseNot();
  
        if (s1 !== peg$FAILED) {
          s2 = peg$parseSubQuery();
  
          if (s2 !== peg$FAILED) {
            peg$savedPos = s0;
            s1 = peg$c4(s2);
            s0 = s1;
          } else {
            peg$currPos = s0;
            s0 = peg$FAILED;
          }
        } else {
          peg$currPos = s0;
          s0 = peg$FAILED;
        }
  
        if (s0 === peg$FAILED) {
          s0 = peg$parseSubQuery();
        }
  
        return s0;
      }
  
      function peg$parseSubQuery() {
        var s0, s1, s2, s3, s4, s5;
        s0 = peg$currPos;
  
        if (input.charCodeAt(peg$currPos) === 40) {
          s1 = peg$c5;
          peg$currPos++;
        } else {
          s1 = peg$FAILED;
  
          if (peg$silentFails === 0) {
            peg$fail(peg$c6);
          }
        }
  
        if (s1 !== peg$FAILED) {
          s2 = [];
          s3 = peg$parseSpace();
  
          while (s3 !== peg$FAILED) {
            s2.push(s3);
            s3 = peg$parseSpace();
          }
  
          if (s2 !== peg$FAILED) {
            s3 = peg$parseOrQuery();
  
            if (s3 !== peg$FAILED) {
              s4 = peg$parseOptionalSpace();
  
              if (s4 !== peg$FAILED) {
                if (input.charCodeAt(peg$currPos) === 41) {
                  s5 = peg$c7;
                  peg$currPos++;
                } else {
                  s5 = peg$FAILED;
  
                  if (peg$silentFails === 0) {
                    peg$fail(peg$c8);
                  }
                }
  
                if (s5 !== peg$FAILED) {
                  peg$savedPos = s0;
                  s1 = peg$c9(s3, s4);
                  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;
          }
        } else {
          peg$currPos = s0;
          s0 = peg$FAILED;
        }
  
        if (s0 === peg$FAILED) {
          s0 = peg$parseExpression();
        }
  
        return s0;
      }
  
      function peg$parseExpression() {
        var s0;
        s0 = peg$parseFieldRangeExpression();
  
        if (s0 === peg$FAILED) {
          s0 = peg$parseFieldValueExpression();
  
          if (s0 === peg$FAILED) {
            s0 = peg$parseValueExpression();
          }
        }
  
        return s0;
      }
  
      function peg$parseField() {
        var s0, s1;
        peg$silentFails++;
        s0 = peg$parseLiteral();
        peg$silentFails--;
  
        if (s0 === peg$FAILED) {
          s1 = peg$FAILED;
  
          if (peg$silentFails === 0) {
            peg$fail(peg$c10);
          }
        }
  
        return s0;
      }
  
      function peg$parseFieldRangeExpression() {
        var s0, s1, s2, s3, s4, s5;
        s0 = peg$currPos;
        s1 = peg$parseField();
  
        if (s1 !== peg$FAILED) {
          s2 = [];
          s3 = peg$parseSpace();
  
          while (s3 !== peg$FAILED) {
            s2.push(s3);
            s3 = peg$parseSpace();
          }
  
          if (s2 !== peg$FAILED) {
            s3 = peg$parseRangeOperator();
  
            if (s3 !== peg$FAILED) {
              s4 = [];
              s5 = peg$parseSpace();
  
              while (s5 !== peg$FAILED) {
                s4.push(s5);
                s5 = peg$parseSpace();
              }
  
              if (s4 !== peg$FAILED) {
                s5 = peg$parseLiteral();
  
                if (s5 !== peg$FAILED) {
                  peg$savedPos = s0;
                  s1 = peg$c11(s1, s3, s5);
                  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;
          }
        } else {
          peg$currPos = s0;
          s0 = peg$FAILED;
        }
  
        return s0;
      }
  
      function peg$parseFieldValueExpression() {
        var s0, s1, s2, s3, s4, s5;
        s0 = peg$currPos;
        s1 = peg$parseField();
  
        if (s1 !== peg$FAILED) {
          s2 = [];
          s3 = peg$parseSpace();
  
          while (s3 !== peg$FAILED) {
            s2.push(s3);
            s3 = peg$parseSpace();
          }
  
          if (s2 !== peg$FAILED) {
            if (input.charCodeAt(peg$currPos) === 58) {
              s3 = peg$c12;
              peg$currPos++;
            } else {
              s3 = peg$FAILED;
  
              if (peg$silentFails === 0) {
                peg$fail(peg$c13);
              }
            }
  
            if (s3 !== peg$FAILED) {
              s4 = [];
              s5 = peg$parseSpace();
  
              while (s5 !== peg$FAILED) {
                s4.push(s5);
                s5 = peg$parseSpace();
              }
  
              if (s4 !== peg$FAILED) {
                s5 = peg$parseListOfValues();
  
                if (s5 !== peg$FAILED) {
                  peg$savedPos = s0;
                  s1 = peg$c14(s1, s5);
                  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;
          }
        } else {
          peg$currPos = s0;
          s0 = peg$FAILED;
        }
  
        return s0;
      }
  
      function peg$parseValueExpression() {
        var s0, s1;
        s0 = peg$currPos;
        s1 = peg$parseValue();
  
        if (s1 !== peg$FAILED) {
          peg$savedPos = s0;
          s1 = peg$c15(s1);
        }
  
        s0 = s1;
        return s0;
      }
  
      function peg$parseListOfValues() {
        var s0, s1, s2, s3, s4, s5;
        s0 = peg$currPos;
  
        if (input.charCodeAt(peg$currPos) === 40) {
          s1 = peg$c5;
          peg$currPos++;
        } else {
          s1 = peg$FAILED;
  
          if (peg$silentFails === 0) {
            peg$fail(peg$c6);
          }
        }
  
        if (s1 !== peg$FAILED) {
          s2 = [];
          s3 = peg$parseSpace();
  
          while (s3 !== peg$FAILED) {
            s2.push(s3);
            s3 = peg$parseSpace();
          }
  
          if (s2 !== peg$FAILED) {
            s3 = peg$parseOrListOfValues();
  
            if (s3 !== peg$FAILED) {
              s4 = peg$parseOptionalSpace();
  
              if (s4 !== peg$FAILED) {
                if (input.charCodeAt(peg$currPos) === 41) {
                  s5 = peg$c7;
                  peg$currPos++;
                } else {
                  s5 = peg$FAILED;
  
                  if (peg$silentFails === 0) {
                    peg$fail(peg$c8);
                  }
                }
  
                if (s5 !== peg$FAILED) {
                  peg$savedPos = s0;
                  s1 = peg$c16(s3, s4);
                  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;
          }
        } else {
          peg$currPos = s0;
          s0 = peg$FAILED;
        }
  
        if (s0 === peg$FAILED) {
          s0 = peg$parseValue();
        }
  
        return s0;
      }
  
      function peg$parseOrListOfValues() {
        var s0, s1, s2, s3;
        s0 = peg$currPos;
        s1 = peg$parseAndListOfValues();
  
        if (s1 !== peg$FAILED) {
          s2 = peg$parseOr();
  
          if (s2 !== peg$FAILED) {
            s3 = peg$parseOrListOfValues();
  
            if (s3 !== peg$FAILED) {
              peg$savedPos = s0;
              s1 = peg$c17(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;
        }
  
        if (s0 === peg$FAILED) {
          s0 = peg$parseAndListOfValues();
        }
  
        return s0;
      }
  
      function peg$parseAndListOfValues() {
        var s0, s1, s2, s3;
        s0 = peg$currPos;
        s1 = peg$parseNotListOfValues();
  
        if (s1 !== peg$FAILED) {
          s2 = peg$parseAnd();
  
          if (s2 !== peg$FAILED) {
            s3 = peg$parseAndListOfValues();
  
            if (s3 !== peg$FAILED) {
              peg$savedPos = s0;
              s1 = peg$c18(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;
        }
  
        if (s0 === peg$FAILED) {
          s0 = peg$parseNotListOfValues();
        }
  
        return s0;
      }
  
      function peg$parseNotListOfValues() {
        var s0, s1, s2;
        s0 = peg$currPos;
        s1 = peg$parseNot();
  
        if (s1 !== peg$FAILED) {
          s2 = peg$parseListOfValues();
  
          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;
        }
  
        if (s0 === peg$FAILED) {
          s0 = peg$parseListOfValues();
        }
  
        return s0;
      }
  
      function peg$parseValue() {
        var s0, s1;
        peg$silentFails++;
        s0 = peg$currPos;
        s1 = peg$parseQuotedString();
  
        if (s1 !== peg$FAILED) {
          peg$savedPos = s0;
          s1 = peg$c21(s1);
        }
  
        s0 = s1;
  
        if (s0 === peg$FAILED) {
          s0 = peg$currPos;
          s1 = peg$parseUnquotedLiteral();
  
          if (s1 !== peg$FAILED) {
            peg$savedPos = s0;
            s1 = peg$c22(s1);
          }
  
          s0 = s1;
        }
  
        peg$silentFails--;
  
        if (s0 === peg$FAILED) {
          s1 = peg$FAILED;
  
          if (peg$silentFails === 0) {
            peg$fail(peg$c20);
          }
        }
  
        return s0;
      }
  
      function peg$parseOr() {
        var s0, s1, s2, s3, s4;
        peg$silentFails++;
        s0 = peg$currPos;
        s1 = [];
        s2 = peg$parseSpace();
  
        if (s2 !== peg$FAILED) {
          while (s2 !== peg$FAILED) {
            s1.push(s2);
            s2 = peg$parseSpace();
          }
        } else {
          s1 = peg$FAILED;
        }
  
        if (s1 !== peg$FAILED) {
          if (input.substr(peg$currPos, 2).toLowerCase() === peg$c24) {
            s2 = input.substr(peg$currPos, 2);
            peg$currPos += 2;
          } else {
            s2 = peg$FAILED;
  
            if (peg$silentFails === 0) {
              peg$fail(peg$c25);
            }
          }
  
          if (s2 !== peg$FAILED) {
            s3 = [];
            s4 = peg$parseSpace();
  
            if (s4 !== peg$FAILED) {
              while (s4 !== peg$FAILED) {
                s3.push(s4);
                s4 = peg$parseSpace();
              }
            } else {
              s3 = peg$FAILED;
            }
  
            if (s3 !== peg$FAILED) {
              s1 = [s1, 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;
        }
  
        if (s0 === peg$FAILED) {
          s0 = peg$currPos;
          peg$savedPos = peg$currPos;
          s1 = peg$c1();
  
          if (s1) {
            s1 = void 0;
          } else {
            s1 = peg$FAILED;
          }
  
          if (s1 !== peg$FAILED) {
            s2 = peg$parseLuceneOr();
  
            if (s2 !== peg$FAILED) {
              s1 = [s1, 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$c23);
          }
        }
  
        return s0;
      }
  
      function peg$parseAnd() {
        var s0, s1, s2, s3, s4;
        peg$silentFails++;
        s0 = peg$currPos;
        s1 = [];
        s2 = peg$parseSpace();
  
        if (s2 !== peg$FAILED) {
          while (s2 !== peg$FAILED) {
            s1.push(s2);
            s2 = peg$parseSpace();
          }
        } else {
          s1 = peg$FAILED;
        }
  
        if (s1 !== peg$FAILED) {
          if (input.substr(peg$currPos, 3).toLowerCase() === peg$c27) {
            s2 = input.substr(peg$currPos, 3);
            peg$currPos += 3;
          } else {
            s2 = peg$FAILED;
  
            if (peg$silentFails === 0) {
              peg$fail(peg$c28);
            }
          }
  
          if (s2 !== peg$FAILED) {
            s3 = [];
            s4 = peg$parseSpace();
  
            if (s4 !== peg$FAILED) {
              while (s4 !== peg$FAILED) {
                s3.push(s4);
                s4 = peg$parseSpace();
              }
            } else {
              s3 = peg$FAILED;
            }
  
            if (s3 !== peg$FAILED) {
              s1 = [s1, 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;
        }
  
        if (s0 === peg$FAILED) {
          s0 = peg$currPos;
          peg$savedPos = peg$currPos;
          s1 = peg$c1();
  
          if (s1) {
            s1 = void 0;
          } else {
            s1 = peg$FAILED;
          }
  
          if (s1 !== peg$FAILED) {
            s2 = peg$parseLuceneAnd();
  
            if (s2 !== peg$FAILED) {
              s1 = [s1, 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$c26);
          }
        }
  
        return s0;
      }
  
      function peg$parseNot() {
        var s0, s1, s2, s3;
        peg$silentFails++;
        s0 = peg$currPos;
  
        if (input.substr(peg$currPos, 3).toLowerCase() === peg$c30) {
          s1 = input.substr(peg$currPos, 3);
          peg$currPos += 3;
        } else {
          s1 = peg$FAILED;
  
          if (peg$silentFails === 0) {
            peg$fail(peg$c31);
          }
        }
  
        if (s1 !== peg$FAILED) {
          s2 = [];
          s3 = peg$parseSpace();
  
          if (s3 !== peg$FAILED) {
            while (s3 !== peg$FAILED) {
              s2.push(s3);
              s3 = peg$parseSpace();
            }
          } else {
            s2 = peg$FAILED;
          }
  
          if (s2 !== peg$FAILED) {
            s1 = [s1, s2];
            s0 = s1;
          } else {
            peg$currPos = s0;
            s0 = peg$FAILED;
          }
        } else {
          peg$currPos = s0;
          s0 = peg$FAILED;
        }
  
        if (s0 === peg$FAILED) {
          s0 = peg$currPos;
          peg$savedPos = peg$currPos;
          s1 = peg$c1();
  
          if (s1) {
            s1 = void 0;
          } else {
            s1 = peg$FAILED;
          }
  
          if (s1 !== peg$FAILED) {
            s2 = peg$parseLuceneNot();
  
            if (s2 !== peg$FAILED) {
              s1 = [s1, 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$c29);
          }
        }
  
        return s0;
      }
  
      function peg$parseLiteral() {
        var s0, s1;
        peg$silentFails++;
        s0 = peg$parseQuotedString();
  
        if (s0 === peg$FAILED) {
          s0 = peg$parseUnquotedLiteral();
        }
  
        peg$silentFails--;
  
        if (s0 === peg$FAILED) {
          s1 = peg$FAILED;
  
          if (peg$silentFails === 0) {
            peg$fail(peg$c32);
          }
        }
  
        return s0;
      }
  
      function peg$parseQuotedString() {
        var s0, s1, s2, s3, s4, s5;
        s0 = peg$currPos;
  
        if (input.charCodeAt(peg$currPos) === 34) {
          s1 = peg$c33;
          peg$currPos++;
        } else {
          s1 = peg$FAILED;
  
          if (peg$silentFails === 0) {
            peg$fail(peg$c34);
          }
        }
  
        if (s1 !== peg$FAILED) {
          s2 = [];
          s3 = peg$parseQuotedCharacter();
  
          while (s3 !== peg$FAILED) {
            s2.push(s3);
            s3 = peg$parseQuotedCharacter();
          }
  
          if (s2 !== peg$FAILED) {
            s3 = peg$parseCursor();
  
            if (s3 !== peg$FAILED) {
              s4 = [];
              s5 = peg$parseQuotedCharacter();
  
              while (s5 !== peg$FAILED) {
                s4.push(s5);
                s5 = peg$parseQuotedCharacter();
              }
  
              if (s4 !== peg$FAILED) {
                if (input.charCodeAt(peg$currPos) === 34) {
                  s5 = peg$c33;
                  peg$currPos++;
                } else {
                  s5 = peg$FAILED;
  
                  if (peg$silentFails === 0) {
                    peg$fail(peg$c34);
                  }
                }
  
                if (s5 !== peg$FAILED) {
                  peg$savedPos = s0;
                  s1 = peg$c35(s2, s3, s4);
                  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;
          }
        } else {
          peg$currPos = s0;
          s0 = peg$FAILED;
        }
  
        if (s0 === peg$FAILED) {
          s0 = peg$currPos;
  
          if (input.charCodeAt(peg$currPos) === 34) {
            s1 = peg$c33;
            peg$currPos++;
          } else {
            s1 = peg$FAILED;
  
            if (peg$silentFails === 0) {
              peg$fail(peg$c34);
            }
          }
  
          if (s1 !== peg$FAILED) {
            s2 = [];
            s3 = peg$parseQuotedCharacter();
  
            while (s3 !== peg$FAILED) {
              s2.push(s3);
              s3 = peg$parseQuotedCharacter();
            }
  
            if (s2 !== peg$FAILED) {
              if (input.charCodeAt(peg$currPos) === 34) {
                s3 = peg$c33;
                peg$currPos++;
              } else {
                s3 = peg$FAILED;
  
                if (peg$silentFails === 0) {
                  peg$fail(peg$c34);
                }
              }
  
              if (s3 !== peg$FAILED) {
                peg$savedPos = s0;
                s1 = peg$c36(s2);
                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$parseQuotedCharacter() {
        var s0, s1, s2;
        s0 = peg$parseEscapedWhitespace();
  
        if (s0 === peg$FAILED) {
          s0 = peg$currPos;
  
          if (input.charCodeAt(peg$currPos) === 92) {
            s1 = peg$c37;
            peg$currPos++;
          } else {
            s1 = peg$FAILED;
  
            if (peg$silentFails === 0) {
              peg$fail(peg$c38);
            }
          }
  
          if (s1 !== peg$FAILED) {
            if (peg$c39.test(input.charAt(peg$currPos))) {
              s2 = input.charAt(peg$currPos);
              peg$currPos++;
            } else {
              s2 = peg$FAILED;
  
              if (peg$silentFails === 0) {
                peg$fail(peg$c40);
              }
            }
  
            if (s2 !== peg$FAILED) {
              peg$savedPos = s0;
              s1 = peg$c41(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$currPos;
            peg$silentFails++;
            s2 = peg$parseCursor();
            peg$silentFails--;
  
            if (s2 === peg$FAILED) {
              s1 = void 0;
            } else {
              peg$currPos = s1;
              s1 = peg$FAILED;
            }
  
            if (s1 !== peg$FAILED) {
              if (peg$c42.test(input.charAt(peg$currPos))) {
                s2 = input.charAt(peg$currPos);
                peg$currPos++;
              } else {
                s2 = peg$FAILED;
  
                if (peg$silentFails === 0) {
                  peg$fail(peg$c43);
                }
              }
  
              if (s2 !== peg$FAILED) {
                peg$savedPos = s0;
                s1 = peg$c41(s2);
                s0 = s1;
              } else {
                peg$currPos = s0;
                s0 = peg$FAILED;
              }
            } else {
              peg$currPos = s0;
              s0 = peg$FAILED;
            }
          }
        }
  
        return s0;
      }
  
      function peg$parseUnquotedLiteral() {
        var s0, s1, s2, s3, s4;
        s0 = peg$currPos;
        s1 = [];
        s2 = peg$parseUnquotedCharacter();
  
        while (s2 !== peg$FAILED) {
          s1.push(s2);
          s2 = peg$parseUnquotedCharacter();
        }
  
        if (s1 !== peg$FAILED) {
          s2 = peg$parseCursor();
  
          if (s2 !== peg$FAILED) {
            s3 = [];
            s4 = peg$parseUnquotedCharacter();
  
            while (s4 !== peg$FAILED) {
              s3.push(s4);
              s4 = peg$parseUnquotedCharacter();
            }
  
            if (s3 !== peg$FAILED) {
              peg$savedPos = s0;
              s1 = peg$c35(s1, 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;
        }
  
        if (s0 === peg$FAILED) {
          s0 = peg$currPos;
          s1 = [];
          s2 = peg$parseUnquotedCharacter();
  
          if (s2 !== peg$FAILED) {
            while (s2 !== peg$FAILED) {
              s1.push(s2);
              s2 = peg$parseUnquotedCharacter();
            }
          } else {
            s1 = peg$FAILED;
          }
  
          if (s1 !== peg$FAILED) {
            peg$savedPos = s0;
            s1 = peg$c44(s1);
          }
  
          s0 = s1;
        }
  
        return s0;
      }
  
      function peg$parseUnquotedCharacter() {
        var s0, s1, s2, s3, s4;
        s0 = peg$parseEscapedWhitespace();
  
        if (s0 === peg$FAILED) {
          s0 = peg$parseEscapedSpecialCharacter();
  
          if (s0 === peg$FAILED) {
            s0 = peg$parseEscapedKeyword();
  
            if (s0 === peg$FAILED) {
              s0 = peg$parseWildcard();
  
              if (s0 === peg$FAILED) {
                s0 = peg$currPos;
                s1 = peg$currPos;
                peg$silentFails++;
                s2 = peg$parseSpecialCharacter();
                peg$silentFails--;
  
                if (s2 === peg$FAILED) {
                  s1 = void 0;
                } else {
                  peg$currPos = s1;
                  s1 = peg$FAILED;
                }
  
                if (s1 !== peg$FAILED) {
                  s2 = peg$currPos;
                  peg$silentFails++;
                  s3 = peg$parseKeyword();
                  peg$silentFails--;
  
                  if (s3 === peg$FAILED) {
                    s2 = void 0;
                  } else {
                    peg$currPos = s2;
                    s2 = peg$FAILED;
                  }
  
                  if (s2 !== peg$FAILED) {
                    s3 = peg$currPos;
                    peg$silentFails++;
                    s4 = peg$parseCursor();
                    peg$silentFails--;
  
                    if (s4 === peg$FAILED) {
                      s3 = void 0;
                    } else {
                      peg$currPos = s3;
                      s3 = peg$FAILED;
                    }
  
                    if (s3 !== peg$FAILED) {
                      if (input.length > peg$currPos) {
                        s4 = input.charAt(peg$currPos);
                        peg$currPos++;
                      } else {
                        s4 = peg$FAILED;
  
                        if (peg$silentFails === 0) {
                          peg$fail(peg$c45);
                        }
                      }
  
                      if (s4 !== peg$FAILED) {
                        peg$savedPos = s0;
                        s1 = peg$c41(s4);
                        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$parseWildcard() {
        var s0, s1;
        s0 = peg$currPos;
  
        if (input.charCodeAt(peg$currPos) === 42) {
          s1 = peg$c46;
          peg$currPos++;
        } else {
          s1 = peg$FAILED;
  
          if (peg$silentFails === 0) {
            peg$fail(peg$c47);
          }
        }
  
        if (s1 !== peg$FAILED) {
          peg$savedPos = s0;
          s1 = peg$c48();
        }
  
        s0 = s1;
        return s0;
      }
  
      function peg$parseOptionalSpace() {
        var s0, s1, s2, s3, s4;
        s0 = peg$currPos;
        s1 = [];
        s2 = peg$parseSpace();
  
        while (s2 !== peg$FAILED) {
          s1.push(s2);
          s2 = peg$parseSpace();
        }
  
        if (s1 !== peg$FAILED) {
          s2 = peg$parseCursor();
  
          if (s2 !== peg$FAILED) {
            s3 = [];
            s4 = peg$parseSpace();
  
            while (s4 !== peg$FAILED) {
              s3.push(s4);
              s4 = peg$parseSpace();
            }
  
            if (s3 !== peg$FAILED) {
              peg$savedPos = s0;
              s1 = peg$c35(s1, 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;
        }
  
        if (s0 === peg$FAILED) {
          s0 = [];
          s1 = peg$parseSpace();
  
          while (s1 !== peg$FAILED) {
            s0.push(s1);
            s1 = peg$parseSpace();
          }
        }
  
        return s0;
      }
  
      function peg$parseEscapedWhitespace() {
        var s0, s1;
        s0 = peg$currPos;
  
        if (input.substr(peg$currPos, 2) === peg$c49) {
          s1 = peg$c49;
          peg$currPos += 2;
        } else {
          s1 = peg$FAILED;
  
          if (peg$silentFails === 0) {
            peg$fail(peg$c50);
          }
        }
  
        if (s1 !== peg$FAILED) {
          peg$savedPos = s0;
          s1 = peg$c51();
        }
  
        s0 = s1;
  
        if (s0 === peg$FAILED) {
          s0 = peg$currPos;
  
          if (input.substr(peg$currPos, 2) === peg$c52) {
            s1 = peg$c52;
            peg$currPos += 2;
          } else {
            s1 = peg$FAILED;
  
            if (peg$silentFails === 0) {
              peg$fail(peg$c53);
            }
          }
  
          if (s1 !== peg$FAILED) {
            peg$savedPos = s0;
            s1 = peg$c54();
          }
  
          s0 = s1;
  
          if (s0 === peg$FAILED) {
            s0 = peg$currPos;
  
            if (input.substr(peg$currPos, 2) === peg$c55) {
              s1 = peg$c55;
              peg$currPos += 2;
            } else {
              s1 = peg$FAILED;
  
              if (peg$silentFails === 0) {
                peg$fail(peg$c56);
              }
            }
  
            if (s1 !== peg$FAILED) {
              peg$savedPos = s0;
              s1 = peg$c57();
            }
  
            s0 = s1;
          }
        }
  
        return s0;
      }
  
      function peg$parseEscapedSpecialCharacter() {
        var s0, s1, s2;
        s0 = peg$currPos;
  
        if (input.charCodeAt(peg$currPos) === 92) {
          s1 = peg$c37;
          peg$currPos++;
        } else {
          s1 = peg$FAILED;
  
          if (peg$silentFails === 0) {
            peg$fail(peg$c38);
          }
        }
  
        if (s1 !== peg$FAILED) {
          s2 = peg$parseSpecialCharacter();
  
          if (s2 !== peg$FAILED) {
            peg$savedPos = s0;
            s1 = peg$c41(s2);
            s0 = s1;
          } else {
            peg$currPos = s0;
            s0 = peg$FAILED;
          }
        } else {
          peg$currPos = s0;
          s0 = peg$FAILED;
        }
  
        return s0;
      }
  
      function peg$parseEscapedKeyword() {
        var s0, s1, s2;
        s0 = peg$currPos;
  
        if (input.charCodeAt(peg$currPos) === 92) {
          s1 = peg$c37;
          peg$currPos++;
        } else {
          s1 = peg$FAILED;
  
          if (peg$silentFails === 0) {
            peg$fail(peg$c38);
          }
        }
  
        if (s1 !== peg$FAILED) {
          if (input.substr(peg$currPos, 2).toLowerCase() === peg$c24) {
            s2 = input.substr(peg$currPos, 2);
            peg$currPos += 2;
          } else {
            s2 = peg$FAILED;
  
            if (peg$silentFails === 0) {
              peg$fail(peg$c25);
            }
          }
  
          if (s2 === peg$FAILED) {
            if (input.substr(peg$currPos, 3).toLowerCase() === peg$c27) {
              s2 = input.substr(peg$currPos, 3);
              peg$currPos += 3;
            } else {
              s2 = peg$FAILED;
  
              if (peg$silentFails === 0) {
                peg$fail(peg$c28);
              }
            }
  
            if (s2 === peg$FAILED) {
              if (input.substr(peg$currPos, 3).toLowerCase() === peg$c30) {
                s2 = input.substr(peg$currPos, 3);
                peg$currPos += 3;
              } else {
                s2 = peg$FAILED;
  
                if (peg$silentFails === 0) {
                  peg$fail(peg$c31);
                }
              }
            }
          }
  
          if (s2 !== peg$FAILED) {
            peg$savedPos = s0;
            s1 = peg$c58(s2);
            s0 = s1;
          } else {
            peg$currPos = s0;
            s0 = peg$FAILED;
          }
        } else {
          peg$currPos = s0;
          s0 = peg$FAILED;
        }
  
        return s0;
      }
  
      function peg$parseKeyword() {
        var s0;
        s0 = peg$parseOr();
  
        if (s0 === peg$FAILED) {
          s0 = peg$parseAnd();
  
          if (s0 === peg$FAILED) {
            s0 = peg$parseNot();
          }
        }
  
        return s0;
      }
  
      function peg$parseSpecialCharacter() {
        var s0;
  
        if (peg$c59.test(input.charAt(peg$currPos))) {
          s0 = input.charAt(peg$currPos);
          peg$currPos++;
        } else {
          s0 = peg$FAILED;
  
          if (peg$silentFails === 0) {
            peg$fail(peg$c60);
          }
        }
  
        return s0;
      }
  
      function peg$parseRangeOperator() {
        var s0, s1;
        s0 = peg$currPos;
  
        if (input.substr(peg$currPos, 2) === peg$c61) {
          s1 = peg$c61;
          peg$currPos += 2;
        } else {
          s1 = peg$FAILED;
  
          if (peg$silentFails === 0) {
            peg$fail(peg$c62);
          }
        }
  
        if (s1 !== peg$FAILED) {
          peg$savedPos = s0;
          s1 = peg$c63();
        }
  
        s0 = s1;
  
        if (s0 === peg$FAILED) {
          s0 = peg$currPos;
  
          if (input.substr(peg$currPos, 2) === peg$c64) {
            s1 = peg$c64;
            peg$currPos += 2;
          } else {
            s1 = peg$FAILED;
  
            if (peg$silentFails === 0) {
              peg$fail(peg$c65);
            }
          }
  
          if (s1 !== peg$FAILED) {
            peg$savedPos = s0;
            s1 = peg$c66();
          }
  
          s0 = s1;
  
          if (s0 === peg$FAILED) {
            s0 = peg$currPos;
  
            if (input.charCodeAt(peg$currPos) === 60) {
              s1 = peg$c67;
              peg$currPos++;
            } else {
              s1 = peg$FAILED;
  
              if (peg$silentFails === 0) {
                peg$fail(peg$c68);
              }
            }
  
            if (s1 !== peg$FAILED) {
              peg$savedPos = s0;
              s1 = peg$c69();
            }
  
            s0 = s1;
  
            if (s0 === peg$FAILED) {
              s0 = peg$currPos;
  
              if (input.charCodeAt(peg$currPos) === 62) {
                s1 = peg$c70;
                peg$currPos++;
              } else {
                s1 = peg$FAILED;
  
                if (peg$silentFails === 0) {
                  peg$fail(peg$c71);
                }
              }
  
              if (s1 !== peg$FAILED) {
                peg$savedPos = s0;
                s1 = peg$c72();
              }
  
              s0 = s1;
            }
          }
        }
  
        return s0;
      }
  
      function peg$parseSpace() {
        var s0, s1;
        peg$silentFails++;
  
        if (peg$c74.test(input.charAt(peg$currPos))) {
          s0 = input.charAt(peg$currPos);
          peg$currPos++;
        } else {
          s0 = peg$FAILED;
  
          if (peg$silentFails === 0) {
            peg$fail(peg$c75);
          }
        }
  
        peg$silentFails--;
  
        if (s0 === peg$FAILED) {
          s1 = peg$FAILED;
  
          if (peg$silentFails === 0) {
            peg$fail(peg$c73);
          }
        }
  
        return s0;
      }
  
      function peg$parseCursor() {
        var s0, s1, s2;
        s0 = peg$currPos;
        peg$savedPos = peg$currPos;
        s1 = peg$c76();
  
        if (s1) {
          s1 = void 0;
        } else {
          s1 = peg$FAILED;
        }
  
        if (s1 !== peg$FAILED) {
          if (input.substr(peg$currPos, 14) === peg$c77) {
            s2 = peg$c77;
            peg$currPos += 14;
          } else {
            s2 = peg$FAILED;
  
            if (peg$silentFails === 0) {
              peg$fail(peg$c78);
            }
          }
  
          if (s2 !== peg$FAILED) {
            peg$savedPos = s0;
            s1 = peg$c79();
            s0 = s1;
          } else {
            peg$currPos = s0;
            s0 = peg$FAILED;
          }
        } else {
          peg$currPos = s0;
          s0 = peg$FAILED;
        }
  
        return s0;
      }
  
      function peg$parseLuceneOr() {
        var s0, s1, s2, s3, s4;
        s0 = peg$currPos;
        s1 = [];
        s2 = peg$parseSpace();
  
        while (s2 !== peg$FAILED) {
          s1.push(s2);
          s2 = peg$parseSpace();
        }
  
        if (s1 !== peg$FAILED) {
          if (input.substr(peg$currPos, 2) === peg$c80) {
            s2 = peg$c80;
            peg$currPos += 2;
          } else {
            s2 = peg$FAILED;
  
            if (peg$silentFails === 0) {
              peg$fail(peg$c81);
            }
          }
  
          if (s2 !== peg$FAILED) {
            s3 = [];
            s4 = peg$parseSpace();
  
            while (s4 !== peg$FAILED) {
              s3.push(s4);
              s4 = peg$parseSpace();
            }
  
            if (s3 !== peg$FAILED) {
              peg$savedPos = s0;
              s1 = peg$c82();
              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$parseLuceneAnd() {
        var s0, s1, s2, s3, s4;
        s0 = peg$currPos;
        s1 = [];
        s2 = peg$parseSpace();
  
        while (s2 !== peg$FAILED) {
          s1.push(s2);
          s2 = peg$parseSpace();
        }
  
        if (s1 !== peg$FAILED) {
          if (input.substr(peg$currPos, 2) === peg$c83) {
            s2 = peg$c83;
            peg$currPos += 2;
          } else {
            s2 = peg$FAILED;
  
            if (peg$silentFails === 0) {
              peg$fail(peg$c84);
            }
          }
  
          if (s2 !== peg$FAILED) {
            s3 = [];
            s4 = peg$parseSpace();
  
            while (s4 !== peg$FAILED) {
              s3.push(s4);
              s4 = peg$parseSpace();
            }
  
            if (s3 !== peg$FAILED) {
              peg$savedPos = s0;
              s1 = peg$c85();
              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;
  
          if (input.charCodeAt(peg$currPos) === 43) {
            s1 = peg$c86;
            peg$currPos++;
          } else {
            s1 = peg$FAILED;
  
            if (peg$silentFails === 0) {
              peg$fail(peg$c87);
            }
          }
  
          if (s1 !== peg$FAILED) {
            peg$savedPos = s0;
            s1 = peg$c85();
          }
  
          s0 = s1;
        }
  
        return s0;
      }
  
      function peg$parseLuceneNot() {
        var s0, s1;
        s0 = peg$currPos;
  
        if (input.charCodeAt(peg$currPos) === 45) {
          s1 = peg$c88;
          peg$currPos++;
        } else {
          s1 = peg$FAILED;
  
          if (peg$silentFails === 0) {
            peg$fail(peg$c89);
          }
        }
  
        if (s1 !== peg$FAILED) {
          peg$savedPos = s0;
          s1 = peg$c90();
        }
  
        s0 = s1;
  
        if (s0 === peg$FAILED) {
          s0 = peg$currPos;
  
          if (input.charCodeAt(peg$currPos) === 33) {
            s1 = peg$c91;
            peg$currPos++;
          } else {
            s1 = peg$FAILED;
  
            if (peg$silentFails === 0) {
              peg$fail(peg$c92);
            }
          }
  
          if (s1 !== peg$FAILED) {
            peg$savedPos = s0;
            s1 = peg$c90();
          }
  
          s0 = s1;
        }
  
        return s0;
      }
  
      function peg$parseLuceneQuery() {
        var s0;
        s0 = peg$parseLuceneFieldQuery();
  
        if (s0 === peg$FAILED) {
          s0 = peg$parseLuceneValue();
  
          if (s0 === peg$FAILED) {
            s0 = peg$parseLuceneExists();
          }
        }
  
        return s0;
      }
  
      function peg$parseLuceneFieldQuery() {
        var s0, s1, s2, s3, s4, s5;
        s0 = peg$currPos;
        s1 = peg$parseLuceneLiteral();
  
        if (s1 !== peg$FAILED) {
          s2 = [];
          s3 = peg$parseSpace();
  
          while (s3 !== peg$FAILED) {
            s2.push(s3);
            s3 = peg$parseSpace();
          }
  
          if (s2 !== peg$FAILED) {
            if (input.charCodeAt(peg$currPos) === 58) {
              s3 = peg$c12;
              peg$currPos++;
            } else {
              s3 = peg$FAILED;
  
              if (peg$silentFails === 0) {
                peg$fail(peg$c13);
              }
            }
  
            if (s3 !== peg$FAILED) {
              s4 = [];
              s5 = peg$parseSpace();
  
              while (s5 !== peg$FAILED) {
                s4.push(s5);
                s5 = peg$parseSpace();
              }
  
              if (s4 !== peg$FAILED) {
                s5 = peg$parseLuceneValue();
  
                if (s5 !== peg$FAILED) {
                  s1 = [s1, s2, s3, s4, s5];
                  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;
          }
        } else {
          peg$currPos = s0;
          s0 = peg$FAILED;
        }
  
        return s0;
      }
  
      function peg$parseLuceneValue() {
        var s0;
        s0 = peg$parseLuceneRange();
  
        if (s0 === peg$FAILED) {
          s0 = peg$parseLuceneWildcard();
  
          if (s0 === peg$FAILED) {
            s0 = peg$parseLuceneRegex();
  
            if (s0 === peg$FAILED) {
              s0 = peg$parseLuceneFuzzy();
  
              if (s0 === peg$FAILED) {
                s0 = peg$parseLuceneProximity();
  
                if (s0 === peg$FAILED) {
                  s0 = peg$parseLuceneBoost();
                }
              }
            }
          }
        }
  
        return s0;
      }
  
      function peg$parseLuceneExists() {
        var s0, s1, s2, s3, s4, s5;
        s0 = peg$currPos;
  
        if (input.substr(peg$currPos, 8) === peg$c93) {
          s1 = peg$c93;
          peg$currPos += 8;
        } else {
          s1 = peg$FAILED;
  
          if (peg$silentFails === 0) {
            peg$fail(peg$c94);
          }
        }
  
        if (s1 !== peg$FAILED) {
          s2 = [];
          s3 = peg$parseSpace();
  
          while (s3 !== peg$FAILED) {
            s2.push(s3);
            s3 = peg$parseSpace();
          }
  
          if (s2 !== peg$FAILED) {
            if (input.charCodeAt(peg$currPos) === 58) {
              s3 = peg$c12;
              peg$currPos++;
            } else {
              s3 = peg$FAILED;
  
              if (peg$silentFails === 0) {
                peg$fail(peg$c13);
              }
            }
  
            if (s3 !== peg$FAILED) {
              s4 = [];
              s5 = peg$parseSpace();
  
              while (s5 !== peg$FAILED) {
                s4.push(s5);
                s5 = peg$parseSpace();
              }
  
              if (s4 !== peg$FAILED) {
                s5 = peg$parseLuceneLiteral();
  
                if (s5 !== peg$FAILED) {
                  peg$savedPos = s0;
                  s1 = peg$c95();
                  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;
          }
        } else {
          peg$currPos = s0;
          s0 = peg$FAILED;
        }
  
        return s0;
      }
  
      function peg$parseLuceneRange() {
        var s0, s1, s2, s3, s4, s5, s6;
        s0 = peg$currPos;
        s1 = peg$parseRangeOperator();
  
        if (s1 !== peg$FAILED) {
          s2 = [];
          s3 = peg$parseSpace();
  
          while (s3 !== peg$FAILED) {
            s2.push(s3);
            s3 = peg$parseSpace();
          }
  
          if (s2 !== peg$FAILED) {
            s3 = peg$parseLuceneLiteral();
  
            if (s3 !== peg$FAILED) {
              peg$savedPos = s0;
              s1 = peg$c96();
              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$parseLuceneRangeStart();
  
          if (s1 !== peg$FAILED) {
            s2 = [];
            s3 = peg$parseSpace();
  
            while (s3 !== peg$FAILED) {
              s2.push(s3);
              s3 = peg$parseSpace();
            }
  
            if (s2 !== peg$FAILED) {
              s3 = peg$parseLuceneLiteral();
  
              if (s3 !== peg$FAILED) {
                s4 = peg$parseLuceneTo();
  
                if (s4 !== peg$FAILED) {
                  s5 = peg$parseLuceneLiteral();
  
                  if (s5 !== peg$FAILED) {
                    s6 = peg$parseLuceneRangeEnd();
  
                    if (s6 !== peg$FAILED) {
                      peg$savedPos = s0;
                      s1 = peg$c96();
                      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;
              }
            } else {
              peg$currPos = s0;
              s0 = peg$FAILED;
            }
          } else {
            peg$currPos = s0;
            s0 = peg$FAILED;
          }
        }
  
        return s0;
      }
  
      function peg$parseLuceneWildcard() {
        var s0, s1, s2, s3, s4;
        s0 = peg$currPos;
        s1 = [];
        s2 = peg$parseLuceneUnquotedCharacter();
  
        if (s2 === peg$FAILED) {
          if (input.charCodeAt(peg$currPos) === 42) {
            s2 = peg$c46;
            peg$currPos++;
          } else {
            s2 = peg$FAILED;
  
            if (peg$silentFails === 0) {
              peg$fail(peg$c47);
            }
          }
        }
  
        while (s2 !== peg$FAILED) {
          s1.push(s2);
          s2 = peg$parseLuceneUnquotedCharacter();
  
          if (s2 === peg$FAILED) {
            if (input.charCodeAt(peg$currPos) === 42) {
              s2 = peg$c46;
              peg$currPos++;
            } else {
              s2 = peg$FAILED;
  
              if (peg$silentFails === 0) {
                peg$fail(peg$c47);
              }
            }
          }
        }
  
        if (s1 !== peg$FAILED) {
          if (input.charCodeAt(peg$currPos) === 63) {
            s2 = peg$c97;
            peg$currPos++;
          } else {
            s2 = peg$FAILED;
  
            if (peg$silentFails === 0) {
              peg$fail(peg$c98);
            }
          }
  
          if (s2 !== peg$FAILED) {
            s3 = [];
            s4 = peg$parseLuceneWildcard();
  
            while (s4 !== peg$FAILED) {
              s3.push(s4);
              s4 = peg$parseLuceneWildcard();
            }
  
            if (s3 !== peg$FAILED) {
              peg$savedPos = s0;
              s1 = peg$c99();
              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$parseLuceneRegex() {
        var s0, s1, s2, s3;
        s0 = peg$currPos;
  
        if (input.charCodeAt(peg$currPos) === 47) {
          s1 = peg$c100;
          peg$currPos++;
        } else {
          s1 = peg$FAILED;
  
          if (peg$silentFails === 0) {
            peg$fail(peg$c101);
          }
        }
  
        if (s1 !== peg$FAILED) {
          s2 = [];
  
          if (peg$c102.test(input.charAt(peg$currPos))) {
            s3 = input.charAt(peg$currPos);
            peg$currPos++;
          } else {
            s3 = peg$FAILED;
  
            if (peg$silentFails === 0) {
              peg$fail(peg$c103);
            }
          }
  
          while (s3 !== peg$FAILED) {
            s2.push(s3);
  
            if (peg$c102.test(input.charAt(peg$currPos))) {
              s3 = input.charAt(peg$currPos);
              peg$currPos++;
            } else {
              s3 = peg$FAILED;
  
              if (peg$silentFails === 0) {
                peg$fail(peg$c103);
              }
            }
          }
  
          if (s2 !== peg$FAILED) {
            if (input.charCodeAt(peg$currPos) === 47) {
              s3 = peg$c100;
              peg$currPos++;
            } else {
              s3 = peg$FAILED;
  
              if (peg$silentFails === 0) {
                peg$fail(peg$c101);
              }
            }
  
            if (s3 !== peg$FAILED) {
              peg$savedPos = s0;
              s1 = peg$c104();
              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$parseLuceneFuzzy() {
        var s0, s1, s2, s3, s4;
        s0 = peg$currPos;
        s1 = peg$parseLuceneUnquotedLiteral();
  
        if (s1 !== peg$FAILED) {
          if (input.charCodeAt(peg$currPos) === 126) {
            s2 = peg$c105;
            peg$currPos++;
          } else {
            s2 = peg$FAILED;
  
            if (peg$silentFails === 0) {
              peg$fail(peg$c106);
            }
          }
  
          if (s2 !== peg$FAILED) {
            s3 = [];
  
            if (peg$c107.test(input.charAt(peg$currPos))) {
              s4 = input.charAt(peg$currPos);
              peg$currPos++;
            } else {
              s4 = peg$FAILED;
  
              if (peg$silentFails === 0) {
                peg$fail(peg$c108);
              }
            }
  
            while (s4 !== peg$FAILED) {
              s3.push(s4);
  
              if (peg$c107.test(input.charAt(peg$currPos))) {
                s4 = input.charAt(peg$currPos);
                peg$currPos++;
              } else {
                s4 = peg$FAILED;
  
                if (peg$silentFails === 0) {
                  peg$fail(peg$c108);
                }
              }
            }
  
            if (s3 !== peg$FAILED) {
              peg$savedPos = s0;
              s1 = peg$c109();
              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$parseLuceneProximity() {
        var s0, s1, s2, s3, s4;
        s0 = peg$currPos;
        s1 = peg$parseQuotedString();
  
        if (s1 !== peg$FAILED) {
          if (input.charCodeAt(peg$currPos) === 126) {
            s2 = peg$c105;
            peg$currPos++;
          } else {
            s2 = peg$FAILED;
  
            if (peg$silentFails === 0) {
              peg$fail(peg$c106);
            }
          }
  
          if (s2 !== peg$FAILED) {
            s3 = [];
  
            if (peg$c107.test(input.charAt(peg$currPos))) {
              s4 = input.charAt(peg$currPos);
              peg$currPos++;
            } else {
              s4 = peg$FAILED;
  
              if (peg$silentFails === 0) {
                peg$fail(peg$c108);
              }
            }
  
            while (s4 !== peg$FAILED) {
              s3.push(s4);
  
              if (peg$c107.test(input.charAt(peg$currPos))) {
                s4 = input.charAt(peg$currPos);
                peg$currPos++;
              } else {
                s4 = peg$FAILED;
  
                if (peg$silentFails === 0) {
                  peg$fail(peg$c108);
                }
              }
            }
  
            if (s3 !== peg$FAILED) {
              peg$savedPos = s0;
              s1 = peg$c110();
              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$parseLuceneBoost() {
        var s0, s1, s2, s3, s4;
        s0 = peg$currPos;
        s1 = peg$parseLuceneLiteral();
  
        if (s1 !== peg$FAILED) {
          if (input.charCodeAt(peg$currPos) === 94) {
            s2 = peg$c111;
            peg$currPos++;
          } else {
            s2 = peg$FAILED;
  
            if (peg$silentFails === 0) {
              peg$fail(peg$c112);
            }
          }
  
          if (s2 !== peg$FAILED) {
            s3 = [];
  
            if (peg$c107.test(input.charAt(peg$currPos))) {
              s4 = input.charAt(peg$currPos);
              peg$currPos++;
            } else {
              s4 = peg$FAILED;
  
              if (peg$silentFails === 0) {
                peg$fail(peg$c108);
              }
            }
  
            while (s4 !== peg$FAILED) {
              s3.push(s4);
  
              if (peg$c107.test(input.charAt(peg$currPos))) {
                s4 = input.charAt(peg$currPos);
                peg$currPos++;
              } else {
                s4 = peg$FAILED;
  
                if (peg$silentFails === 0) {
                  peg$fail(peg$c108);
                }
              }
            }
  
            if (s3 !== peg$FAILED) {
              peg$savedPos = s0;
              s1 = peg$c113();
              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$parseLuceneLiteral() {
        var s0;
        s0 = peg$parseQuotedString();
  
        if (s0 === peg$FAILED) {
          s0 = peg$parseLuceneUnquotedLiteral();
        }
  
        return s0;
      }
  
      function peg$parseLuceneUnquotedLiteral() {
        var s0, s1;
        s0 = [];
        s1 = peg$parseLuceneUnquotedCharacter();
  
        if (s1 !== peg$FAILED) {
          while (s1 !== peg$FAILED) {
            s0.push(s1);
            s1 = peg$parseLuceneUnquotedCharacter();
          }
        } else {
          s0 = peg$FAILED;
        }
  
        return s0;
      }
  
      function peg$parseLuceneUnquotedCharacter() {
        var s0, s1, s2, s3;
        s0 = peg$parseEscapedWhitespace();
  
        if (s0 === peg$FAILED) {
          s0 = peg$parseEscapedLuceneSpecialCharacter();
  
          if (s0 === peg$FAILED) {
            s0 = peg$currPos;
            s1 = peg$currPos;
            peg$silentFails++;
            s2 = peg$parseLuceneSpecialCharacter();
            peg$silentFails--;
  
            if (s2 === peg$FAILED) {
              s1 = void 0;
            } else {
              peg$currPos = s1;
              s1 = peg$FAILED;
            }
  
            if (s1 !== peg$FAILED) {
              s2 = peg$currPos;
              peg$silentFails++;
              s3 = peg$parseLuceneKeyword();
              peg$silentFails--;
  
              if (s3 === peg$FAILED) {
                s2 = void 0;
              } else {
                peg$currPos = s2;
                s2 = peg$FAILED;
              }
  
              if (s2 !== peg$FAILED) {
                if (input.length > peg$currPos) {
                  s3 = input.charAt(peg$currPos);
                  peg$currPos++;
                } else {
                  s3 = peg$FAILED;
  
                  if (peg$silentFails === 0) {
                    peg$fail(peg$c45);
                  }
                }
  
                if (s3 !== peg$FAILED) {
                  s1 = [s1, 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;
            }
          }
        }
  
        return s0;
      }
  
      function peg$parseLuceneKeyword() {
        var s0;
        s0 = peg$parseOr();
  
        if (s0 === peg$FAILED) {
          s0 = peg$parseAnd();
  
          if (s0 === peg$FAILED) {
            s0 = peg$parseLuceneOr();
  
            if (s0 === peg$FAILED) {
              s0 = peg$parseLuceneAnd();
  
              if (s0 === peg$FAILED) {
                s0 = peg$parseLuceneNot();
  
                if (s0 === peg$FAILED) {
                  s0 = peg$parseLuceneTo();
                }
              }
            }
          }
        }
  
        return s0;
      }
  
      function peg$parseEscapedLuceneSpecialCharacter() {
        var s0, s1, s2;
        s0 = peg$currPos;
  
        if (input.charCodeAt(peg$currPos) === 92) {
          s1 = peg$c37;
          peg$currPos++;
        } else {
          s1 = peg$FAILED;
  
          if (peg$silentFails === 0) {
            peg$fail(peg$c38);
          }
        }
  
        if (s1 !== peg$FAILED) {
          s2 = peg$parseLuceneSpecialCharacter();
  
          if (s2 !== peg$FAILED) {
            peg$savedPos = s0;
            s1 = peg$c114();
            s0 = s1;
          } else {
            peg$currPos = s0;
            s0 = peg$FAILED;
          }
        } else {
          peg$currPos = s0;
          s0 = peg$FAILED;
        }
  
        return s0;
      }
  
      function peg$parseLuceneSpecialCharacter() {
        var s0;
  
        if (input.charCodeAt(peg$currPos) === 43) {
          s0 = peg$c86;
          peg$currPos++;
        } else {
          s0 = peg$FAILED;
  
          if (peg$silentFails === 0) {
            peg$fail(peg$c87);
          }
        }
  
        if (s0 === peg$FAILED) {
          if (input.charCodeAt(peg$currPos) === 45) {
            s0 = peg$c88;
            peg$currPos++;
          } else {
            s0 = peg$FAILED;
  
            if (peg$silentFails === 0) {
              peg$fail(peg$c89);
            }
          }
  
          if (s0 === peg$FAILED) {
            if (input.charCodeAt(peg$currPos) === 61) {
              s0 = peg$c115;
              peg$currPos++;
            } else {
              s0 = peg$FAILED;
  
              if (peg$silentFails === 0) {
                peg$fail(peg$c116);
              }
            }
  
            if (s0 === peg$FAILED) {
              if (input.charCodeAt(peg$currPos) === 62) {
                s0 = peg$c70;
                peg$currPos++;
              } else {
                s0 = peg$FAILED;
  
                if (peg$silentFails === 0) {
                  peg$fail(peg$c71);
                }
              }
  
              if (s0 === peg$FAILED) {
                if (input.charCodeAt(peg$currPos) === 60) {
                  s0 = peg$c67;
                  peg$currPos++;
                } else {
                  s0 = peg$FAILED;
  
                  if (peg$silentFails === 0) {
                    peg$fail(peg$c68);
                  }
                }
  
                if (s0 === peg$FAILED) {
                  if (input.charCodeAt(peg$currPos) === 33) {
                    s0 = peg$c91;
                    peg$currPos++;
                  } else {
                    s0 = peg$FAILED;
  
                    if (peg$silentFails === 0) {
                      peg$fail(peg$c92);
                    }
                  }
  
                  if (s0 === peg$FAILED) {
                    if (input.charCodeAt(peg$currPos) === 40) {
                      s0 = peg$c5;
                      peg$currPos++;
                    } else {
                      s0 = peg$FAILED;
  
                      if (peg$silentFails === 0) {
                        peg$fail(peg$c6);
                      }
                    }
  
                    if (s0 === peg$FAILED) {
                      if (input.charCodeAt(peg$currPos) === 41) {
                        s0 = peg$c7;
                        peg$currPos++;
                      } else {
                        s0 = peg$FAILED;
  
                        if (peg$silentFails === 0) {
                          peg$fail(peg$c8);
                        }
                      }
  
                      if (s0 === peg$FAILED) {
                        if (input.charCodeAt(peg$currPos) === 123) {
                          s0 = peg$c117;
                          peg$currPos++;
                        } else {
                          s0 = peg$FAILED;
  
                          if (peg$silentFails === 0) {
                            peg$fail(peg$c118);
                          }
                        }
  
                        if (s0 === peg$FAILED) {
                          if (input.charCodeAt(peg$currPos) === 125) {
                            s0 = peg$c119;
                            peg$currPos++;
                          } else {
                            s0 = peg$FAILED;
  
                            if (peg$silentFails === 0) {
                              peg$fail(peg$c120);
                            }
                          }
  
                          if (s0 === peg$FAILED) {
                            if (input.charCodeAt(peg$currPos) === 91) {
                              s0 = peg$c121;
                              peg$currPos++;
                            } else {
                              s0 = peg$FAILED;
  
                              if (peg$silentFails === 0) {
                                peg$fail(peg$c122);
                              }
                            }
  
                            if (s0 === peg$FAILED) {
                              if (input.charCodeAt(peg$currPos) === 93) {
                                s0 = peg$c123;
                                peg$currPos++;
                              } else {
                                s0 = peg$FAILED;
  
                                if (peg$silentFails === 0) {
                                  peg$fail(peg$c124);
                                }
                              }
  
                              if (s0 === peg$FAILED) {
                                if (input.charCodeAt(peg$currPos) === 94) {
                                  s0 = peg$c111;
                                  peg$currPos++;
                                } else {
                                  s0 = peg$FAILED;
  
                                  if (peg$silentFails === 0) {
                                    peg$fail(peg$c112);
                                  }
                                }
  
                                if (s0 === peg$FAILED) {
                                  if (input.charCodeAt(peg$currPos) === 34) {
                                    s0 = peg$c33;
                                    peg$currPos++;
                                  } else {
                                    s0 = peg$FAILED;
  
                                    if (peg$silentFails === 0) {
                                      peg$fail(peg$c34);
                                    }
                                  }
  
                                  if (s0 === peg$FAILED) {
                                    if (input.charCodeAt(peg$currPos) === 126) {
                                      s0 = peg$c105;
                                      peg$currPos++;
                                    } else {
                                      s0 = peg$FAILED;
  
                                      if (peg$silentFails === 0) {
                                        peg$fail(peg$c106);
                                      }
                                    }
  
                                    if (s0 === peg$FAILED) {
                                      if (input.charCodeAt(peg$currPos) === 42) {
                                        s0 = peg$c46;
                                        peg$currPos++;
                                      } else {
                                        s0 = peg$FAILED;
  
                                        if (peg$silentFails === 0) {
                                          peg$fail(peg$c47);
                                        }
                                      }
  
                                      if (s0 === peg$FAILED) {
                                        if (input.charCodeAt(peg$currPos) === 63) {
                                          s0 = peg$c97;
                                          peg$currPos++;
                                        } else {
                                          s0 = peg$FAILED;
  
                                          if (peg$silentFails === 0) {
                                            peg$fail(peg$c98);
                                          }
                                        }
  
                                        if (s0 === peg$FAILED) {
                                          if (input.charCodeAt(peg$currPos) === 58) {
                                            s0 = peg$c12;
                                            peg$currPos++;
                                          } else {
                                            s0 = peg$FAILED;
  
                                            if (peg$silentFails === 0) {
                                              peg$fail(peg$c13);
                                            }
                                          }
  
                                          if (s0 === peg$FAILED) {
                                            if (input.charCodeAt(peg$currPos) === 92) {
                                              s0 = peg$c37;
                                              peg$currPos++;
                                            } else {
                                              s0 = peg$FAILED;
  
                                              if (peg$silentFails === 0) {
                                                peg$fail(peg$c38);
                                              }
                                            }
  
                                            if (s0 === peg$FAILED) {
                                              if (input.charCodeAt(peg$currPos) === 47) {
                                                s0 = peg$c100;
                                                peg$currPos++;
                                              } else {
                                                s0 = peg$FAILED;
  
                                                if (peg$silentFails === 0) {
                                                  peg$fail(peg$c101);
                                                }
                                              }
                                            }
                                          }
                                        }
                                      }
                                    }
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
  
        return s0;
      }
  
      function peg$parseLuceneTo() {
        var s0, s1, s2, s3, s4;
        s0 = peg$currPos;
        s1 = [];
        s2 = peg$parseSpace();
  
        if (s2 !== peg$FAILED) {
          while (s2 !== peg$FAILED) {
            s1.push(s2);
            s2 = peg$parseSpace();
          }
        } else {
          s1 = peg$FAILED;
        }
  
        if (s1 !== peg$FAILED) {
          if (input.substr(peg$currPos, 2) === peg$c125) {
            s2 = peg$c125;
            peg$currPos += 2;
          } else {
            s2 = peg$FAILED;
  
            if (peg$silentFails === 0) {
              peg$fail(peg$c126);
            }
          }
  
          if (s2 !== peg$FAILED) {
            s3 = [];
            s4 = peg$parseSpace();
  
            if (s4 !== peg$FAILED) {
              while (s4 !== peg$FAILED) {
                s3.push(s4);
                s4 = peg$parseSpace();
              }
            } else {
              s3 = peg$FAILED;
            }
  
            if (s3 !== peg$FAILED) {
              s1 = [s1, 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;
        }
  
        return s0;
      }
  
      function peg$parseLuceneRangeStart() {
        var s0;
  
        if (input.charCodeAt(peg$currPos) === 91) {
          s0 = peg$c121;
          peg$currPos++;
        } else {
          s0 = peg$FAILED;
  
          if (peg$silentFails === 0) {
            peg$fail(peg$c122);
          }
        }
  
        if (s0 === peg$FAILED) {
          if (input.charCodeAt(peg$currPos) === 123) {
            s0 = peg$c117;
            peg$currPos++;
          } else {
            s0 = peg$FAILED;
  
            if (peg$silentFails === 0) {
              peg$fail(peg$c118);
            }
          }
        }
  
        return s0;
      }
  
      function peg$parseLuceneRangeEnd() {
        var s0;
  
        if (input.charCodeAt(peg$currPos) === 93) {
          s0 = peg$c123;
          peg$currPos++;
        } else {
          s0 = peg$FAILED;
  
          if (peg$silentFails === 0) {
            peg$fail(peg$c124);
          }
        }
  
        if (s0 === peg$FAILED) {
          if (input.charCodeAt(peg$currPos) === 125) {
            s0 = peg$c119;
            peg$currPos++;
          } else {
            s0 = peg$FAILED;
  
            if (peg$silentFails === 0) {
              peg$fail(peg$c120);
            }
          }
        }
  
        return s0;
      }
  
      var errorOnLuceneSyntax = options.errorOnLuceneSyntax,
          parseCursor = options.parseCursor,
          cursorSymbol = options.cursorSymbol,
          _options$allowLeading = options.allowLeadingWildcards,
          allowLeadingWildcards = _options$allowLeading === void 0 ? true : _options$allowLeading,
          nodeTypes = options.helpers.nodeTypes;
      var buildFunctionNode = nodeTypes.function.buildNodeWithArgumentNodes;
      var buildLiteralNode = nodeTypes.literal.buildNode;
      var buildWildcardNode = nodeTypes.wildcard.buildNode;
      var buildNamedArgNode = nodeTypes.namedArg.buildNode;
      var wildcardSymbol = nodeTypes.wildcard.wildcardSymbol;
      peg$result = peg$startRuleFunction();
  
      if (peg$result !== peg$FAILED && peg$currPos === input.length) {
        return peg$result;
      } else {
        if (peg$result !== peg$FAILED && peg$currPos < input.length) {
          peg$fail({
            type: "end",
            description: "end of input"
          });
        }
  
        throw peg$buildException(null, peg$maxFailExpected, peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null, peg$maxFailPos < input.length ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1) : peg$computeLocation(peg$maxFailPos, peg$maxFailPos));
      }
    }
  
    return {
      SyntaxError: peg$SyntaxError,
      parse: peg$parse
    };
  }();