]> git.tdb.fi Git - libs/datafile.git/blob - source/error.h
Add error.h
[libs/datafile.git] / source / error.h
1 #ifndef MSP_PARSER_ERROR_H_
2 #define MSP_PARSER_ERROR_H_
3
4 #include <msp/core/error.h>
5
6 namespace Msp {
7 namespace Parser {
8
9 class TypeError: public Exception
10 {
11 public:
12         TypeError(const std::string &w_): Exception(w_) { }
13 };
14
15 class ParseError: public Exception
16 {
17 public:
18         ParseError(const std::string &w_, const std::string &s, unsigned l): Exception(w_), source(s), line(l) { }
19         const std::string &get_source() const { return source; }
20         unsigned          get_line() const    { return line; }
21         ~ParseError() throw() { }
22 private:
23         std::string source;
24         unsigned    line;
25 };
26
27 } // namespace Parser
28 } // namespace Msp
29
30 #endif