changeset 29727:05d7b7e64811

eliminate unused lexical feedback flag * lex.h, lex.ll, (lexical_feedback::m_looking_at_initializer_expression): Delete useless member variable. It was set but never used otherwise. * parse.yy (decl_param_init): Delete useless non-terminal. Its only purpose was to set lexer.m_looking_at_initializer_expression. (decl2, attr, class_property): Don't use decl_param_init. Adjust semantic values. Don't set lexer.m_looking_at_initializer_expression.
author John W. Eaton <jwe@octave.org>
date Fri, 04 Jun 2021 08:19:25 -0400
parents be335be5c0bc
children 287fde79ffa2
files libinterp/parse-tree/lex.h libinterp/parse-tree/lex.ll libinterp/parse-tree/oct-parse.yy
diffstat 3 files changed, 7 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/parse-tree/lex.h	Fri Jun 04 10:35:32 2021 +0200
+++ b/libinterp/parse-tree/lex.h	Fri Jun 04 08:19:25 2021 -0400
@@ -272,7 +272,6 @@
         m_looking_at_return_list (false),
         m_looking_at_parameter_list (false),
         m_looking_at_decl_list (false),
-        m_looking_at_initializer_expression (false),
         m_looking_at_matrix_or_assign_lhs (false),
         m_looking_for_object_index (false),
         m_looking_at_indirect_ref (false),
@@ -377,10 +376,6 @@
     // persistent).
     bool m_looking_at_decl_list;
 
-    // true means we are looking at the initializer expression for a
-    // parameter list element.
-    bool m_looking_at_initializer_expression;
-
     // true means we're parsing a matrix or the left hand side of
     // multi-value assignment statement.
     bool m_looking_at_matrix_or_assign_lhs;
--- a/libinterp/parse-tree/lex.ll	Fri Jun 04 10:35:32 2021 +0200
+++ b/libinterp/parse-tree/lex.ll	Fri Jun 04 08:19:25 2021 -0400
@@ -2235,7 +2235,6 @@
     m_looking_at_return_list = false;
     m_looking_at_parameter_list = false;
     m_looking_at_decl_list = false;
-    m_looking_at_initializer_expression = false;
     m_looking_at_matrix_or_assign_lhs = false;
     m_looking_for_object_index = false;
     m_looking_at_indirect_ref = false;
--- a/libinterp/parse-tree/oct-parse.yy	Fri Jun 04 10:35:32 2021 +0200
+++ b/libinterp/parse-tree/oct-parse.yy	Fri Jun 04 08:19:25 2021 -0400
@@ -243,7 +243,7 @@
 // %token VARARGIN VARARGOUT
 
 // Nonterminals we construct.
-%type <dummy_type> indirect_ref_op decl_param_init
+%type <dummy_type> indirect_ref_op
 %type <dummy_type> push_fcn_symtab push_script_symtab begin_file
 %type <dummy_type> param_list_beg param_list_end stmt_begin anon_fcn_begin
 %type <dummy_type> parsing_local_fcns parse_error at_first_executable_stmt
@@ -1129,20 +1129,13 @@
                   }
                 ;
 
-decl_param_init : // empty
-                  {
-                    $$ = 0;
-                    lexer.m_looking_at_initializer_expression = true;
-                  }
-
 decl2           : identifier
                   { $$ = new octave::tree_decl_elt ($1); }
-                | identifier '=' decl_param_init expression
+                | identifier '=' expression
                   {
                     OCTAVE_YYUSE ($2);
 
-                    lexer.m_looking_at_initializer_expression = false;
-                    $$ = new octave::tree_decl_elt ($1, $4);
+                    $$ = new octave::tree_decl_elt ($1, $3);
                   }
                 ;
 
@@ -2000,12 +1993,11 @@
 
 attr            : identifier
                   { $$ = new octave::tree_classdef_attribute ($1); }
-                | identifier '=' decl_param_init expression
+                | identifier '=' expression
                   {
                     OCTAVE_YYUSE ($2);
 
-                    lexer.m_looking_at_initializer_expression = false;
-                    $$ = new octave::tree_classdef_attribute ($1, $4);
+                    $$ = new octave::tree_classdef_attribute ($1, $3);
                   }
                 | EXPR_NOT identifier
                   {
@@ -2168,13 +2160,11 @@
                   {
                     $$ = new octave::tree_classdef_property ($2, $1);
                   }
-                | stash_comment identifier '=' decl_param_init expression
+                | stash_comment identifier '=' expression
                   {
                     OCTAVE_YYUSE ($3);
 
-                    lexer.m_looking_at_initializer_expression = false;
-
-                    $$ = new octave::tree_classdef_property ($2, $5, $1);
+                    $$ = new octave::tree_classdef_property ($2, $4, $1);
                   }
                 ;