aboutsummaryrefslogtreecommitdiff
path: root/Parser.h
diff options
context:
space:
mode:
Diffstat (limited to 'Parser.h')
-rw-r--r--Parser.h24
1 files changed, 23 insertions, 1 deletions
diff --git a/Parser.h b/Parser.h
index 58d062f..2124eab 100644
--- a/Parser.h
+++ b/Parser.h
@@ -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);
};