diff --git a/src/docode.c b/src/docode.c index ab1b2e2c519d9522175db2e795014249064ac1ee..9db9fd8d5dbce0b283baf290ce5354eafd4b6aac 100644 --- a/src/docode.c +++ b/src/docode.c @@ -4,7 +4,7 @@ ||| See the files COPYING and DISCLAIMER for more information. \*/ #include "global.h" -RCSID("$Id: docode.c,v 1.10 1997/01/30 03:51:32 hubbe Exp $"); +RCSID("$Id: docode.c,v 1.11 1997/02/14 04:45:57 hubbe Exp $"); #include "las.h" #include "program.h" #include "language.h" @@ -285,7 +285,10 @@ static int do_docode2(node *n,int flags) case '?': { + INT32 *prev_switch_jumptable = current_switch_jumptable; int adroppings , bdroppings; + current_switch_jumptable=0; + if(!CDDR(n)) { @@ -293,6 +296,7 @@ static int do_docode2(node *n,int flags) do_jump_when_zero(CAR(n), tmp1); DO_CODE_BLOCK(CADR(n)); emit(F_LABEL, tmp1); + current_switch_jumptable = prev_switch_jumptable; return 0; } @@ -302,6 +306,7 @@ static int do_docode2(node *n,int flags) do_jump_when_non_zero(CAR(n), tmp1); DO_CODE_BLOCK(CDDR(n)); emit(F_LABEL,tmp1); + current_switch_jumptable = prev_switch_jumptable; return 0; } @@ -328,6 +333,8 @@ static int do_docode2(node *n,int flags) } emit(F_LABEL, tmp2); + + current_switch_jumptable = prev_switch_jumptable; return adroppings; } diff --git a/src/language.yacc b/src/language.yacc index 3c0a959d4427ff2392e8e7d83d55d76060134729..342ec8220e6c26ee298eda93af77913880f9e022 100644 --- a/src/language.yacc +++ b/src/language.yacc @@ -156,7 +156,7 @@ /* This is the grammar definition of Pike. */ #include "global.h" -RCSID("$Id: language.yacc,v 1.23 1997/02/11 07:09:11 hubbe Exp $"); +RCSID("$Id: language.yacc,v 1.24 1997/02/14 04:45:57 hubbe Exp $"); #ifdef HAVE_MEMORY_H #include <memory.h> #endif @@ -223,7 +223,8 @@ void fix_comp_stack(int sp) %type <string> F_IDENTIFIER %type <string> F_STRING -%type <string> cast simple_type +%type <string> cast +%type <string> simple_type %type <string> low_string %type <string> optional_identifier %type <string> optional_rename_inherit @@ -629,13 +630,15 @@ optional_stars: optional_stars '*' { $$=$1 + 1; } | /* empty */ { $$=0; } ; -cast: '(' type ')' { $$=pop_type(); } ; - +cast: '(' type ')' { $$=pop_type(); } + ; + type: type '*' { push_type(T_ARRAY); } | type2 ; simple_type: type2 { $$=pop_type(); } + ; type2: type2 '|' type3 { push_type(T_OR); } | type3 @@ -833,7 +836,7 @@ statement: unused2 ';' { $$=$1; } | foreach | break ';' | continue ';' - | error ';' { $$=0; } + | error ';' { reset_type_stack(); $$=0; } | ';' { $$=0; } ; @@ -1048,7 +1051,7 @@ expr00: expr0 expr0: expr01 | expr4 '=' expr0 { $$=mknode(F_ASSIGN,$3,$1); } | expr4 assign expr0 { $$=mknode($2,$1,$3); } - | error assign expr01 { $$=0; } + | error assign expr01 { $$=0; reset_type_stack(); } ; expr01: expr1 { $$ = $1; }