const toml = {
  name: "toml",
  startState: function() {
    return {
      inString: false,
      stringType: "",
      lhs: true,
      inArray: 0
    };
  },
  token: function(e, t) {
    let n;
    if (!t.inString && (n = e.match(/^('''|"""|'|")/)) && (t.stringType = n[0], t.inString = true), e.sol() && !t.inString && t.inArray === 0 && (t.lhs = true), t.inString) {
      for (; t.inString; ) if (e.match(t.stringType)) t.inString = false;
      else if (e.peek() === "\\") e.next(), e.next();
      else if (e.eol()) break;
      else e.match(/^.[^\\\"\']*/);
      return t.lhs ? "property" : "string";
    } else if (t.inArray && e.peek() === "]") return e.next(), t.inArray--, "bracket";
    else if (t.lhs && e.peek() === "[" && e.skipTo("]")) return e.next(), e.peek() === "]" && e.next(), "atom";
    else if (e.peek() === "#") return e.skipToEnd(), "comment";
    else if (e.eatSpace()) return null;
    else if (t.lhs && e.eatWhile(function(e2) {
      return e2 != "=" && e2 != " ";
    })) return "property";
    else if (t.lhs && e.peek() === "=") return e.next(), t.lhs = false, null;
    else if (!t.lhs && e.match(/^\d\d\d\d[\d\-\:\.T]*Z/)) return "atom";
    else if (!t.lhs && (e.match("true") || e.match("false"))) return "atom";
    else if (!t.lhs && e.peek() === "[") return t.inArray++, e.next(), "bracket";
    else if (!t.lhs && e.match(/^\-?\d+(?:\.\d+)?/)) return "number";
    else e.eatSpace() || e.next();
    return null;
  },
  languageData: { commentTokens: { line: "#" } }
};
export {
  toml as t
};
