comparison libinterp/parse-tree/lex.h @ 16194:b7ca669af528

reset lexical_feedback state before starting a new parse * lex.h, lex.cc (bbp_nesting_level::reset): New function. (lexical_feedback::reset, lexical_feedback::reset_token_stack): New functions. (lexical_feedback::~lexical_feedback): Call reset_token_stack to do the job. (octave_lexer::reset): Call lexical_feedback::reset.
author John W. Eaton <jwe@octave.org>
date Tue, 05 Mar 2013 10:19:47 -0500
parents d7392bf42fd1
children b52d2f9294b6
comparison
equal deleted inserted replaced
16193:d7392bf42fd1 16194:b7ca669af528
103 103
104 return *this; 104 return *this;
105 } 105 }
106 106
107 ~bbp_nesting_level (void) { } 107 ~bbp_nesting_level (void) { }
108
109 void reset (void)
110 {
111 while (! context.empty ())
112 context.pop ();
113 }
108 114
109 void bracket (void) { context.push (BRACKET); } 115 void bracket (void) { context.push (BRACKET); }
110 116
111 bool is_bracket (void) 117 bool is_bracket (void)
112 { 118 {
174 } 180 }
175 181
176 ~lexical_feedback (void); 182 ~lexical_feedback (void);
177 183
178 void init (void); 184 void init (void);
179 185
186 void reset (void);
187
180 // true means that we have encountered eof on the input stream. 188 // true means that we have encountered eof on the input stream.
181 bool end_of_input; 189 bool end_of_input;
182 190
183 // true means that we should convert spaces to a comma inside a 191 // true means that we should convert spaces to a comma inside a
184 // matrix definition. 192 // matrix definition.
277 // reset and avoid growing forever just because we are stashing some 285 // reset and avoid growing forever just because we are stashing some
278 // information. 286 // information.
279 std::stack <token*> token_stack; 287 std::stack <token*> token_stack;
280 288
281 private: 289 private:
290
291 void reset_token_stack (void);
282 292
283 // No copying! 293 // No copying!
284 294
285 lexical_feedback (const lexical_feedback&); 295 lexical_feedback (const lexical_feedback&);
286 296