diff options
Diffstat (limited to 'Parser.h')
-rw-r--r-- | Parser.h | 24 |
1 files changed, 23 insertions, 1 deletions
@@ -2,16 +2,38 @@ #include <iostream> #include <istream> +#include <exception> +#include <vector> using std::istream; using std::string; +using std::vector; + +class ParserException : public std::exception { +public: + ParserException(const char * fmt, ...); + ~ParserException(); + const char * what(); + +private: + char * error = NULL; +}; class Parser { public: void parse(string input) const; + void parse(istream & input) const; + + /** + * \brief preprocess (filter) line of input + * + * normalize whitespace and remove comments + */ + static size_t filter(char * input); + + void handle_line(string label, vector<string> nodes) const; private: - istream & parse(const Parser & parser, istream & s) const; friend istream & operator << (const Parser & parser, istream & s); friend istream & operator >> (istream & s, const Parser & parser); }; |