00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00031 #ifndef exceptions_h
00032 #define exceptions_h
00033 
00034 #include <stdexcept>
00035 #include "arts.h"
00036 #include "mystring.h"
00037 
00038 
00039 
00040 class ParseError : public runtime_error {
00041 public:
00042   ParseError( const String& s="",
00043               const String& f="",
00044               Index l = 0,
00045               Index c = 0 ) :
00046     runtime_error(s),
00047     mFile(f),
00048     mLine(l),
00049     mColumn(c) {  }
00050 
00051   virtual ~ParseError() throw() {};
00052 
00053   virtual String file()            const { return mFile; }
00054   virtual Index line()                     const { return mLine; }
00055   virtual Index column()                   const { return mColumn; }
00056 
00057 private:
00059   String mFile;
00061   Index mLine;
00063   Index mColumn;
00064 };
00065 
00066 
00067 class Eot : public ParseError {
00068 public:
00069   Eot( const String& s="",
00070        const String& f="",
00071        Index l = 0,
00072        Index c = 0 ) :
00073     ParseError(s,f,l,c) {  }
00074 };
00075 
00076 class UnexpectedChar : public ParseError {
00077 public:
00078   UnexpectedChar( const String& s="",
00079                   const String& f="",
00080                   Index l = 0,
00081                   Index c = 0 ) :
00082     ParseError(s,f,l,c) {  }
00083 };
00084 
00085 class IllegalLinebreak : public ParseError {
00086 public:
00087   IllegalLinebreak( const String& s="",
00088                     const String& f="",
00089                     Index l = 0,
00090                     Index c = 0 ) :
00091     ParseError(s,f,l,c) {  }
00092 };
00093 
00094 class UnknownMethod : public ParseError {
00095 public:
00096   UnknownMethod( const String& s="",
00097                  const String& f="",
00098                  Index l = 0,
00099                  Index c = 0 ) :
00100     ParseError(s,f,l,c) {  }
00101 };
00102 
00103 class UnknownWsv : public ParseError {
00104 public:
00105   UnknownWsv( const String& s="",
00106               const String& f="",
00107               Index l = 0,
00108               Index c = 0 ) :
00109     ParseError(s,f,l,c) {  }
00110 };
00111 
00112 class WrongWsvGroup : public ParseError {
00113 public:
00114   WrongWsvGroup( const String& s="",
00115                  const String& f="",
00116                  Index l = 0,
00117                  Index c = 0 ) :
00118     ParseError(s,f,l,c) {  }
00119 };
00120 
00121 class UnexpectedKeyword : public ParseError {
00122 public:
00123   UnexpectedKeyword( const String& s="",
00124                      const String& f="",
00125                      Index l = 0,
00126                      Index c = 0 ) :
00127     ParseError(s,f,l,c) {  }
00128 };
00129 
00130 
00131 
00132 
00133 #endif // exceptions_h