changeset 18319:f59459404f55 stable

allow "methods ftp" to work outside of classdef (bug #41227) * lex.ll (octave_base_lexer::handle_keyword_token): Don't alter at_beginning_of_statement if something that looks like a keyword is used in a context where it is not.
author John W. Eaton <jwe@octave.org>
date Wed, 22 Jan 2014 02:49:29 -0500
parents b14cdae65abd
children b522d04382cf
files libinterp/parse-tree/lex.ll
diffstat 1 files changed, 14 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/parse-tree/lex.ll	Mon Jan 20 01:34:26 2014 -0500
+++ b/libinterp/parse-tree/lex.ll	Wed Jan 22 02:49:29 2014 -0500
@@ -2208,6 +2208,8 @@
 
   if (kw)
     {
+      bool previous_at_bos = at_beginning_of_statement;
+
       // May be reset to true for some token types.
       at_beginning_of_statement = false;
 
@@ -2255,7 +2257,10 @@
                   && (defining_func
                       && ! (looking_at_return_list
                             || parsed_function_name.top ()))))
-            return 0;
+            {
+              at_beginning_of_statement = previous_at_bos;
+              return 0;
+            }
 
           tok_val = new token (end_kw, token::simple_end, l, c);
           at_beginning_of_statement = true;
@@ -2357,7 +2362,10 @@
           // 'get' and 'set' are keywords in classdef method
           // declarations.
           if (! maybe_classdef_get_set_method)
-            return 0;
+            {
+              at_beginning_of_statement = previous_at_bos;
+              return 0;
+            }
           break;
 
         case enumeration_kw:
@@ -2367,7 +2375,10 @@
           // 'properties', 'methods' and 'events' are keywords for
           // classdef blocks.
           if (! parsing_classdef)
-            return 0;
+            {
+              at_beginning_of_statement = previous_at_bos;
+              return 0;
+            }
           // fall through ...
 
         case classdef_kw: