00001 #ifndef INC_TokenStreamRecognitionException_hpp__ 00002 #define INC_TokenStreamRecognitionException_hpp__ 00003 00004 /* ANTLR Translator Generator 00005 * Project led by Terence Parr at http://www.jGuru.com 00006 * Software rights: http://www.antlr.org/license.html 00007 * 00008 * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/TokenStreamRecognitionException.hpp#2 $ 00009 */ 00010 00011 #include <antlr/config.hpp> 00012 #include <antlr/TokenStreamException.hpp> 00013 00014 #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE 00015 namespace antlr { 00016 #endif 00017 00022 class TokenStreamRecognitionException : public TokenStreamException { 00023 public: 00024 TokenStreamRecognitionException(RecognitionException& re) 00025 : TokenStreamException(re.getMessage()) 00026 , recog(re) 00027 { 00028 } 00029 virtual ~TokenStreamRecognitionException() throw() 00030 { 00031 } 00032 virtual ANTLR_USE_NAMESPACE(std)string toString() const 00033 { 00034 return recog.getFileLineColumnString()+getMessage(); 00035 } 00036 00037 virtual ANTLR_USE_NAMESPACE(std)string getFilename() const throw() 00038 { 00039 return recog.getFilename(); 00040 } 00041 virtual int getLine() const throw() 00042 { 00043 return recog.getLine(); 00044 } 00045 virtual int getColumn() const throw() 00046 { 00047 return recog.getColumn(); 00048 } 00049 private: 00050 RecognitionException recog; 00051 }; 00052 00053 #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE 00054 } 00055 #endif 00056 00057 #endif //INC_TokenStreamRecognitionException_hpp__