diff libinterp/parse-tree/lex.h @ 26709:17e7d310def8

revamp parsing of superclass identifiers in classdef decls This change is part of the fix for bug #47680. * lex.h, lex.ll (lexical_feedback::parsing_classdef_decl, lexical_feedback::parsing_classdef_superclass): New data members. (lexical_feedback::lexical_feedback): Initialize them. (lexical_feedback::reset): Reset them. (base_lexer::enable_fq_identifier): Delete. (base_lexer::handle_op_internal): Maybe FQ_IDENT_START start state when parsing classdef declaration. (base_lexer::display_start_state): Handle FQ_IDENT_START. Report INPUT_FILE_START for that state instead of INPUT_FILE_BEGIN. * oct-parse.yy (superclass_list): Eliminate mid-rule actions. (opt_superclass_list): Reset m_parsing_classdef_decl and m_parsing_classdef_superclass lexical feedback flags. (classdef_beg): Set m_parsing_classdef_decl lexical feedback flag.
author John W. Eaton <jwe@octave.org>
date Sat, 09 Feb 2019 16:14:01 +0000
parents 775643b5eae4
children eab1c573c4fc
line wrap: on
line diff
--- a/libinterp/parse-tree/lex.h	Sat Feb 09 15:14:24 2019 +0000
+++ b/libinterp/parse-tree/lex.h	Sat Feb 09 16:14:01 2019 +0000
@@ -271,6 +271,8 @@
         m_looking_at_indirect_ref (false),
         m_parsing_class_method (false),
         m_parsing_classdef (false),
+        m_parsing_classdef_decl (false),
+        m_parsing_classdef_superclass (false),
         m_maybe_classdef_get_set_method (false),
         m_parsing_classdef_get_method (false),
         m_parsing_classdef_set_method (false),
@@ -386,6 +388,15 @@
     // true means we are parsing a classdef file
     bool m_parsing_classdef;
 
+    // true means we are parsing the initial classdef declaration
+    // portion of classdef file, from the "classdef" token through the
+    // optional list of superclasses.
+    bool m_parsing_classdef_decl;
+
+    // true means we are parsing the superclass part of a classdef
+    // declaration.
+    bool m_parsing_classdef_superclass;
+
     // true means we are parsing a class method declaration line in a
     // classdef file and can accept a property get or set method name.
     // for example, "get.propertyname" is recognized as a function name.
@@ -751,8 +762,6 @@
 
     int show_token (int tok);
 
-    void enable_fq_identifier (void);
-
   protected:
 
     std::stack<int> start_state_stack;