Mercurial > octave-nkf
comparison src/lex.ll @ 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 | 2837514cf178 |
children | 027a2186cd90 |
comparison
equal
deleted
inserted
replaced
13236:8bb526fb3349 | 13237:1bfca2bbea8b |
---|---|
974 current_input_column++; | 974 current_input_column++; |
975 | 975 |
976 lexer_flags.looking_at_object_index.pop_front (); | 976 lexer_flags.looking_at_object_index.pop_front (); |
977 | 977 |
978 lexer_flags.quote_is_transpose = true; | 978 lexer_flags.quote_is_transpose = true; |
979 lexer_flags.convert_spaces_to_comma = nesting_level.is_bracket_or_brace (); | 979 lexer_flags.convert_spaces_to_comma |
980 = (nesting_level.is_bracket_or_brace () | |
981 && ! lexer_flags.looking_at_anon_fcn_args); | |
980 lexer_flags.looking_for_object_index = true; | 982 lexer_flags.looking_for_object_index = true; |
981 lexer_flags.at_beginning_of_statement = false; | 983 lexer_flags.at_beginning_of_statement = false; |
984 | |
985 if (lexer_flags.looking_at_anon_fcn_args) | |
986 lexer_flags.looking_at_anon_fcn_args = false; | |
982 | 987 |
983 do_comma_insert_check (); | 988 do_comma_insert_check (); |
984 | 989 |
985 COUNT_TOK_AND_RETURN (')'); | 990 COUNT_TOK_AND_RETURN (')'); |
986 } | 991 } |
3365 maybe_classdef_get_set_method = false; | 3370 maybe_classdef_get_set_method = false; |
3366 parsing_classdef = false; | 3371 parsing_classdef = false; |
3367 | 3372 |
3368 // Not initiallly looking at a function handle. | 3373 // Not initiallly looking at a function handle. |
3369 looking_at_function_handle = 0; | 3374 looking_at_function_handle = 0; |
3375 | |
3376 // Not initiallly looking at an anonymous function argument list. | |
3377 looking_at_anon_fcn_args = 0; | |
3370 | 3378 |
3371 // Not parsing a function return, parameter, or declaration list. | 3379 // Not parsing a function return, parameter, or declaration list. |
3372 looking_at_return_list = false; | 3380 looking_at_return_list = false; |
3373 looking_at_parameter_list = false; | 3381 looking_at_parameter_list = false; |
3374 looking_at_decl_list = false; | 3382 looking_at_decl_list = false; |