function parse_workflow_or_task_or_decl()

in src/parser/WDL/hermes/wdl_parser.js [3909:3947]


function parse_workflow_or_task_or_decl(ctx) {
  var current = ctx.tokens.current();
  var rule = current != null ? table[29][current.id] : -1;
  var tree = new ParseTree(new NonTerminal(87, 'workflow_or_task_or_decl'));
  var ast_parameters;
  var subtree;
  var t;
  ctx.nonterminal = "workflow_or_task_or_decl";
  if (current == null) {
    throw new SyntaxError('Error: unexpected end of file');
  }
  if (rule == 3) { // $workflow_or_task_or_decl = $workflow
    ctx.rule = rules[3];
    tree.astTransform = new AstTransformSubstitution(0);
    subtree = parse_workflow(ctx);
    tree.add(subtree);
    return tree;
  }
  else if (rule == 4) { // $workflow_or_task_or_decl = $task
    ctx.rule = rules[4];
    tree.astTransform = new AstTransformSubstitution(0);
    subtree = parse_task(ctx);
    tree.add(subtree);
    return tree;
  }
  else if (rule == 5) { // $workflow_or_task_or_decl = $declaration
    ctx.rule = rules[5];
    tree.astTransform = new AstTransformSubstitution(0);
    subtree = parse_declaration(ctx);
    tree.add(subtree);
    return tree;
  }
  throw new SyntaxError(ctx.error_formatter.unexpected_symbol(
    ctx.nonterminal,
    ctx.tokens.current(),
    nonterminal_first[87],
    rules[5]
  ));
}