Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #if !defined (octave_token_h)
00024 #define octave_token_h 1
00025
00026 #include <string>
00027
00028 class
00029 token
00030 {
00031 public:
00032
00033 enum token_type
00034 {
00035 generic_token,
00036 string_token,
00037 double_token,
00038 ettype_token,
00039 sym_rec_token,
00040 scls_rec_token,
00041 meta_rec_token
00042 };
00043
00044 enum end_tok_type
00045 {
00046 simple_end,
00047 classdef_end,
00048 events_end,
00049 for_end,
00050 function_end,
00051 if_end,
00052 methods_end,
00053 properties_end,
00054 switch_end,
00055 while_end,
00056 try_catch_end,
00057 unwind_protect_end
00058 };
00059
00060 token (int l = -1, int c = -1);
00061 token (const std::string& s, int l = -1, int c = -1);
00062 token (double d, const std::string& s = std::string (),
00063 int l = -1, int c = -1);
00064 token (end_tok_type t, int l = -1, int c = -1);
00065 token (symbol_table::symbol_record *s, int l = -1, int c = -1);
00066 token (symbol_table::symbol_record *cls,
00067 symbol_table::symbol_record *pkg, int l = -1, int c = -1);
00068 token (symbol_table::symbol_record *mth,
00069 symbol_table::symbol_record *cls,
00070 symbol_table::symbol_record *pkg, int l = -1, int c = -1);
00071
00072 ~token (void);
00073
00074 int line (void) { return line_num; }
00075 int column (void) { return column_num; }
00076
00077 std::string text (void);
00078 double number (void);
00079 end_tok_type ettype (void);
00080 symbol_table::symbol_record *sym_rec (void);
00081
00082 symbol_table::symbol_record *method_rec (void);
00083 symbol_table::symbol_record *class_rec (void);
00084 symbol_table::symbol_record *package_rec (void);
00085
00086 symbol_table::symbol_record *meta_class_rec (void);
00087 symbol_table::symbol_record *meta_package_rec (void);
00088
00089 std::string text_rep (void);
00090
00091 private:
00092
00093
00094
00095 token (const token& tok);
00096
00097 token& operator = (const token& tok);
00098
00099 int line_num;
00100 int column_num;
00101 token_type type_tag;
00102 union
00103 {
00104 std::string *str;
00105 double num;
00106 end_tok_type et;
00107 symbol_table::symbol_record *sr;
00108 struct
00109 {
00110 symbol_table::symbol_record *mr;
00111 symbol_table::symbol_record *cr;
00112 symbol_table::symbol_record *pr;
00113 } sc;
00114 struct
00115 {
00116 symbol_table::symbol_record *cr;
00117 symbol_table::symbol_record *pr;
00118 } mc;
00119 };
00120 std::string orig_text;
00121 };
00122
00123 #endif