00001 /* 00002 ClanGUI, copyrights by various people. Have a look in the CREDITS file. 00003 00004 This sourcecode is distributed using the Library GNU Public Licence, 00005 version 2 or (at your option) any later version. Please read LICENSE 00006 for details. 00007 */ 00008 00009 #ifndef header_component_tokenizer 00010 #define header_component_tokenizer 00011 00012 #include <deque> 00013 #include <string> 00014 00015 class CL_InputSource; 00016 class CL_ComponentTokenizer 00017 { 00018 public: 00019 CL_ComponentTokenizer(const std::string &data, const std::string &filename); 00020 ~CL_ComponentTokenizer(); 00021 00022 bool is_space(char c); 00023 bool is_operator(char c); 00024 bool is_remark(char c, int position); 00025 std::string get_next_token(int *offset=NULL); 00026 std::string peek_next_token(int *offset=NULL); 00027 void pop_to_peek(); 00028 std::string write_error(std::string err_msg); 00029 00030 private: 00031 class CL_Token 00032 { 00033 public: 00034 CL_Token(std::string t, int o, int l) : token(t), offset(o), line(l) { ; } 00035 std::string token; 00036 int offset; 00037 int line; 00038 }; 00039 std::deque<CL_Token> tokens; 00040 00041 int peek_pos; 00042 int last_line; 00043 bool in_remark; 00044 00045 char *data; 00046 int total_size; 00047 std::string string_data; 00048 std::string filename; 00049 00050 void tokenize(); 00051 }; 00052 00053 #endif
1.2.6 written by Dimitri van Heesch,
© 1997-2001