Mercurial > hg > octave-nkf
comparison libinterp/parse-tree/parse.h @ 16553:2ed5bc680c71 classdef
maint: periodic merge of default to classdef
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 22 Apr 2013 16:37:53 -0400 |
parents | bde729ba8381 bef822a80ffb |
children | 856cb7cba231 |
comparison
equal
deleted
inserted
replaced
16289:bde729ba8381 | 16553:2ed5bc680c71 |
---|---|
134 | 134 |
135 extern OCTINTERP_API void cleanup_statement_list (tree_statement_list **lst); | 135 extern OCTINTERP_API void cleanup_statement_list (tree_statement_list **lst); |
136 | 136 |
137 // Global access to currently active lexer. | 137 // Global access to currently active lexer. |
138 // FIXME -- to be removed after more parser+lexer refactoring. | 138 // FIXME -- to be removed after more parser+lexer refactoring. |
139 extern octave_lexer *LEXER; | 139 extern octave_base_lexer *LEXER; |
140 | 140 |
141 class | 141 class |
142 octave_base_parser | 142 octave_base_parser |
143 { | 143 { |
144 public: | 144 public: |
145 | 145 |
146 octave_base_parser (octave_lexer& lxr) | 146 octave_base_parser (octave_base_lexer& lxr) |
147 : endfunction_found (false), | 147 : endfunction_found (false), |
148 autoloading (false), fcn_file_from_relative_lookup (false), | 148 autoloading (false), fcn_file_from_relative_lookup (false), |
149 parsing_subfunctions (false), max_fcn_depth (0), | 149 parsing_subfunctions (false), max_fcn_depth (0), |
150 curr_fcn_depth (0), primary_fcn_scope (-1), | 150 curr_fcn_depth (0), primary_fcn_scope (-1), |
151 curr_class_name (), function_scopes (), primary_fcn_ptr (0), | 151 curr_class_name (), function_scopes (), primary_fcn_ptr (0), |
152 classdef_object (0), stmt_list (0), | 152 classdef_object (0), stmt_list (0), |
153 lexer (lxr), parser_state (0) | 153 lexer (lxr) |
154 { | 154 { |
155 init (); | 155 init (); |
156 } | 156 } |
157 | 157 |
158 virtual ~octave_base_parser (void); | 158 ~octave_base_parser (void); |
159 | 159 |
160 void init (void); | 160 void init (void); |
161 | 161 |
162 void reset (void); | 162 void reset (void); |
163 | 163 |
436 | 436 |
437 // Result of parsing input. | 437 // Result of parsing input. |
438 tree_statement_list *stmt_list; | 438 tree_statement_list *stmt_list; |
439 | 439 |
440 // State of the lexer. | 440 // State of the lexer. |
441 octave_lexer& lexer; | 441 octave_base_lexer& lexer; |
442 | |
443 // Internal state of the parser. Only used if USE_PUSH_PARSER is | |
444 // defined. | |
445 void *parser_state; | |
446 | 442 |
447 private: | 443 private: |
448 | 444 |
449 // No copying! | 445 // No copying! |
450 | 446 |
468 | 464 |
469 octave_parser (const std::string& eval_string) | 465 octave_parser (const std::string& eval_string) |
470 : octave_base_parser (*(new octave_lexer (eval_string))) | 466 : octave_base_parser (*(new octave_lexer (eval_string))) |
471 { } | 467 { } |
472 | 468 |
469 octave_parser (octave_lexer& lxr) | |
470 : octave_base_parser (lxr) | |
471 { } | |
472 | |
473 ~octave_parser (void) { } | 473 ~octave_parser (void) { } |
474 | 474 |
475 int run (void); | 475 int run (void); |
476 | 476 |
477 private: | 477 private: |
481 octave_parser (const octave_parser&); | 481 octave_parser (const octave_parser&); |
482 | 482 |
483 octave_parser& operator = (const octave_parser&); | 483 octave_parser& operator = (const octave_parser&); |
484 }; | 484 }; |
485 | 485 |
486 class | |
487 octave_push_parser : public octave_base_parser | |
488 { | |
489 public: | |
490 | |
491 octave_push_parser (void) | |
492 : octave_base_parser (*(new octave_push_lexer ())), parser_state (0) | |
493 { | |
494 init (); | |
495 } | |
496 | |
497 ~octave_push_parser (void); | |
498 | |
499 void init (void); | |
500 | |
501 int run (const std::string& input, bool eof); | |
502 | |
503 private: | |
504 | |
505 // Internal state of the Bison parser. | |
506 void *parser_state; | |
507 | |
508 // No copying! | |
509 | |
510 octave_push_parser (const octave_push_parser&); | |
511 | |
512 octave_push_parser& operator = (const octave_push_parser&); | |
513 }; | |
514 | |
486 #endif | 515 #endif |