Mercurial > hg > octave-nkf
comparison libinterp/parse-tree/lex.h @ 16229:7b7b1e4968e8
use functions instead of token return macros in lexer
* lex.h, lex.ll (DISPLAY_TOK_AND_RETURN, COUNT_TOK_AND_RETURN,
TOK_RETURN, TOK_PUSH_AND_RETURN, BIN_OP_RETURN_INTERNAL,
XBIN_OP_RETURN_INTERNAL, BIN_OP_RETURN, XBIN_OP_RETURN, LEXER_DEBUG):
Delete macros.
(octave_lexer::handle_op, octave_lexer::handle_incompatible_op,
octave_lexer::handle_op_internal, octave_lexer::push_token,
octave_lexer::handle_token, octave_lexer::count_token,
octave_lexer::show_token): New functions. Use them in place of
deleted macros.
(NOT, POW, EPOW): Delete pattern definitions.
({NOT}, {POW}=, {EPOW}=): Split into separate rules for each pattern.
(octave_lexer::handle_end_of_input, octave_lexer::handle_identifier):
Don't use OCTAVE_YYG here.
(octave_lexer::lexer_debug): Delete text argument. Use flex_yytext
instead.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Sat, 09 Mar 2013 00:02:58 -0500 |
parents | e19b1632d7c1 |
children | 4bf907906134 |
comparison
equal
deleted
inserted
replaced
16228:e19b1632d7c1 | 16229:7b7b1e4968e8 |
---|---|
483 | 483 |
484 void display_token (int tok); | 484 void display_token (int tok); |
485 | 485 |
486 void fatal_error (const char *msg); | 486 void fatal_error (const char *msg); |
487 | 487 |
488 void lexer_debug (const char *pattern, const char *text); | 488 void lexer_debug (const char *pattern); |
489 | 489 |
490 // Internal state of the flex-generated lexer. | 490 // Internal state of the flex-generated lexer. |
491 void *scanner; | 491 void *scanner; |
492 | 492 |
493 // Object that reads and buffers input. | 493 // Object that reads and buffers input. |
531 | 531 |
532 int start_state (void) const { return start_state_stack.top (); } | 532 int start_state (void) const { return start_state_stack.top (); } |
533 | 533 |
534 void display_start_state (void) const; | 534 void display_start_state (void) const; |
535 | 535 |
536 int handle_op (const char *pattern, int tok, bool convert = false, | |
537 bool bos = false, bool qit = false); | |
538 | |
539 int handle_incompatible_op (const char *pattern, int tok, | |
540 bool convert = false, bool bos = false, | |
541 bool qit = false); | |
542 | |
543 int handle_op_internal (const char *pattern, int tok, bool convert, | |
544 bool bos, bool qit, bool compat); | |
545 | |
546 int push_token (const std::string& name, int tok); | |
547 | |
548 int handle_token (int tok); | |
549 | |
550 int count_token (int tok); | |
551 | |
552 int show_token (int tok); | |
553 | |
536 // For unwind protect. | 554 // For unwind protect. |
537 static void cleanup (octave_lexer *lexer) { delete lexer; } | 555 static void cleanup (octave_lexer *lexer) { delete lexer; } |
538 | 556 |
539 private: | 557 private: |
540 | 558 |