Beispiel #1
0
struct syntax_node * other_rel_e(){
  struct syntax_node * t;
  t = (struct syntax_node*)malloc(sizeof(struct syntax_node));

  chushihua_t(t);
  t->child[0] = cmp_op();
  t->child[1] = Exp();
  strcpy(t->kind_name, "OtherRelE");
  return t;
}
Beispiel #2
0
static
opexpr_code(stream, node, need_lval) {
    auto op = node[0];

    /* Unary prefix operators */
    if ( node[1] == 1 )
        unary_pre( stream, node, need_lval );

    /* Unary postfix operators (marked binary in the tree) */
    else if ( op == '++' || op == '--' )
        unary_post( stream, node, need_lval );

    /* These operators are handled separately because of short-circuiting */
    else if ( op == '&&' || op == '||' )
        logical_bin( stream, node );

    /* And these are because they don't evaluate their second argument */
    else if ( op == '->' || op == '.' )
        member_bin( stream, node, need_lval );
   
    else if ( op == '<' || op == '>' || op == '<=' || op == '>='
              || op == '==' || op == '!=' )
        cmp_op( stream, node );

    else if ( op == ',' ) {
        expr_code( stream, node[3], 0 );
        expr_code( stream, node[4], 0 );
    }

    /* Binary operators */
    else if ( node[1] == 2 )
        binary_op( stream, node, need_lval );

    /* The ternary operator also short-circuits */
    else if ( op == '?:' )
        conditional( stream, node );

    else
        int_error( "Unknown operator: '%Mc'", node[0] );
}