# HG changeset patch # User John W. Eaton # Date 1390376969 18000 # Node ID f59459404f55fbc8fa7e6db3ebe22dd6a2650887 # Parent b14cdae65abd9080c6320d0cf72e85fd8acdd07d 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. diff -r b14cdae65abd -r f59459404f55 libinterp/parse-tree/lex.ll --- 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: