var words = {}, variable_regex = /({)?([a-z][a-z0-9_]*)?((::[a-z][a-z0-9_]*)*::)?[a-zA-Z0-9_]+(})?/;
function define(t, n) {
  for (var r = n.split(" "), i = 0; i < r.length; i++) words[r[i]] = t;
}
define("keyword", "class define site node include import inherits"), define("keyword", "case if else in and elsif default or"), define("atom", "false true running present absent file directory undef"), define("builtin", "action augeas burst chain computer cron destination dport exec file filebucket group host icmp iniface interface jump k5login limit log_level log_prefix macauthorization mailalias maillist mcx mount nagios_command nagios_contact nagios_contactgroup nagios_host nagios_hostdependency nagios_hostescalation nagios_hostextinfo nagios_hostgroup nagios_service nagios_servicedependency nagios_serviceescalation nagios_serviceextinfo nagios_servicegroup nagios_timeperiod name notify outiface package proto reject resources router schedule scheduled_task selboolean selmodule service source sport ssh_authorized_key sshkey stage state table tidy todest toports tosource user vlan yumrepo zfs zone zpool");
function tokenString(e, t) {
  for (var n, r, i = false; !e.eol() && (n = e.next()) != t.pending; ) {
    if (n === "$" && r != "\\" && t.pending == '"') {
      i = true;
      break;
    }
    r = n;
  }
  return i && e.backUp(1), n == t.pending ? t.continueString = false : t.continueString = true, "string";
}
function tokenize(n, i) {
  var a = n.match(/[\w]+/, false), o = n.match(/(\s+)?\w+\s+=>.*/, false), s = n.match(/(\s+)?[\w:_]+(\s+)?{/, false), c = n.match(/(\s+)?[@]{1,2}[\w:_]+(\s+)?{/, false), l = n.next();
  if (l === "$") return n.match(variable_regex) ? i.continueString ? "variableName.special" : "variable" : "error";
  if (i.continueString) return n.backUp(1), tokenString(n, i);
  if (i.inDefinition) {
    if (n.match(/(\s+)?[\w:_]+(\s+)?/)) return "def";
    n.match(/\s+{/), i.inDefinition = false;
  }
  return i.inInclude ? (n.match(/(\s+)?\S+(\s+)?/), i.inInclude = false, "def") : n.match(/(\s+)?\w+\(/) ? (n.backUp(1), "def") : o ? (n.match(/(\s+)?\w+/), "tag") : a && words.hasOwnProperty(a) ? (n.backUp(1), n.match(/[\w]+/), n.match(/\s+\S+\s+{/, false) && (i.inDefinition = true), a == "include" && (i.inInclude = true), words[a]) : /(^|\s+)[A-Z][\w:_]+/.test(a) ? (n.backUp(1), n.match(/(^|\s+)[A-Z][\w:_]+/), "def") : s ? (n.match(/(\s+)?[\w:_]+/), "def") : c ? (n.match(/(\s+)?[@]{1,2}/), "atom") : l == "#" ? (n.skipToEnd(), "comment") : l == "'" || l == '"' ? (i.pending = l, tokenString(n, i)) : l == "{" || l == "}" ? "bracket" : l == "/" ? (n.match(/^[^\/]*\//), "string.special") : l.match(/[0-9]/) ? (n.eatWhile(/[0-9]+/), "number") : l == "=" ? (n.peek() == ">" && n.next(), "operator") : (n.eatWhile(/[\w-]/), null);
}
const puppet = {
  name: "puppet",
  startState: function() {
    var e = {};
    return e.inDefinition = false, e.inInclude = false, e.continueString = false, e.pending = false, e;
  },
  token: function(e, t) {
    return e.eatSpace() ? null : tokenize(e, t);
  }
};
export {
  puppet as t
};
