function wordRegexp(e) {
  return RegExp("^((" + e.join(")|(") + "))\\b", "i");
}
var singleOperators = /* @__PURE__ */ RegExp("^[\\+\\-\\*/&#!_?\\\\<>=\\'\\[\\]]"), doubleOperators = /* @__PURE__ */ RegExp("^(('=)|(<=)|(>=)|('>)|('<)|([[)|(]])|(^$))"), singleDelimiters = /* @__PURE__ */ RegExp("^[\\.,:]"), brackets = /* @__PURE__ */ RegExp("[()]"), identifiers = /* @__PURE__ */ RegExp("^[%A-Za-z][A-Za-z0-9]*"), commandKeywords = /* @__PURE__ */ "break.close.do.else.for.goto.halt.hang.if.job.kill.lock.merge.new.open.quit.read.set.tcommit.trollback.tstart.use.view.write.xecute.b.c.d.e.f.g.h.i.j.k.l.m.n.o.q.r.s.tc.tro.ts.u.v.w.x".split("."), intrinsicFuncs = wordRegexp(/* @__PURE__ */ "\\$ascii.\\$char.\\$data.\\$ecode.\\$estack.\\$etrap.\\$extract.\\$find.\\$fnumber.\\$get.\\$horolog.\\$io.\\$increment.\\$job.\\$justify.\\$length.\\$name.\\$next.\\$order.\\$piece.\\$qlength.\\$qsubscript.\\$query.\\$quit.\\$random.\\$reverse.\\$select.\\$stack.\\$test.\\$text.\\$translate.\\$view.\\$x.\\$y.\\$a.\\$c.\\$d.\\$e.\\$ec.\\$es.\\$et.\\$f.\\$fn.\\$g.\\$h.\\$i.\\$j.\\$l.\\$n.\\$na.\\$o.\\$p.\\$q.\\$ql.\\$qs.\\$r.\\$re.\\$s.\\$st.\\$t.\\$tr.\\$v.\\$z".split(".")), command = wordRegexp(commandKeywords);
function tokenBase(e, l) {
  e.sol() && (l.label = true, l.commandMode = 0);
  var u = e.peek();
  return u == " " || u == "	" ? (l.label = false, l.commandMode == 0 ? l.commandMode = 1 : (l.commandMode < 0 || l.commandMode == 2) && (l.commandMode = 0)) : u != "." && l.commandMode > 0 && (u == ":" ? l.commandMode = -1 : l.commandMode = 2), (u === "(" || u === "	") && (l.label = false), u === ";" ? (e.skipToEnd(), "comment") : e.match(/^[-+]?\d+(\.\d+)?([eE][-+]?\d+)?/) ? "number" : u == '"' ? e.skipTo('"') ? (e.next(), "string") : (e.skipToEnd(), "error") : e.match(doubleOperators) || e.match(singleOperators) ? "operator" : e.match(singleDelimiters) ? null : brackets.test(u) ? (e.next(), "bracket") : l.commandMode > 0 && e.match(command) ? "controlKeyword" : e.match(intrinsicFuncs) ? "builtin" : e.match(identifiers) ? "variable" : u === "$" || u === "^" ? (e.next(), "builtin") : u === "@" ? (e.next(), "string.special") : /[\w%]/.test(u) ? (e.eatWhile(/[\w%]/), "variable") : (e.next(), "error");
}
const mumps = {
  name: "mumps",
  startState: function() {
    return {
      label: false,
      commandMode: 0
    };
  },
  token: function(e, s) {
    var c = tokenBase(e, s);
    return s.label ? "tag" : c;
  }
};
export {
  mumps as t
};
