comparison 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
comparison
equal deleted inserted replaced
16265:71ee3afedb69 16267:15f55df088e7
33 public: 33 public:
34 34
35 enum token_type 35 enum token_type
36 { 36 {
37 generic_token, 37 generic_token,
38 keyword_token,
38 string_token, 39 string_token,
39 double_token, 40 double_token,
40 ettype_token, 41 ettype_token,
41 sym_rec_token, 42 sym_rec_token,
42 scls_rec_token, 43 scls_rec_token,
60 try_catch_end, 61 try_catch_end,
61 unwind_protect_end 62 unwind_protect_end
62 }; 63 };
63 64
64 token (int tv, int l = -1, int c = -1); 65 token (int tv, int l = -1, int c = -1);
66 token (int tv, bool is_keyword, int l = -1, int c = -1);
65 token (int tv, const std::string& s, int l = -1, int c = -1); 67 token (int tv, const std::string& s, int l = -1, int c = -1);
66 token (int tv, double d, const std::string& s = std::string (), 68 token (int tv, double d, const std::string& s = std::string (),
67 int l = -1, int c = -1); 69 int l = -1, int c = -1);
68 token (int tv, end_tok_type t, int l = -1, int c = -1); 70 token (int tv, end_tok_type t, int l = -1, int c = -1);
69 token (int tv, symbol_table::symbol_record *s, int l = -1, int c = -1); 71 token (int tv, symbol_table::symbol_record *s, int l = -1, int c = -1);
85 bool token_value_is (int tv) const { return tv == tok_val; } 87 bool token_value_is (int tv) const { return tv == tok_val; }
86 88
87 int line (void) const { return line_num; } 89 int line (void) const { return line_num; }
88 int column (void) const { return column_num; } 90 int column (void) const { return column_num; }
89 91
92 bool is_keyword (void) const
93 {
94 return type_tag == keyword_token || type_tag == ettype_token;
95 }
96
90 std::string text (void) const; 97 std::string text (void) const;
91 double number (void) const; 98 double number (void) const;
99 token_type ttype (void) const;
92 end_tok_type ettype (void) const; 100 end_tok_type ettype (void) const;
93 symbol_table::symbol_record *sym_rec (void); 101 symbol_table::symbol_record *sym_rec (void);
94 102
95 symbol_table::symbol_record *method_rec (void); 103 symbol_table::symbol_record *method_rec (void);
96 symbol_table::symbol_record *class_rec (void); 104 symbol_table::symbol_record *class_rec (void);