1 |
#ifndef INC_RecognitionException_hpp__ |
2 |
# define INC_RecognitionException_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$ |
9 |
*/ |
10 |
|
11 |
# include <antlr/config.hpp> |
12 |
# include <antlr/ANTLRException.hpp> |
13 |
|
14 |
# ifdef ANTLR_CXX_SUPPORTS_NAMESPACE |
15 |
namespace antlr |
16 |
{ |
17 |
# endif |
18 |
class ANTLR_API RecognitionException : public ANTLRException |
19 |
{ |
20 |
public: |
21 |
RecognitionException(); |
22 |
RecognitionException(const ANTLR_USE_NAMESPACE(std)string& s); |
23 |
RecognitionException(const ANTLR_USE_NAMESPACE(std)string& s, |
24 |
const ANTLR_USE_NAMESPACE(std)string& fileName, |
25 |
int line, int column ); |
26 |
|
27 |
virtual ~RecognitionException() throw() |
28 |
{ |
29 |
} |
30 |
|
31 |
/// Return file where mishap occurred. |
32 |
virtual ANTLR_USE_NAMESPACE(std)string getFilename() const throw() |
33 |
{ |
34 |
return fileName; |
35 |
} |
36 |
/** |
37 |
* @return the line number that this exception happened on. |
38 |
*/ |
39 |
virtual int getLine() const throw() |
40 |
{ |
41 |
return line; |
42 |
} |
43 |
/** |
44 |
* @return the column number that this exception happened on. |
45 |
*/ |
46 |
virtual int getColumn() const throw() |
47 |
{ |
48 |
return column; |
49 |
} |
50 |
|
51 |
/// Return complete error message with line/column number info (if present) |
52 |
virtual ANTLR_USE_NAMESPACE(std)string toString() const; |
53 |
|
54 |
/// See what file/line/column info is present and return it as a string |
55 |
virtual ANTLR_USE_NAMESPACE(std)string getFileLineColumnString() const; |
56 |
protected: |
57 |
ANTLR_USE_NAMESPACE(std)string fileName; // not used by treeparsers |
58 |
int line; // not used by treeparsers |
59 |
int column; // not used by treeparsers |
60 |
}; |
61 |
|
62 |
# ifdef ANTLR_CXX_SUPPORTS_NAMESPACE |
63 |
} |
64 |
# endif |
65 |
|
66 |
#endif //INC_RecognitionException_hpp__ |