Mercurial > hg > octave-lyh
diff src/parse.y @ 2620:5c773d4745d6
[project @ 1997-01-23 16:26:25 by jwe]
author | jwe |
---|---|
date | Thu, 23 Jan 1997 16:26:26 +0000 |
parents | 484977eb65ad |
children | 76411ce43c05 |
line wrap: on
line diff
--- a/src/parse.y +++ b/src/parse.y @@ -1869,15 +1869,13 @@ { tree_command *retval = 0; - if (! (lexer_flags.looping || lexer_flags.defining_func)) - yyerror ("break: only meaningful within a loop or function body"); + int l = break_tok->line (); + int c = break_tok->column (); + + if (lexer_flags.looping || lexer_flags.defining_func || reading_script_file) + retval = new tree_break_command (l, c); else - { - int l = break_tok->line (); - int c = break_tok->column (); - - retval = new tree_break_command (l, c); - } + retval = new tree_no_op_command ("break", l, c); return retval; } @@ -1889,15 +1887,13 @@ { tree_command *retval = 0; - if (! lexer_flags.looping) - yyerror ("continue: only meaningful within a `for' or `while' loop"); + int l = continue_tok->line (); + int c = continue_tok->column (); + + if (lexer_flags.looping) + retval = new tree_continue_command (l, c); else - { - int l = continue_tok->line (); - int c = continue_tok->column (); - - retval = new tree_continue_command (l, c); - } + retval = new tree_no_op_command ("continue", l, c); return retval; } @@ -1909,15 +1905,13 @@ { tree_command *retval = 0; - if (! lexer_flags.defining_func) - yyerror ("return: only meaningful within a function"); + int l = return_tok->line (); + int c = return_tok->column (); + + if (lexer_flags.defining_func || reading_script_file) + retval = new tree_return_command (l, c); else - { - int l = return_tok->line (); - int c = return_tok->column (); - - retval = new tree_return_command (l, c); - } + retval = new tree_no_op_command ("return", l, c); return retval; }