changeset 16334:06aa4c0f2018

handle foo @... as command syntax * lex.ll ("@"): Check for possible command.
author John W. Eaton <jwe@octave.org>
date Tue, 19 Mar 2013 17:06:22 -0400
parents 100a7bd2590e
children bef822a80ffb
files libinterp/parse-tree/lex.ll
diffstat 1 files changed, 18 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/parse-tree/lex.ll	Tue Mar 19 13:54:10 2013 -0700
+++ b/libinterp/parse-tree/lex.ll	Tue Mar 19 17:06:22 2013 -0400
@@ -706,15 +706,24 @@
   }
 
 "@" {
-    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 ('@');
+    if (curr_lexer->previous_token_may_be_command ()
+        &&  curr_lexer->space_follows_previous_token ())
+      {
+        yyless (0);
+        curr_lexer->push_start_state (COMMAND_START);
+      }
+    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 ('@');
+      }
   }
 
 %{