1#ifndef INC_TokenStreamRecognitionException_hpp__ 2#define INC_TokenStreamRecognitionException_hpp__ 3 4/* ANTLR Translator Generator 5 * Project led by Terence Parr at http://www.jGuru.com 6 * Software rights: http://www.antlr.org/license.html 7 * 8 * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/TokenStreamRecognitionException.hpp#2 $ 9 */ 10 11#include <antlr/config.hpp> 12#include <antlr/TokenStreamException.hpp> 13 14#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE 15namespace antlr { 16#endif 17 18/** Exception thrown from generated lexers when there's no default error 19 * handler specified. 20 * @see TokenStream 21 */ 22class TokenStreamRecognitionException : public TokenStreamException { 23public: 24 TokenStreamRecognitionException(RecognitionException& re) 25 : TokenStreamException(re.getMessage()) 26 , recog(re) 27 { 28 } 29 virtual ~TokenStreamRecognitionException() throw() 30 { 31 } 32 virtual ANTLR_USE_NAMESPACE(std)string toString() const 33 { 34 return recog.getFileLineColumnString()+getMessage(); 35 } 36 37 virtual ANTLR_USE_NAMESPACE(std)string getFilename() const throw() 38 { 39 return recog.getFilename(); 40 } 41 virtual int getLine() const throw() 42 { 43 return recog.getLine(); 44 } 45 virtual int getColumn() const throw() 46 { 47 return recog.getColumn(); 48 } 49private: 50 RecognitionException recog; 51}; 52 53#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE 54} 55#endif 56 57#endif //INC_TokenStreamRecognitionException_hpp__ 58