Mercurial > hg > octave-nkf
comparison libinterp/parse-tree/lex.h @ 16255:12bf6a3f8c45
store more info in token value class
* token.h, token.cc: Store token ID and trailing space info
* lex.h, lex.ll (lexical_feedback::token_cache): Handle storing and
retrieving extra info in the lexer.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 11 Mar 2013 14:08:50 -0400 |
parents | a89cf57ba3a5 |
children | b28062b977fd db7f07b22b9b |
comparison
equal
deleted
inserted
replaced
16253:a89cf57ba3a5 | 16255:12bf6a3f8c45 |
---|---|
186 buffer.pop_back (); | 186 buffer.pop_back (); |
187 } | 187 } |
188 } | 188 } |
189 | 189 |
190 // Direct access. | 190 // Direct access. |
191 token *at (size_t n) { return buffer.at (n); } | 191 token *at (size_t n) |
192 const token *at (size_t n) const { return buffer.at (n); } | 192 { |
193 return empty () ? 0 : buffer.at (n); | |
194 } | |
195 | |
196 const token *at (size_t n) const | |
197 { | |
198 return empty () ? 0 : buffer.at (n); | |
199 } | |
193 | 200 |
194 // Most recently pushed. | 201 // Most recently pushed. |
195 token *front (void) { return buffer.front (); } | 202 token *front (void) |
196 const token *front (void) const { return buffer.front (); } | 203 { |
197 | 204 return empty () ? 0 : buffer.front (); |
198 token *back (void) { return buffer.back (); } | 205 } |
199 const token *back (void) const { return buffer.back (); } | 206 |
207 const token *front (void) const | |
208 { | |
209 return empty () ? 0 : buffer.front (); | |
210 } | |
211 | |
212 token *back (void) | |
213 { | |
214 return empty () ? 0 : buffer.back (); | |
215 } | |
216 | |
217 const token *back (void) const | |
218 { | |
219 return empty () ? 0 : buffer.back (); | |
220 } | |
200 | 221 |
201 // Number of elements currently in the buffer, max of sz. | 222 // Number of elements currently in the buffer, max of sz. |
202 size_t size (void) const { return buffer.size (); } | 223 size_t size (void) const { return buffer.size (); } |
203 | 224 |
204 bool empty (void) const { return buffer.empty (); } | 225 bool empty (void) const { return buffer.empty (); } |
251 | 272 |
252 void init (void); | 273 void init (void); |
253 | 274 |
254 void reset (void); | 275 void reset (void); |
255 | 276 |
277 int previous_token_value (void) const; | |
278 | |
279 bool previous_token_value_is (int tok_val) const; | |
280 | |
281 void mark_previous_token_trailing_space (void); | |
282 | |
283 bool space_follows_previous_token (void) const; | |
284 | |
256 // true means that we have encountered eof on the input stream. | 285 // true means that we have encountered eof on the input stream. |
257 bool end_of_input; | 286 bool end_of_input; |
258 | 287 |
259 // true means that we should convert spaces to a comma inside a | 288 // true means that we should convert spaces to a comma inside a |
260 // matrix definition. | 289 // matrix definition. |