diff libinterp/parse-tree/oct-parse.yy @ 16102:679a54d274d9

move global parser_end_of_input variable to lexical_feedback class * lex.h, lex.ll (parser_end_of_input): Move global variable to lexical_feedback class. Change all uses. (reset_parser): Don't reset parser_end_of_input here. * oct-parse.yy (eval_string, parse_fcn_file): Add lexer_flags object to unwind_protect stack. Don't protect parser_end_of_input.
author John W. Eaton <jwe@octave.org>
date Mon, 25 Feb 2013 20:26:52 -0500
parents 2f4fa62089b3
children 6434f70f0ee0
line wrap: on
line diff
--- a/libinterp/parse-tree/oct-parse.yy	Mon Feb 25 20:06:44 2013 -0500
+++ b/libinterp/parse-tree/oct-parse.yy	Mon Feb 25 20:26:52 2013 -0500
@@ -562,7 +562,7 @@
                   { $$ = 0; }
                 | END_OF_INPUT
                   {
-                    parser_end_of_input = 1;
+                    lexer_flags.parser_end_of_input = 1;
                     $$ = 0;
                   }
                 | simple_list
@@ -3517,16 +3517,17 @@
         {
           std::string file_type;
 
+          frame.protect_var (lexer_flags);
+
           frame.protect_var (get_input_from_eval_string);
-          frame.protect_var (parser_end_of_input);
           frame.protect_var (reading_fcn_file);
           frame.protect_var (reading_script_file);
           frame.protect_var (reading_classdef_file);
           frame.protect_var (Vecho_executing_commands);
 
+          lexer_flags = lexical_feedback ();
 
           get_input_from_eval_string = false;
-          parser_end_of_input = false;
 
           if (! force_script && looking_at_function_keyword (ffile))
             {
@@ -4312,10 +4313,11 @@
 
   unwind_protect frame;
 
+  frame.protect_var (lexer_flags);
+
   frame.protect_var (input_line_number);
   frame.protect_var (current_input_column);
   frame.protect_var (get_input_from_eval_string);
-  frame.protect_var (parser_end_of_input);
   frame.protect_var (line_editing);
   frame.protect_var (current_eval_string);
   frame.protect_var (current_function_depth);
@@ -4327,10 +4329,11 @@
   frame.protect_var (reading_script_file);
   frame.protect_var (reading_classdef_file);
 
+  lexer_flags = lexical_feedback ();
+
   input_line_number = 1;
   current_input_column = 1;
   get_input_from_eval_string = true;
-  parser_end_of_input = false;
   line_editing = false;
   current_function_depth = 0;
   function_scopes.clear ();
@@ -4427,7 +4430,7 @@
                   || tree_continue_command::continuing)
                 break;
             }
-          else if (parser_end_of_input)
+          else if (lexer_flags.parser_end_of_input)
             break;
         }
     }