comparison libinterp/parse-tree/token.h @ 16256:b28062b977fd classdef

maint: periodic merge of default to classdef
author John W. Eaton <jwe@octave.org>
date Mon, 11 Mar 2013 14:12:58 -0400
parents 0259254a3ccc 12bf6a3f8c45
children 5c32368509a2
comparison
equal deleted inserted replaced
16254:b8a2df776118 16256:b28062b977fd
59 while_end, 59 while_end,
60 try_catch_end, 60 try_catch_end,
61 unwind_protect_end 61 unwind_protect_end
62 }; 62 };
63 63
64 token (int l = -1, int c = -1); 64 token (int tv, int l = -1, int c = -1);
65 token (const std::string& s, int l = -1, int c = -1); 65 token (int tv, const std::string& s, int l = -1, int c = -1);
66 token (double d, const std::string& s = std::string (), 66 token (int tv, double d, const std::string& s = std::string (),
67 int l = -1, int c = -1); 67 int l = -1, int c = -1);
68 token (end_tok_type t, int l = -1, int c = -1); 68 token (int tv, end_tok_type t, int l = -1, int c = -1);
69 token (symbol_table::symbol_record *s, int l = -1, int c = -1); 69 token (int tv, symbol_table::symbol_record *s, int l = -1, int c = -1);
70 token (const std::string& pkg, const std::string& cls, 70 token (int tv, const std::string& pkg, const std::string& cls,
71 int l = -1, int c = -1); 71 int l = -1, int c = -1);
72 token (const std::string& mth, const std::string& pkg, 72 token (int tv, const std::string& mth, const std::string& pkg,
73 const std::string& cls, int l = -1, int c = -1); 73 const std::string& cls, int l = -1, int c = -1);
74 74
75 ~token (void); 75 ~token (void);
76 76
77 int line (void) { return line_num; } 77 void mark_trailing_space (void) { tspc = true; }
78 int column (void) { return column_num; } 78 bool space_follows_token (void) const { return tspc; }
79 79
80 std::string text (void); 80 int token_value (void) const { return tok_val; }
81 double number (void); 81 bool token_value_is (int tv) const { return tv == tok_val; }
82 end_tok_type ettype (void); 82
83 int line (void) const { return line_num; }
84 int column (void) const { return column_num; }
85
86 std::string text (void) const;
87 double number (void) const;
88 end_tok_type ettype (void) const;
83 symbol_table::symbol_record *sym_rec (void); 89 symbol_table::symbol_record *sym_rec (void);
84 90
85 std::string superclass_method_name (void); 91 std::string superclass_method_name (void);
86 std::string superclass_package_name (void); 92 std::string superclass_package_name (void);
87 std::string superclass_class_name (void); 93 std::string superclass_class_name (void);
97 103
98 token (const token& tok); 104 token (const token& tok);
99 105
100 token& operator = (const token& tok); 106 token& operator = (const token& tok);
101 107
108 bool tspc;
102 int line_num; 109 int line_num;
103 int column_num; 110 int column_num;
111 int tok_val;
104 token_type type_tag; 112 token_type type_tag;
105 union 113 union
106 { 114 {
107 std::string *str; 115 std::string *str;
108 double num; 116 double num;