Mercurial > hg > octave-nkf
comparison libinterp/parse-tree/lex.h @ 16126:5c885c13bfa3
localize use of yylval.tok_val in lexical_feedback member functions
* lex.h, lex.ll (lexical_feedback::push_token): New function.
(lexical_feedback::current_token): New function.
(lexical_feedback::token_stack): Now private.
* lex.ll (TOK_PUSH_AND_RETURN, BIN_OP_RETURN_INTERNAL,
lexical_feedback::is_keyword_token, lexical_feedback::handle_number,
lexical_feedback::handle_string,
lexical_feedback::handle_superclass_identifier,
lexical_feedback::handle_meta_identifier,
lexical_feedback::handle_identifier, lexical_feedback::display_token):
Use push_token and current_token instead of accessing yylval.tok_val
directly.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 26 Feb 2013 15:13:43 -0500 |
parents | 96a58f197f93 |
children | 210039e91ad6 |
comparison
equal
deleted
inserted
replaced
16125:96a58f197f93 | 16126:5c885c13bfa3 |
---|---|
281 | 281 |
282 void gripe_matlab_incompatible_continuation (void); | 282 void gripe_matlab_incompatible_continuation (void); |
283 | 283 |
284 void gripe_matlab_incompatible_operator (const std::string& op); | 284 void gripe_matlab_incompatible_operator (const std::string& op); |
285 | 285 |
286 void push_token (token *); | |
287 | |
288 token *current_token (void); | |
289 | |
286 void display_token (int tok); | 290 void display_token (int tok); |
287 | 291 |
288 void lexer_debug (const char *pattern, const char *text); | 292 void lexer_debug (const char *pattern, const char *text); |
289 | 293 |
290 // TRUE means that we should convert spaces to a comma inside a | 294 // TRUE means that we should convert spaces to a comma inside a |
381 | 385 |
382 // Is the closest nesting level a square bracket, squiggly brace or | 386 // Is the closest nesting level a square bracket, squiggly brace or |
383 // a paren? | 387 // a paren? |
384 bbp_nesting_level nesting_level; | 388 bbp_nesting_level nesting_level; |
385 | 389 |
390 // For unwind protect. | |
391 static void cleanup (lexical_feedback *lexer) { delete lexer; } | |
392 | |
393 private: | |
394 | |
386 // Stack to hold tokens so that we can delete them when the parser is | 395 // Stack to hold tokens so that we can delete them when the parser is |
387 // reset and avoid growing forever just because we are stashing some | 396 // reset and avoid growing forever just because we are stashing some |
388 // information. | 397 // information. |
389 std::stack <token*> token_stack; | 398 std::stack <token*> token_stack; |
390 | 399 |
391 // For unwind protect. | |
392 static void cleanup (lexical_feedback *lexer) { delete lexer; } | |
393 | |
394 private: | |
395 | |
396 // No copying! | 400 // No copying! |
397 | 401 |
398 lexical_feedback (const lexical_feedback&); | 402 lexical_feedback (const lexical_feedback&); |
399 | 403 |
400 lexical_feedback& operator = (const lexical_feedback&); | 404 lexical_feedback& operator = (const lexical_feedback&); |