Mercurial > hg > octave-nkf
diff libinterp/parse-tree/lex.ll @ 16118:f8e463523229
move more static lexer helper functions to lexical_feedback class
* lex.h, lex.ll (display_token, lexer_debug): Declare as members of
lexical_feedback class. Change all callers.
(display_state): New argument, STATE.
(lexer_debug): Pass YYSTATE to display_state.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 26 Feb 2013 11:50:41 -0500 |
parents | 771186909285 |
children | b31eb56f4d84 |
line wrap: on
line diff
--- a/libinterp/parse-tree/lex.ll +++ b/libinterp/parse-tree/lex.ll @@ -126,11 +126,11 @@ { \ int tok_val = tok; \ if (Vdisplay_tokens) \ - display_token (tok_val); \ + curr_lexer->display_token (tok_val); \ if (lexer_debug_flag) \ { \ std::cerr << "R: "; \ - display_token (tok_val); \ + curr_lexer->display_token (tok_val); \ std::cerr << std::endl; \ } \ return tok_val; \ @@ -207,7 +207,7 @@ do \ { \ if (lexer_debug_flag) \ - lexer_debug (pattern, yytext); \ + curr_lexer->lexer_debug (pattern, yytext); \ } \ while (0) @@ -226,8 +226,6 @@ static std::string strip_trailing_whitespace (char *s); static int octave_read (char *buf, unsigned int max_size); -static void display_token (int tok); -static void lexer_debug (const char *pattern, const char *text); %} @@ -1425,8 +1423,8 @@ return status; } -static void -display_token (int tok) +void +lexical_feedback::display_token (int tok) { switch (tok) { @@ -1552,11 +1550,11 @@ } static void -display_state (void) +display_state (int state) { std::cerr << "S: "; - switch (YY_START) + switch (state) { case INITIAL: std::cerr << "INITIAL" << std::endl; @@ -1584,12 +1582,12 @@ } } -static void -lexer_debug (const char *pattern, const char *text) +void +lexical_feedback::lexer_debug (const char *pattern, const char *text) { std::cerr << std::endl; - display_state (); + display_state (YY_START); std::cerr << "P: " << pattern << std::endl; std::cerr << "T: " << text << std::endl;