comparison src/oct-parse.yy @ 11091:5677f3f7b5fa

Matlab compatible short-circuit behavior for & and | operators
author John W. Eaton <jwe@octave.org>
date Fri, 08 Oct 2010 15:22:47 -0400
parents 54697b37d8bf
children a51ac4198e1c
comparison
equal deleted inserted replaced
11090:2adf4736dafa 11091:5677f3f7b5fa
1064 $$ = $1; 1064 $$ = $1;
1065 } 1065 }
1066 ; 1066 ;
1067 1067
1068 if_cmd_list1 : expression opt_sep opt_list 1068 if_cmd_list1 : expression opt_sep opt_list
1069 { $$ = start_if_command ($1, $3); } 1069 {
1070 $1->mark_braindead_shortcircuit (curr_fcn_file_full_name);
1071
1072 $$ = start_if_command ($1, $3);
1073 }
1070 | if_cmd_list1 elseif_clause 1074 | if_cmd_list1 elseif_clause
1071 { 1075 {
1072 $1->append ($2); 1076 $1->append ($2);
1073 $$ = $1; 1077 $$ = $1;
1074 } 1078 }
1075 ; 1079 ;
1076 1080
1077 elseif_clause : ELSEIF stash_comment opt_sep expression opt_sep opt_list 1081 elseif_clause : ELSEIF stash_comment opt_sep expression opt_sep opt_list
1078 { $$ = make_elseif_clause ($1, $4, $6, $2); } 1082 {
1083 $4->mark_braindead_shortcircuit (curr_fcn_file_full_name);
1084
1085 $$ = make_elseif_clause ($1, $4, $6, $2);
1086 }
1079 ; 1087 ;
1080 1088
1081 else_clause : ELSE stash_comment opt_sep opt_list 1089 else_clause : ELSE stash_comment opt_sep opt_list
1082 { $$ = new tree_if_clause ($4, $2); } 1090 { $$ = new tree_if_clause ($4, $2); }
1083 ; 1091 ;
1127 // Looping 1135 // Looping
1128 // ======= 1136 // =======
1129 1137
1130 loop_command : WHILE stash_comment expression opt_sep opt_list END 1138 loop_command : WHILE stash_comment expression opt_sep opt_list END
1131 { 1139 {
1140 $3->mark_braindead_shortcircuit (curr_fcn_file_full_name);
1141
1132 if (! ($$ = make_while_command ($1, $3, $5, $6, $2))) 1142 if (! ($$ = make_while_command ($1, $3, $5, $6, $2)))
1133 ABORT_PARSE; 1143 ABORT_PARSE;
1134 } 1144 }
1135 | DO stash_comment opt_sep opt_list UNTIL expression 1145 | DO stash_comment opt_sep opt_list UNTIL expression
1136 { 1146 {