diff libinterp/parse-tree/lex.h @ 16164:c5bfdc4c0963

move end_of_input flag from octve_parser class to octave_lexer class * lex.h, lex.ll, parse.h, oct-parse.yy, toplev.cc (octave_lexer::end_of_input): Move data member from octave_parser. Change all uses. * lex.h, lex.ll (octave_lexer::handle_end_of_input): New function. (<<EOF>>): Use it. ({CCHAR}, .): USe it instead of simply returning END_OF_INPUT token. * lex.ll (octave_lexer::xunput): Don't unput EOF.
author John W. Eaton <jwe@octave.org>
date Fri, 01 Mar 2013 07:10:31 -0500
parents 7eb614760ddb
children 359d56094efa
line wrap: on
line diff
--- a/libinterp/parse-tree/lex.h
+++ b/libinterp/parse-tree/lex.h
@@ -154,7 +154,7 @@
   };
 
   octave_lexer (void)
-    : scanner (0), convert_spaces_to_comma (true),
+    : scanner (0), end_of_input (false), convert_spaces_to_comma (true),
       do_comma_insert (false), at_beginning_of_statement (true),
       looking_at_anon_fcn_args (false), looking_at_return_list (false),
       looking_at_parameter_list (false), looking_at_decl_list (false),
@@ -186,6 +186,8 @@
 
   int octave_read (char *buf, unsigned int max_size);
 
+  int handle_end_of_input (void);
+
   char *flex_yytext (void);
 
   int flex_yyleng (void);
@@ -276,6 +278,9 @@
   // Internal state of the flex-generated lexer.
   void *scanner;
 
+  // TRUE means that we have encountered EOF on the input stream.
+  bool end_of_input;
+
   // TRUE means that we should convert spaces to a comma inside a
   // matrix definition.
   bool convert_spaces_to_comma;