diff 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
line wrap: on
line diff
--- a/src/oct-parse.yy
+++ b/src/oct-parse.yy
@@ -1066,7 +1066,11 @@
                 ;
 
 if_cmd_list1    : expression opt_sep opt_list
-                  { $$ = start_if_command ($1, $3); }
+                  {
+                    $1->mark_braindead_shortcircuit (curr_fcn_file_full_name);
+
+                    $$ = start_if_command ($1, $3);
+                  }
                 | if_cmd_list1 elseif_clause
                   {
                     $1->append ($2);
@@ -1075,7 +1079,11 @@
                 ;
 
 elseif_clause   : ELSEIF stash_comment opt_sep expression opt_sep opt_list
-                  { $$ = make_elseif_clause ($1, $4, $6, $2); }
+                  {
+                    $4->mark_braindead_shortcircuit (curr_fcn_file_full_name);
+
+                    $$ = make_elseif_clause ($1, $4, $6, $2);
+                  }
                 ;
 
 else_clause     : ELSE stash_comment opt_sep opt_list
@@ -1129,6 +1137,8 @@
 
 loop_command    : WHILE stash_comment expression opt_sep opt_list END
                   {
+                    $3->mark_braindead_shortcircuit (curr_fcn_file_full_name);
+
                     if (! ($$ = make_while_command ($1, $3, $5, $6, $2)))
                       ABORT_PARSE;
                   }