function parse_command()

in src/parser/WDL/hermes/wdl_parser.js [2820:2853]


function parse_command(ctx) {
  var current = ctx.tokens.current();
  var rule = current != null ? table[50][current.id] : -1;
  var tree = new ParseTree(new NonTerminal(108, 'command'));
  var ast_parameters;
  var subtree;
  var t;
  ctx.nonterminal = "command";
  if (current == null) {
    throw new SyntaxError('Error: unexpected end of file');
  }
  if (rule == 19) { // $command = :raw_command :raw_cmd_start $_gen5 :raw_cmd_end -> RawCommand( parts=$2 )
    ctx.rule = rules[19];
    ast_parameters = {
      'parts': 2,
    }
    tree.astTransform = new AstTransformNodeCreator('RawCommand', ast_parameters);
    t = expect(ctx, 49); // :raw_command
    tree.add(t);
    t = expect(ctx, 37); // :raw_cmd_start
    tree.add(t);
    subtree = parse__gen5(ctx);
    tree.add(subtree);
    t = expect(ctx, 2); // :raw_cmd_end
    tree.add(t);
    return tree;
  }
  throw new SyntaxError(ctx.error_formatter.unexpected_symbol(
    ctx.nonterminal,
    ctx.tokens.current(),
    nonterminal_first[108],
    rules[19]
  ));
}