diff 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
line wrap: on
line diff
--- a/libinterp/parse-tree/lex.ll	Thu Mar 14 22:23:24 2013 -0400
+++ b/libinterp/parse-tree/lex.ll	Thu Mar 14 22:23:24 2013 -0400
@@ -730,16 +730,18 @@
     curr_lexer->input_line_number++;
     curr_lexer->current_input_column = 1;
 
-    if (curr_lexer->nesting_level.none ())
+    if (curr_lexer->nesting_level.is_paren ())
+      {
+        curr_lexer->at_beginning_of_statement = false;
+        curr_lexer->gripe_matlab_incompatible
+          ("bare newline inside parentheses");
+      }
+    else if (curr_lexer->nesting_level.none ()
+        || curr_lexer->nesting_level.is_anon_fcn_body ())
       {
         curr_lexer->at_beginning_of_statement = true;
         return curr_lexer->count_token ('\n');
       }
-    else if (curr_lexer->nesting_level.is_paren ())
-      {
-        curr_lexer->at_beginning_of_statement = false;
-        curr_lexer->gripe_matlab_incompatible ("bare newline inside parentheses");
-      }
     else if (curr_lexer->nesting_level.is_bracket_or_brace ())
       return LEXICAL_ERROR;
   }