void Block::dump_pred(const Block_Array *bbs, Block* orig) const {
  if (is_connector()) {
    for (uint i=1; i<num_preds(); i++) {
      Block *p = ((*bbs)[pred(i)->_idx]);
      p->dump_pred(bbs, orig);
    }
  } else {
    dump_bidx(orig);
C2OUT->print(" ");
  }
}
Beispiel #2
0
// parse | and ;
// parse tokens from head (include) to tail (*exclude*)
PARSE_STATUS parse_connector(TOKEN_LIST_NODE *head, TOKEN_LIST_NODE *tail)
{
    TOKEN_LIST_NODE *cur;
    PARSE_STATUS p;

    // parse has finished!
    if (head == tail)
        return PARSE_STATUS_NORMAL;


    // check until connector occurs
    cur = head;
    while (cur->next != tail && !is_connector(cur->tok))
    {
        cur = cur->next;
    }

    // check if a pipe operator (|) at the end
    if (cur->tok->type == TOKEN_TYPE_PIPE &&
        cur->next == tail)
    {
        return PARSE_STATUS_ILLEGAL_CONNECTOR;
    }

#ifdef DEBUG
    fprintf(stderr, "[parser.c] parse command %d %d\n", head, cur->next);
#endif
    p = parse_command(head, cur->next);
    if (p != PARSE_STATUS_NORMAL)
        return p;

#ifdef DEBUG
    fprintf(stderr, "[parser.c] parse connector %d %d\n", cur->next, tail);
#endif
    p = parse_connector(cur->next, tail);
    if (p != PARSE_STATUS_NORMAL)
            return p;

    return PARSE_STATUS_NORMAL;
}