changeset 20223:e679dc89e64b stable

allow keywords as structure fields again (bug #45092) * lex.ll (handle_identifier): Don't throw error if structure field is a keyword. Don't abort if at_beginning_of_statement is true.
author John W. Eaton <jwe@octave.org>
date Thu, 14 May 2015 04:02:45 -0400
parents 998881b6cdef
children 5c2564643de4
files libinterp/parse-tree/lex.ll
diffstat 1 files changed, 7 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/parse-tree/lex.ll	Wed May 13 13:15:31 2015 -0600
+++ b/libinterp/parse-tree/lex.ll	Thu May 14 04:02:45 2015 -0400
@@ -2893,16 +2893,9 @@
 
   std::string tok = yytxt;
 
-  // If tok is a keyword token, then is_keyword_token will set
-  // at_beginning_of_statement.  For example, if tok is an IF
-  // token, then at_beginning_of_statement will be false.
-
-  int kw_token = is_keyword_token (tok);
-
   // If we are expecting a structure element, avoid recognizing
   // keywords and other special names and return STRUCT_ELT, which is
-  // a string that is also a valid identifier.  But first, we have to
-  // decide whether to insert a comma.
+  // a string that is also a valid identifier.
 
   if (looking_at_indirect_ref)
     {
@@ -2913,22 +2906,15 @@
 
       current_input_column += flex_yyleng ();
 
-      if (kw_token)
-        {
-          error ("structure fields may not be keywords");
-          return LEXICAL_ERROR;
-        }
-
-      if (at_beginning_of_statement)
-        {
-          error ("invalid syntax for structure reference");
-
-          return LEXICAL_ERROR;
-        }
-
       return STRUCT_ELT;
     }
 
+  // If tok is a keyword token, then is_keyword_token will set
+  // at_beginning_of_statement.  For example, if tok is an IF
+  // token, then at_beginning_of_statement will be false.
+
+  int kw_token = is_keyword_token (tok);
+
   if (looking_at_function_handle)
     {
       if (kw_token)