function failFirstLine(e, i) {
  return e.skipToEnd(), i.cur = header, "error";
}
function start(i, o) {
  return i.match(/^HTTP\/\d\.\d/) ? (o.cur = responseStatusCode, "keyword") : i.match(/^[A-Z]+/) && /[ \t]/.test(i.peek()) ? (o.cur = requestPath, "keyword") : failFirstLine(i, o);
}
function responseStatusCode(i, a) {
  var s = i.match(/^\d+/);
  if (!s) return failFirstLine(i, a);
  a.cur = responseStatusText;
  var c = Number(s[0]);
  return c >= 100 && c < 400 ? "atom" : "error";
}
function responseStatusText(e, i) {
  return e.skipToEnd(), i.cur = header, null;
}
function requestPath(e, i) {
  return e.eatWhile(/\S/), i.cur = requestProtocol, "string.special";
}
function requestProtocol(i, a) {
  return i.match(/^HTTP\/\d\.\d$/) ? (a.cur = header, "keyword") : failFirstLine(i, a);
}
function header(e) {
  return e.sol() && !e.eat(/[ \t]/) ? e.match(/^.*?:/) ? "atom" : (e.skipToEnd(), "error") : (e.skipToEnd(), "string");
}
function body(e) {
  return e.skipToEnd(), null;
}
const http = {
  name: "http",
  token: function(e, i) {
    var a = i.cur;
    return a != header && a != body && e.eatSpace() ? null : a(e, i);
  },
  blankLine: function(e) {
    e.cur = body;
  },
  startState: function() {
    return { cur: start };
  }
};
export {
  http
};
