pike.git / src / language.yacc

version» Context lines:

pike.git/src/language.yacc:3364:    free_node($1);    }    | soft_cast expr2    {    $$ = mksoftcastnode($1->u.sval.u.type, $2);    free_node($1);    }    | TOK_INC expr4 { $$=mknode(F_INC,$2,0); }    | TOK_DEC expr4 { $$=mknode(F_DEC,$2,0); }    | TOK_NOT expr2 { $$=mkopernode("`!",$2,0); } -  | '~' expr2 { $$=mkopernode("`~",$2,0); } -  | '-' expr2 { $$=mkopernode("`-",$2,0); } +  | '~' expr2 +  { +  if ($2 && ($2->token == F_CONSTANT) && (TYPEOF($2->u.sval) == T_INT)) { +  $$ = mkintnode(~($2->u.sval.u.integer)); +  free_node($2); +  } else { +  $$ = mkopernode("`~", $2, 0); +  } +  } +  | '-' expr2 +  { +  if ($2 && ($2->token == F_CONSTANT) && (TYPEOF($2->u.sval) == T_INT) && +  !INT_TYPE_NEG_OVERFLOW($2->u.sval.u.integer)) { +  $$ = mkintnode(-($2->u.sval.u.integer)); +  free_node($2); +  } else { +  $$=mkopernode("`-", $2, 0); +  } +  }    ;      expr3: expr4    | expr4 TOK_INC { $$=mknode(F_POST_INC,$1,0); }    | expr4 TOK_DEC { $$=mknode(F_POST_DEC,$1,0); }    ;      /* FIXMEs    * It would be nice if 'return' would exit from    * the surrounding function rather than from the