Mercurial > hg > octave-nkf
diff 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 |
line wrap: on
line diff
--- a/src/lex.ll +++ b/src/lex.ll @@ -976,10 +976,15 @@ lexer_flags.looking_at_object_index.pop_front (); lexer_flags.quote_is_transpose = true; - lexer_flags.convert_spaces_to_comma = nesting_level.is_bracket_or_brace (); + lexer_flags.convert_spaces_to_comma + = (nesting_level.is_bracket_or_brace () + && ! lexer_flags.looking_at_anon_fcn_args); lexer_flags.looking_for_object_index = true; lexer_flags.at_beginning_of_statement = false; + if (lexer_flags.looking_at_anon_fcn_args) + lexer_flags.looking_at_anon_fcn_args = false; + do_comma_insert_check (); COUNT_TOK_AND_RETURN (')'); @@ -3368,6 +3373,9 @@ // Not initiallly looking at a function handle. looking_at_function_handle = 0; + // Not initiallly looking at an anonymous function argument list. + looking_at_anon_fcn_args = 0; + // Not parsing a function return, parameter, or declaration list. looking_at_return_list = false; looking_at_parameter_list = false;