diff libinterp/parse-tree/lex.ll @ 18492:e4c319ed2414 stable

Fix regression, allow space-separated cell array of function handles (bug #41569) * lex.ll ("@"): Unput comma before function handle when after whitespace in an array context. * parser.tst: New test case.
author Mike Miller <mtmiller@ieee.org>
date Thu, 20 Feb 2014 09:24:59 -0500
parents 4d2e15abe5e7
children 3cac3d7f003f 04b4fb217b1a
line wrap: on
line diff
--- a/libinterp/parse-tree/lex.ll	Thu Feb 20 00:44:14 2014 -0500
+++ b/libinterp/parse-tree/lex.ll	Thu Feb 20 09:24:59 2014 -0500
@@ -1099,6 +1099,8 @@
   }
 
 "@" {
+    curr_lexer->lexer_debug ("@");
+
     if (curr_lexer->previous_token_may_be_command ()
         &&  curr_lexer->space_follows_previous_token ())
       {
@@ -1107,15 +1109,26 @@
       }
     else
       {
-        curr_lexer->lexer_debug ("@");
-
-        curr_lexer->current_input_column++;
-
-        curr_lexer->looking_at_function_handle++;
-        curr_lexer->looking_for_object_index = false;
-        curr_lexer->at_beginning_of_statement = false;
-
-        return curr_lexer->count_token ('@');
+        int tok = curr_lexer->previous_token_value ();
+
+        if (curr_lexer->whitespace_is_significant ()
+            && curr_lexer->space_follows_previous_token ()
+            && ! (tok == '[' || tok == '{'
+                  || curr_lexer->previous_token_is_binop ()))
+          {
+            yyless (0);
+            unput (',');
+          }
+        else
+          {
+            curr_lexer->current_input_column++;
+
+            curr_lexer->looking_at_function_handle++;
+            curr_lexer->looking_for_object_index = false;
+            curr_lexer->at_beginning_of_statement = false;
+
+            return curr_lexer->count_token ('@');
+          }
       }
   }