1 #ifndef INC_MismatchedTokenException_hpp__
2 #define INC_MismatchedTokenException_hpp__
4 /* ANTLR Translator Generator
5 * Project led by Terence Parr at http://www.jGuru.com
6 * Software rights: http://www.antlr.org/license.html
8 * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/MismatchedTokenException.hpp#2 $
11 #include <antlr/config.hpp>
12 #include <antlr/RecognitionException.hpp>
13 #include <antlr/BitSet.hpp>
14 #include <antlr/Token.hpp>
15 #include <antlr/AST.hpp>
18 #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE
22 class ANTLR_API MismatchedTokenException : public RecognitionException {
24 MismatchedTokenException();
26 /// Expected range / not range
27 MismatchedTokenException(
28 const char* const* tokenNames_,
36 // Expected token / not token
37 MismatchedTokenException(
38 const char* const* tokenNames_,
45 // Expected BitSet / not BitSet
46 MismatchedTokenException(
47 const char* const* tokenNames_,
54 // Expected range / not range
55 MismatchedTokenException(
56 const char* const* tokenNames_,
62 const ANTLR_USE_NAMESPACE(std)string& fileName_
65 // Expected token / not token
66 MismatchedTokenException(
67 const char* const* tokenNames_,
72 const ANTLR_USE_NAMESPACE(std)string& fileName_
75 // Expected BitSet / not BitSet
76 MismatchedTokenException(
77 const char* const* tokenNames_,
82 const ANTLR_USE_NAMESPACE(std)string& fileName_
84 ~MismatchedTokenException() _NOEXCEPT {}
87 * Returns a clean error message (no line number/column information)
89 ANTLR_USE_NAMESPACE(std)string getMessage() const;
92 /// The token that was encountered
94 /// The offending AST node if tree walking
96 /// taken from node or token object
97 ANTLR_USE_NAMESPACE(std)string tokenText;
100 #ifndef NO_STATIC_CONSTS
101 static const int TOKEN = 1;
102 static const int NOT_TOKEN = 2;
103 static const int RANGE = 3;
104 static const int NOT_RANGE = 4;
105 static const int SET = 5;
106 static const int NOT_SET = 6;
122 /// For TOKEN/NOT_TOKEN and RANGE/NOT_RANGE
125 /// For RANGE/NOT_RANGE (expecting is lower bound of range)
132 /// Token names array for formatting
133 const char* const* tokenNames;
134 /// Max number of tokens in tokenNames
136 /// Return token name for tokenType
137 ANTLR_USE_NAMESPACE(std)string tokenName(int tokenType) const;
140 #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE
144 #endif //INC_MismatchedTokenException_hpp__