1 /* ANTLR Translator Generator
2 * Project led by Terence Parr at http://www.jGuru.com
3 * Software rights: http://www.antlr.org/license.html
5 * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/src/RecognitionException.cpp#2 $
8 #include "antlr/RecognitionException.hpp"
9 #include "antlr/String.hpp"
11 #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE
15 RecognitionException::RecognitionException()
16 : ANTLRException("parsing error")
22 RecognitionException::RecognitionException(const ANTLR_USE_NAMESPACE(std
)string
& s
)
29 RecognitionException::RecognitionException(const ANTLR_USE_NAMESPACE(std
)string
& s
,
30 const ANTLR_USE_NAMESPACE(std
)string
& fileName_
,
31 int line_
,int column_
)
39 ANTLR_USE_NAMESPACE(std
)string
RecognitionException::getFileLineColumnString() const
41 ANTLR_USE_NAMESPACE(std
)string fileLineColumnString
;
43 if ( fileName
.length() > 0 )
44 fileLineColumnString
= fileName
+ ":";
48 if ( fileName
.length() == 0 )
49 fileLineColumnString
= fileLineColumnString
+ "line ";
51 fileLineColumnString
= fileLineColumnString
+ line
;
54 fileLineColumnString
= fileLineColumnString
+ ":" + column
;
56 fileLineColumnString
= fileLineColumnString
+ ":";
59 fileLineColumnString
= fileLineColumnString
+ " ";
61 return fileLineColumnString
;
64 ANTLR_USE_NAMESPACE(std
)string
RecognitionException::toString() const
66 return getFileLineColumnString()+getMessage();
69 #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE