diff libinterp/parse-tree/lex.ll @ 16230:4bf907906134

use a queue to hold tokens in the lexer * lex.h, lex.ll (lexical_feedback::token_cache): New class. (lexical_feedback::tokens): Rename from token_stack. Declare as token_cache, not std::stack<token *>. Change all uses. (lexical_feedback::reset_token_stack): Delete.
author John W. Eaton <jwe@octave.org>
date Sat, 09 Mar 2013 01:20:23 -0500
parents 7b7b1e4968e8
children 2b15ae55c721
line wrap: on
line diff
--- a/libinterp/parse-tree/lex.ll	Sat Mar 09 00:02:58 2013 -0500
+++ b/libinterp/parse-tree/lex.ll	Sat Mar 09 01:20:23 2013 -0500
@@ -1339,7 +1339,7 @@
 
 lexical_feedback::~lexical_feedback (void)
 {
-  reset_token_stack ();
+  tokens.clear ();
 }
 
 void
@@ -1397,7 +1397,7 @@
 
   nesting_level.reset ();
 
-  reset_token_stack ();
+  tokens.clear ();
 }
 
 static bool
@@ -1446,19 +1446,6 @@
 }
 
 void
-lexical_feedback::reset_token_stack (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
 octave_lexer::input_buffer::fill (const std::string& input, bool eof_arg)
 {
   buffer = input;
@@ -3374,7 +3361,7 @@
 {
   YYSTYPE *lval = yyget_lval (scanner);
   lval->tok_val = tok;
-  token_stack.push (tok);
+  tokens.push (tok);
 }
 
 token *