Mercurial > hg > octave-nkf
diff 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 |
line wrap: on
line diff
--- a/libinterp/parse-tree/lex.h +++ b/libinterp/parse-tree/lex.h @@ -485,7 +485,7 @@ void fatal_error (const char *msg); - void lexer_debug (const char *pattern, const char *text); + void lexer_debug (const char *pattern); // Internal state of the flex-generated lexer. void *scanner; @@ -533,6 +533,24 @@ void display_start_state (void) const; + int handle_op (const char *pattern, int tok, bool convert = false, + bool bos = false, bool qit = false); + + int handle_incompatible_op (const char *pattern, int tok, + bool convert = false, bool bos = false, + bool qit = false); + + int handle_op_internal (const char *pattern, int tok, bool convert, + bool bos, bool qit, bool compat); + + int push_token (const std::string& name, int tok); + + int handle_token (int tok); + + int count_token (int tok); + + int show_token (int tok); + // For unwind protect. static void cleanup (octave_lexer *lexer) { delete lexer; }