7 #ifndef CNOID_UTIL_EASYSCANNER_H_INCLUDED
8 #define CNOID_UTIL_EASYSCANNER_H_INCLUDED
13 #include <boost/shared_ptr.hpp>
34 std::string getFullMessage();
38 T_NONE = 0, T_SPACE, T_ALPHABET, T_INTEGER, T_DOUBLE,
T_WORD,
60 SymbolMap::iterator p = symbols->find(symbol);
61 return (p != symbols->end()) ? p->second : 0;
65 void setCommentChar(
char cc);
67 void setLineOriented(
bool on);
68 void setQuoteChar(
char qc);
69 void setWhiteSpaceChar(
char ws);
71 void loadFile(
const std::string& filename);
73 void setText(
const char* text,
int len);
75 void setLineNumberOffset(
int offset);
78 defaultErrorMessage = message;
90 bool readChar(
int chara);
108 return readString0(delimiterChar);
111 bool readString(
const char* str);
114 return readString(str.c_str());
117 bool readQuotedString(
bool allowNoQuotedWord =
false);
119 bool readUnquotedTextBlock();
122 bool readSymbol(
int id);
126 return (*text ==
'\0');
137 return readLF0() ?
true : (*text ==
'\0');
144 bool skipBlankLines();
148 void throwException(
const char* message);
149 void throwException(
const std::string& message);
156 if(!readInt()) throwException(message);
164 if(!readDouble()) throwException(message);
173 throwException(message);
180 if(!readChar(chara)) throwException(message);
187 if(!readWord()) throwException(message);
196 if(!readString()) throwException(message);
201 if(!readQuotedString()) throwException(message);
209 if(!readSymbol()) throwException(message);
216 if(!readLF()) throwException(message);
220 if(!readLFEOF()) throwException(message);
238 bool extractQuotedString();
240 inline void skipToLineEnd();
243 bool readString0(
const int delimiterChar);
248 int lineNumberOffset;
253 std::vector<int> whiteSpaceChars;