archive/directives/process/process_js_directives.js
function consume_string (proc_stack) {
  let delim = proc_stack.tAccept();
  let str = delim;

  let escaping = 0;
  let done = false;

  while (!done) {
    let c = proc_stack.tAccept();
    if (c == "\\") {
      escaping ^= 1;

    } else {
      if (c == delim && !escaping) {
        done = true;

      } else if (c == "\r" || c == "\n") {
        if (!escaping) {
          throw new SyntaxError(`Unterminated JavaScript string`);
        }
        if (c == "\r" && proc_stack.tPeek() == "\n") {
          proc_stack.tSkip();
        }
      }

      escaping = 0;
    }

    str += c;
  }

  return str;
}
function consume_string (proc_stack) {
  let delim = proc_stack.tAccept();
  let str = delim;

  let escaping = 0;
  let done = false;

  while (!done) {
    let c = proc_stack.tAccept();
    if (c == "\\") {
      escaping ^= 1;

    } else {
      if (c == delim && !escaping) {
        done = true;

      } else if (c == "\r" || c == "\n") {
        if (!escaping) {
          throw new SyntaxError(`Unterminated JavaScript string`);
        }
        if (c == "\r" && proc_stack.tPeek() == "\n") {
          proc_stack.tSkip();
        }
      }

      escaping = 0;
    }

    str += c;
  }

  return str;
}
Called on match `"` or `'`