archive/directives/process/process_js_directives.js
function consume_directive (proc_stack) {
  let pos = proc_stack._tGetNPos();

  proc_stack.tSkip(5);
  let directive_name = proc_stack.tAcceptUntil("(");
  proc_stack.tSkip();

  let args = [];
  do {
    proc_stack.tSkipWhile(WHITESPACE);
    let peek = proc_stack.tPeek();
    if (peek == ")") {
      break;
    }

    let arg_val_parts = [];

    do {
      proc_stack.tSkipWhile(WHITESPACE);
      let matched = false;
      for (let trig of CONSUMERS_DIRECTIVE_ARG_TRIGGERS) {
        if (proc_stack.tMatches(trig)) {
          let consumed = CONSUMERS_DIRECTIVE_ARG[trig](proc_stack);
          if (consumed instanceof DirectiveExpr) {
            arg_val_parts.push(consumed);
          } else {
            arg_val_parts.push(Function(`return ${consumed}`)());
          }
          matched = true;
          break;
        }
      }
      if (!matched) {
        throw new SyntaxError(`Invalid JS directive argument`);
      }
      proc_stack.tSkipWhile(WHITESPACE);
    } while (proc_stack.tSkipIf("+"));

    args.push(arg_val_parts);

  } while (proc_stack.tSkipIf(","));

  if (!proc_stack.tSkipIf(")")) {
    throw new SyntaxError(`JS directive is missing closing parenthesis`);
  }
  proc_stack.tSkipIf(";");

  return new DirectiveExpr(proc_stack, pos, directive_name, args);
}
function consume_directive (proc_stack) {
  let pos = proc_stack._tGetNPos();

  proc_stack.tSkip(5);
  let directive_name = proc_stack.tAcceptUntil("(");
  proc_stack.tSkip();

  let args = [];
  do {
    proc_stack.tSkipWhile(WHITESPACE);
    let peek = proc_stack.tPeek();
    if (peek == ")") {
      break;
    }

    let arg_val_parts = [];

    do {
      proc_stack.tSkipWhile(WHITESPACE);
      let matched = false;
      for (let trig of CONSUMERS_DIRECTIVE_ARG_TRIGGERS) {
        if (proc_stack.tMatches(trig)) {
          let consumed = CONSUMERS_DIRECTIVE_ARG[trig](proc_stack);
          if (consumed instanceof DirectiveExpr) {
            arg_val_parts.push(consumed);
          } else {
            arg_val_parts.push(Function(`return ${consumed}`)());
          }
          matched = true;
          break;
        }
      }
      if (!matched) {
        throw new SyntaxError(`Invalid JS directive argument`);
      }
      proc_stack.tSkipWhile(WHITESPACE);
    } while (proc_stack.tSkipIf("+"));

    args.push(arg_val_parts);

  } while (proc_stack.tSkipIf(","));

  if (!proc_stack.tSkipIf(")")) {
    throw new SyntaxError(`JS directive is missing closing parenthesis`);
  }
  proc_stack.tSkipIf(";");

  return new DirectiveExpr(proc_stack, pos, directive_name, args);
}
Called on match `__zc_`