diff libinterp/parse-tree/parse.h @ 16294:0925d1f6875e

push parser/lexer interface * lex.h, lex.ll (octave_push_lexer): New class. (octave_base_lexer:is_push_lexer, octave_base_lexer::at_end_of_file, octave_base_lexer::at_end_of_buffer): New functions. (.): Handle special character (ASCII 0x01) that octave_push_lexer::fill_flex_buffer returns for an end-of-buffer condition. * parse.h, oct-parse.in.yy (octave_push_parser): New class. (octave_base_parser::parser_state): Move to octave_push_parser class. (octave_base_parser::~octave_base_parser, octave_base_parser::init): Delete special case for push parser. * configure.ac (--enable-push-parser): Delete option handling. Both push and pull parser interfaces will always be defined.
author John W. Eaton <jwe@octave.org>
date Wed, 13 Mar 2013 03:19:35 -0400
parents 57e87ddfee14
children bef822a80ffb
line wrap: on
line diff
--- a/libinterp/parse-tree/parse.h	Wed Mar 13 02:46:56 2013 -0400
+++ b/libinterp/parse-tree/parse.h	Wed Mar 13 03:19:35 2013 -0400
@@ -137,7 +137,7 @@
       curr_fcn_depth (0), primary_fcn_scope (-1),
       curr_class_name (), function_scopes (), primary_fcn_ptr (0),
       stmt_list (0),
-      lexer (lxr), parser_state (0)
+      lexer (lxr)
   {
     init ();
   }
@@ -383,10 +383,6 @@
   // State of the lexer.
   octave_base_lexer& lexer;
 
-  // Internal state of the parser.  Only used if USE_PUSH_PARSER is
-  // defined.
-  void *parser_state;
-
 private:
 
   // No copying!
@@ -426,4 +422,33 @@
   octave_parser& operator = (const octave_parser&);
 };
 
+class
+octave_push_parser : public octave_base_parser
+{
+public:
+
+  octave_push_parser (void)
+    : octave_base_parser (*(new octave_push_lexer ())), parser_state (0)
+  {
+    init ();
+  }
+
+  ~octave_push_parser (void);
+
+  void init (void);
+
+  int run (const std::string& input, bool eof);
+
+private:
+
+  // Internal state of the Bison parser.
+  void *parser_state;
+
+  // No copying!
+
+  octave_push_parser (const octave_push_parser&);
+
+  octave_push_parser& operator = (const octave_push_parser&);
+};
+
 #endif