diff libinterp/parse-tree/lex.ll @ 16101:8d19626b38ae

provide copy contructor and operator = for lexical_feedback class. * lex.h, lex.ll (lexical_feedback::lexical_feedback): Provide copy constructor. Correctly initialize looking_at_anon_fcn_args to false. (lexical_feedback::operator=): New function. (lexical_feedback::init): Simplify. (reset_parser): Assign new lexical_feedback object to global lexer_flags instead of calling init on existing object.
author John W. Eaton <jwe@octave.org>
date Mon, 25 Feb 2013 20:06:44 -0500
parents 6b26e18d1dcb
children 679a54d274d9
line wrap: on
line diff
--- a/libinterp/parse-tree/lex.ll	Mon Feb 25 19:45:46 2013 -0500
+++ b/libinterp/parse-tree/lex.ll	Mon Feb 25 20:06:44 2013 -0500
@@ -1157,7 +1157,7 @@
     help_buf.pop ();
 
   // Reset other flags.
-  lexer_flags.init ();
+  lexer_flags = lexical_feedback ();
 }
 
 static void
@@ -3398,79 +3398,6 @@
   return NAME;
 }
 
-void
-lexical_feedback::init (void)
-{
-  // No need to do comma insert or convert spaces to comma at
-  // beginning of input.
-  convert_spaces_to_comma = true;
-  do_comma_insert = false;
-
-  // Yes, we are at the beginning of a statement.
-  at_beginning_of_statement = true;
-
-  // Not initiallly looking at an anonymous function argument list.
-  looking_at_anon_fcn_args = false;
-
-  // Not parsing a function return, parameter, or declaration list.
-  looking_at_return_list = false;
-  looking_at_parameter_list = false;
-  looking_at_decl_list = false;
-
-  // Not looking at an argument list initializer expression.
-  looking_at_initializer_expression = false;
-
-  // Not parsing a matrix or the left hand side of multi-value
-  // assignment statement.
-  looking_at_matrix_or_assign_lhs = false;
-
-  // Object index not possible until we've seen something.
-  looking_for_object_index = false;
-
-  // Not initially looking at indirect references.
-  looking_at_indirect_ref = false;
-
-  // Not initially parsing a class method.
-  parsing_class_method = false;
-
-  // Not initially defining a class with classdef.
-  maybe_classdef_get_set_method = false;
-  parsing_classdef = false;
-
-  // Quote marks strings intially.
-  quote_is_transpose = false;
-
-  // Not initially defining a matrix list.
-  bracketflag = 0;
-
-  // Not initially defining a cell array list.
-  braceflag = 0;
-
-  // Not initially inside a loop or if statement.
-  looping = 0;
-
-  // Not initially defining a function.
-  defining_func = 0;
-
-  // Not initiallly looking at a function handle.
-  looking_at_function_handle = 0;
-
-  // Not parsing an object index.
-  while (! looking_at_object_index.empty ())
-    looking_at_object_index.pop_front ();
-
-  // Not parsing an object index.
-  while (! parsed_function_name.empty ())
-    parsed_function_name.pop ();
-
-  // The closest paren, brace, or bracket nesting is not an object
-  // index.
-  looking_at_object_index.push_front (false);
-
-  // Set of identifiers that might be local variable names is empty.
-  pending_local_variables.clear ();
-}
-
 bool
 is_keyword (const std::string& s)
 {