Mercurial > hg > octave-nkf
diff libinterp/parse-tree/token.h @ 16267:15f55df088e7
6/10 commits reworking the lexer
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 11 Mar 2013 14:30:57 -0400 |
parents | db7f07b22b9b |
children | dbbef00202ff 11115c237231 |
line wrap: on
line diff
--- a/libinterp/parse-tree/token.h +++ b/libinterp/parse-tree/token.h @@ -35,6 +35,7 @@ enum token_type { generic_token, + keyword_token, string_token, double_token, ettype_token, @@ -62,6 +63,7 @@ }; token (int tv, int l = -1, int c = -1); + token (int tv, bool is_keyword, int l = -1, int c = -1); token (int tv, const std::string& s, int l = -1, int c = -1); token (int tv, double d, const std::string& s = std::string (), int l = -1, int c = -1); @@ -87,8 +89,14 @@ int line (void) const { return line_num; } int column (void) const { return column_num; } + bool is_keyword (void) const + { + return type_tag == keyword_token || type_tag == ettype_token; + } + std::string text (void) const; double number (void) const; + token_type ttype (void) const; end_tok_type ettype (void) const; symbol_table::symbol_record *sym_rec (void);