diff libinterp/parse-tree/lex.ll @ 16193:d7392bf42fd1

use inheritance to simplify initialization in octave_lexer constructor * lex.h (lexical_feedback): New class containing feedback data for the lexer that was previously contained directly in octave_lexer. (octave_lexer): Inherit from lexical_feedback.
author John W. Eaton <jwe@octave.org>
date Tue, 05 Mar 2013 10:19:38 -0500
parents 359d56094efa
children b7ca669af528
line wrap: on
line diff
--- a/libinterp/parse-tree/lex.ll	Mon Mar 04 19:04:27 2013 -0800
+++ b/libinterp/parse-tree/lex.ll	Tue Mar 05 10:19:38 2013 -0500
@@ -1292,6 +1292,26 @@
   char *buf;
 };
 
+lexical_feedback::~lexical_feedback (void)
+{
+  // Clear out the stack of token info used to track line and
+  // column numbers.
+
+  while (! token_stack.empty ())
+    {
+      delete token_stack.top ();
+      token_stack.pop ();
+    }
+}
+
+void
+lexical_feedback::init (void)
+{
+  // The closest paren, brace, or bracket nesting is not an object
+  // index.
+  looking_at_object_index.push_front (false);
+}
+
 void
 octave_lexer::input_buffer::read (void)
 {
@@ -1337,25 +1357,12 @@
 
 octave_lexer::~octave_lexer (void)
 {
-  // Clear out the stack of token info used to track line and
-  // column numbers.
-
-  while (! token_stack.empty ())
-    {
-      delete token_stack.top ();
-      token_stack.pop ();
-    }
-
   yylex_destroy (scanner);
 }
 
 void
 octave_lexer::init (void)
 {
-  // The closest paren, brace, or bracket nesting is not an object
-  // index.
-  looking_at_object_index.push_front (false);
-
   yylex_init (&scanner);
 
   // Make octave_lexer object available through yyextra in