Mercurial > octave
changeset 27729:718845eb3c7a
eliminate unnecessary expr_no_assign non-terminal in parser
* oct-parse.yy (expr_no_assign): Merge with expression.
(anon_fcn_handle): Use expression instead of expr_no_assign.
Anonymous function expression validation will detect and throw errors
for assignment now.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 20 Nov 2019 19:34:15 -0600 |
parents | 5e92bff668d6 |
children | 5b9067c17e4b |
files | libinterp/parse-tree/oct-parse.yy |
diffstat | 1 files changed, 6 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/parse-tree/oct-parse.yy Wed Nov 20 19:22:54 2019 -0600 +++ b/libinterp/parse-tree/oct-parse.yy Wed Nov 20 19:34:15 2019 -0600 @@ -241,7 +241,7 @@ %type <tree_matrix_type> matrix_rows %type <tree_cell_type> cell_rows %type <tree_expression_type> matrix cell -%type <tree_expression_type> primary_expr oper_expr power_expr expr_no_assign +%type <tree_expression_type> primary_expr oper_expr power_expr %type <tree_expression_type> simple_expr colon_expr assign_expr expression %type <tree_identifier_type> identifier fcn_name magic_tilde %type <tree_superclass_ref_type> superclass_identifier @@ -604,7 +604,7 @@ { $$ = parser.make_fcn_handle ($1); } ; -anon_fcn_handle : '@' param_list stmt_begin expr_no_assign +anon_fcn_handle : '@' param_list stmt_begin expression { $$ = parser.make_anon_fcn_handle ($2, $4); if (! $$) @@ -931,7 +931,7 @@ { $$ = parser.make_assign_op (OR_EQ, $1, $2, $3); } ; -expr_no_assign : simple_expr +expression : simple_expr { if ($1 && ($1->is_matrix () || $1->iscell ())) { @@ -946,12 +946,6 @@ else $$ = $1; } - | anon_fcn_handle - { $$ = $1; } - ; - -expression : expr_no_assign - { $$ = $1; } | assign_expr { if (! $1) @@ -959,6 +953,9 @@ $$ = $1; } + | anon_fcn_handle + { $$ = $1; } + ; // ================================================ // Commands, declarations, and function definitions