Mercurial > hg > octave-nkf
changeset 11466:1f64a7b73e98
lex.ll (display_tokens): print token values
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Sun, 09 Jan 2011 14:52:36 -0500 |
parents | fb98284fcc20 |
children | 7aab48b6e903 |
files | src/ChangeLog src/lex.ll |
diffstat | 2 files changed, 32 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2011-01-09 John W. Eaton <jwe@octave.org> + + * lex.ll (display_token): Display token value for NUM, IMAG_NUM, + STRUCT_ELT, NAME, DQ_STRING, and SQ_STRING tokens. + 2011-01-09 John W. Eaton <jwe@octave.org> * lex.h, lex.ll, oct-parse.yy (lexer_flags::parsed_function_name):
--- a/src/lex.ll +++ b/src/lex.ll @@ -3560,13 +3560,34 @@ case MINUS_MINUS: std::cerr << "MINUS_MINUS\n"; break; case POW: std::cerr << "POW\n"; break; case EPOW: std::cerr << "EPOW\n"; break; - case NUM: std::cerr << "NUM\n"; break; - case IMAG_NUM: std::cerr << "IMAG_NUM\n"; break; - case STRUCT_ELT: std::cerr << "STRUCT_ELT\n"; break; - case NAME: std::cerr << "NAME\n"; break; + + case NUM: + case IMAG_NUM: + std::cerr << (tok == NUM ? "NUM" : "IMAG_NUM") + << " [" << yylval.tok_val->number () << "]\n"; + break; + + case STRUCT_ELT: + std::cerr << "STRUCT_ELT [" << yylval.tok_val->text () << "]\n"; break; + + case NAME: + { + symbol_table::symbol_record *sr = yylval.tok_val->sym_rec (); + std::cerr << "NAME"; + if (sr) + std::cerr << " [" << sr->name () << "]"; + std::cerr << "\n"; + } + break; + case END: std::cerr << "END\n"; break; - case DQ_STRING: std::cerr << "DQ_STRING\n"; break; - case SQ_STRING: std::cerr << "SQ_STRING\n"; break; + + case DQ_STRING: + case SQ_STRING: + std::cerr << (tok == DQ_STRING ? "DQ_STRING" : "SQ_STRING") + << " [" << yylval.tok_val->text () << "]\n"; + break; + case FOR: std::cerr << "FOR\n"; break; case WHILE: std::cerr << "WHILE\n"; break; case DO: std::cerr << "DO\n"; break;