Mercurial > hg > octave-nkf
comparison src/oct-parse.yy @ 13237:1bfca2bbea8b
fix parsing of anonymous functions inside cell array lists.
* lex.h (lexer_flags::looking_at_anon_fcn_args): New data member.
(lexer_flags::lexer_flags): Initialize it. Initialize
looking_at_function_handle to 0, not false.
* lex.ll (lexer_flags::init): Reset looking_at_anon_fcn_args to 0.
* oct-parse.yy (param_list_beg): Set
lexer_flags.looking_at_anon_fcn_args to true if
lexer_flags.looking_at_function_handle is non-zero.
(")"): Set lexer_flags.looking_at_anon_fcn_args to false.
* test_parser.m: New tests.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 27 Sep 2011 03:22:48 -0400 |
parents | 34a49d076155 |
children | 2a8dcb5b3a00 |
comparison
equal
deleted
inserted
replaced
13236:8bb526fb3349 | 13237:1bfca2bbea8b |
---|---|
733 lexer_flags.looking_at_function_handle--; | 733 lexer_flags.looking_at_function_handle--; |
734 } | 734 } |
735 ; | 735 ; |
736 | 736 |
737 anon_fcn_handle : '@' param_list statement | 737 anon_fcn_handle : '@' param_list statement |
738 { $$ = make_anon_fcn_handle ($2, $3); } | 738 { |
739 lexer_flags.quote_is_transpose = false; | |
740 $$ = make_anon_fcn_handle ($2, $3); | |
741 } | |
739 ; | 742 ; |
740 | 743 |
741 primary_expr : identifier | 744 primary_expr : identifier |
742 { $$ = $1; } | 745 { $$ = $1; } |
743 | constant | 746 | constant |
1228 if (lexer_flags.looking_at_function_handle) | 1231 if (lexer_flags.looking_at_function_handle) |
1229 { | 1232 { |
1230 symtab_context.push (symbol_table::current_scope ()); | 1233 symtab_context.push (symbol_table::current_scope ()); |
1231 symbol_table::set_scope (symbol_table::alloc_scope ()); | 1234 symbol_table::set_scope (symbol_table::alloc_scope ()); |
1232 lexer_flags.looking_at_function_handle--; | 1235 lexer_flags.looking_at_function_handle--; |
1236 lexer_flags.looking_at_anon_fcn_args = true; | |
1233 } | 1237 } |
1234 } | 1238 } |
1235 ; | 1239 ; |
1236 | 1240 |
1237 param_list_end : ')' | 1241 param_list_end : ')' |