00001 #ifndef TOKENIZER_CLASS
00002 #define TOKENIZER_CLASS
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include "textual_dll.h"
00019
00020 #include <basis/object_base.h>
00021
00022
00023 class string_table;
00024
00026
00036 class TEXTUAL_CLASS_STYLE tokenizer : public virtual object_base
00037 {
00038 public:
00039 enum constraints { DEFAULT_MAX_BITS = 7 };
00040
00041 tokenizer(int max_bits = DEFAULT_MAX_BITS);
00043
00048 tokenizer(const istring &separator, const istring &assignment,
00049 int max_bits = DEFAULT_MAX_BITS);
00051
00057 tokenizer(const istring &separator, const istring &assignment,
00058 const istring "es, bool nesting = true,
00059 int max_bits = DEFAULT_MAX_BITS);
00061
00067 tokenizer(const tokenizer &to_copy);
00069
00070 virtual ~tokenizer();
00071
00072 IMPLEMENT_CLASS_NAME("tokenizer");
00073
00074 void set_comment_chars(const istring &comments);
00076
00080 tokenizer &operator =(const tokenizer &to_copy);
00082
00083 int symbols() const;
00085
00086 void reset();
00088
00089 const string_table &table() const;
00091 string_table &table();
00093
00094
00095 void parse(const istring &to_tokenize);
00097
00117 istring find(const istring &name) const;
00119
00129 bool exists(const istring &name) const;
00131
00132 istring text_form() const;
00134
00137 void text_form(istring &to_fill) const;
00139
00140
00141
00142 bool add_spaces() const { return _add_spaces; }
00143 void add_spaces(bool add_them) { _add_spaces = add_them; }
00144
00145 bool okay_for_variable_name(char to_check) const;
00147
00149 const istring &assignments() const;
00151 const istring &separators() const;
00153 const istring "es() const;
00155
00156 bool assignment(char to_check) const;
00158
00159 bool separator(char to_check) const;
00161
00162 bool comment_char(char to_check) const;
00164
00165 bool is_eol_a_separator() const;
00167
00168 bool quote_mark(char to_check) const;
00170
00171 private:
00172 string_table *_implementation;
00173 istring *_assignments;
00174 istring *_separators;
00175 istring *_quotes;
00176 bool _nesting;
00177 istring *_comments;
00178 int _comment_number;
00179 bool _add_spaces;
00180 };
00181
00182 #endif
00183