diff libinterp/parse-tree/parse.h @ 16157:335041cc657a

optionally use push parser interface * configure.ac (USE_PUSH_PARSER): New config variable. Display setting in config summary. Provide --enable-push-parser option. * oct-parse.yy: Use "%define api.push-pull both" bison option. * parse.h, oct-parse.yy (octave_parser::parser_state): New member variable. (octave_parser::init): Initialize it if USE_PUSH_PARSER is defined. (octave_parser::~octave_parser): Delete it if USE_PUSH_PARSER. (octave_parser::run): Use push parser interface if USE_PUSH_PARSER.
author John W. Eaton <jwe@octave.org>
date Thu, 28 Feb 2013 10:53:27 -0500
parents a57c2c8c8163
children 7eb614760ddb
line wrap: on
line diff
--- a/libinterp/parse-tree/parse.h
+++ b/libinterp/parse-tree/parse.h
@@ -144,15 +144,14 @@
       parsing_subfunctions (false), max_fcn_depth (0),
       curr_fcn_depth (0), primary_fcn_scope (-1),
       curr_class_name (), function_scopes (), primary_fcn_ptr (0),
-      curr_lexer (new lexical_feedback ())
+      curr_lexer (new lexical_feedback ()), parser_state (0)
   {
-    CURR_LEXER = curr_lexer;
+    init ();
   }
 
-  ~octave_parser (void)
-  {
-    delete curr_lexer;
-  }
+  ~octave_parser (void);
+
+  void init (void);
 
   void reset (void)
   {
@@ -389,6 +388,10 @@
   // State of the lexer.
   lexical_feedback *curr_lexer;
 
+  // Internal state of the parser.  Only used if USE_PUSH_PARSER is
+  // defined.
+  void *parser_state;
+
   // For unwind protect.
   static void cleanup (octave_parser *parser) { delete parser; }