function words(e) {
  for (var r = {}, i = e.split(" "), a = 0; a < i.length; ++a) r[i[a]] = true;
  return r;
}
var keywords = words("absolute and array asm begin case const constructor destructor div do downto else end file for function goto if implementation in inherited inline interface label mod nil not object of operator or packed procedure program record reintroduce repeat self set shl shr string then to type unit until uses var while with xor as class dispinterface except exports finalization finally initialization inline is library on out packed property raise resourcestring threadvar try absolute abstract alias assembler bitpacked break cdecl continue cppdecl cvar default deprecated dynamic enumerator experimental export external far far16 forward generic helper implements index interrupt iocheck local message name near nodefault noreturn nostackframe oldfpccall otherwise overload override pascal platform private protected public published read register reintroduce result safecall saveregisters softfloat specialize static stdcall stored strict unaligned unimplemented varargs virtual write"), atoms = { null: true }, isOperatorChar = /[+\-*&%=<>!?|\/]/;
function tokenBase(e, o) {
  var c = e.next();
  if (c == "#" && o.startOfLine) return e.skipToEnd(), "meta";
  if (c == '"' || c == "'") return o.tokenize = tokenString(c), o.tokenize(e, o);
  if (c == "(" && e.eat("*")) return o.tokenize = tokenComment, tokenComment(e, o);
  if (c == "{") return o.tokenize = tokenCommentBraces, tokenCommentBraces(e, o);
  if (/[\[\]\(\),;\:\.]/.test(c)) return null;
  if (/\d/.test(c)) return e.eatWhile(/[\w\.]/), "number";
  if (c == "/" && e.eat("/")) return e.skipToEnd(), "comment";
  if (isOperatorChar.test(c)) return e.eatWhile(isOperatorChar), "operator";
  e.eatWhile(/[\w\$_]/);
  var l = e.current().toLowerCase();
  return keywords.propertyIsEnumerable(l) ? "keyword" : atoms.propertyIsEnumerable(l) ? "atom" : "variable";
}
function tokenString(e) {
  return function(r, i) {
    for (var a = false, o, s = false; (o = r.next()) != null; ) {
      if (o == e && !a) {
        s = true;
        break;
      }
      a = !a && o == "\\";
    }
    return (s || !a) && (i.tokenize = null), "string";
  };
}
function tokenComment(e, r) {
  for (var i = false, a; a = e.next(); ) {
    if (a == ")" && i) {
      r.tokenize = null;
      break;
    }
    i = a == "*";
  }
  return "comment";
}
function tokenCommentBraces(e, r) {
  for (var i; i = e.next(); ) if (i == "}") {
    r.tokenize = null;
    break;
  }
  return "comment";
}
const pascal = {
  name: "pascal",
  startState: function() {
    return { tokenize: null };
  },
  token: function(e, r) {
    return e.eatSpace() ? null : (r.tokenize || tokenBase)(e, r);
  },
  languageData: {
    indentOnInput: /^\s*[{}]$/,
    commentTokens: { block: {
      open: "(*",
      close: "*)"
    } }
  }
};
export {
  pascal as t
};
