var isStringChar = /[^\s\|\!\+\-\*\?\~\^\&\:\(\)\[\]\{\}\"\\]/, isOperatorChar = /[\|\!\+\-\*\?\~\^\&]/, isOperatorString = /^(OR|AND|NOT|TO)$/;
function isNumber(e) {
  return parseFloat(e).toString() === e;
}
function tokenString(e) {
  return function(n, r) {
    for (var i = false, a; (a = n.next()) != null && !(a == e && !i); ) i = !i && a == "\\";
    return i || (r.tokenize = tokenBase), "string";
  };
}
function tokenOperator(e) {
  return function(n, r) {
    return e == "|" ? n.eat(/\|/) : e == "&" && n.eat(/\&/), r.tokenize = tokenBase, "operator";
  };
}
function tokenWord(n) {
  return function(a, o) {
    for (var s = n; (n = a.peek()) && n.match(isStringChar) != null; ) s += a.next();
    return o.tokenize = tokenBase, isOperatorString.test(s) ? "operator" : isNumber(s) ? "number" : a.peek() == ":" ? "propertyName" : "string";
  };
}
function tokenBase(r, i) {
  var c = r.next();
  return c == '"' ? i.tokenize = tokenString(c) : isOperatorChar.test(c) ? i.tokenize = tokenOperator(c) : isStringChar.test(c) && (i.tokenize = tokenWord(c)), i.tokenize == tokenBase ? null : i.tokenize(r, i);
}
const solr = {
  name: "solr",
  startState: function() {
    return { tokenize: tokenBase };
  },
  token: function(e, n) {
    return e.eatSpace() ? null : n.tokenize(e, n);
  }
};
export {
  solr
};
