Mercurial > hg > octave-nkf
comparison libinterp/parse-tree/lex.ll @ 16309:e608de76742c
allow newline to terminate anonymous function definition
* lex.ll ({NL}): Also return '\n' if parsing anonymous function body.
Check for paren nesting first.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 14 Mar 2013 22:23:24 -0400 |
parents | c40a8873c2e7 |
children | 09f0cb9cac7d |
comparison
equal
deleted
inserted
replaced
16308:122c1a7a3004 | 16309:e608de76742c |
---|---|
728 curr_lexer->lexer_debug ("{NL}"); | 728 curr_lexer->lexer_debug ("{NL}"); |
729 | 729 |
730 curr_lexer->input_line_number++; | 730 curr_lexer->input_line_number++; |
731 curr_lexer->current_input_column = 1; | 731 curr_lexer->current_input_column = 1; |
732 | 732 |
733 if (curr_lexer->nesting_level.none ()) | 733 if (curr_lexer->nesting_level.is_paren ()) |
734 { | |
735 curr_lexer->at_beginning_of_statement = false; | |
736 curr_lexer->gripe_matlab_incompatible | |
737 ("bare newline inside parentheses"); | |
738 } | |
739 else if (curr_lexer->nesting_level.none () | |
740 || curr_lexer->nesting_level.is_anon_fcn_body ()) | |
734 { | 741 { |
735 curr_lexer->at_beginning_of_statement = true; | 742 curr_lexer->at_beginning_of_statement = true; |
736 return curr_lexer->count_token ('\n'); | 743 return curr_lexer->count_token ('\n'); |
737 } | |
738 else if (curr_lexer->nesting_level.is_paren ()) | |
739 { | |
740 curr_lexer->at_beginning_of_statement = false; | |
741 curr_lexer->gripe_matlab_incompatible ("bare newline inside parentheses"); | |
742 } | 744 } |
743 else if (curr_lexer->nesting_level.is_bracket_or_brace ()) | 745 else if (curr_lexer->nesting_level.is_bracket_or_brace ()) |
744 return LEXICAL_ERROR; | 746 return LEXICAL_ERROR; |
745 } | 747 } |
746 | 748 |