ANTLR Support Libraries 2.7.1+
MismatchedTokenException.hpp
Go to the documentation of this file.
1 #ifndef INC_MismatchedTokenException_hpp__
2 #define INC_MismatchedTokenException_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/MismatchedTokenException.hpp#2 $
9  */
10 
11 #include <antlr/config.hpp>
13 #include <antlr/BitSet.hpp>
14 #include <antlr/Token.hpp>
15 #include <antlr/AST.hpp>
16 #include <vector>
17 
18 #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE
19 namespace antlr {
20 #endif
21 
23 public:
25 
28  const char* const* tokenNames_,
29  const int numTokens_,
30  RefAST node_,
31  int lower,
32  int upper_,
33  bool matchNot
34  );
35 
36  // Expected token / not token
38  const char* const* tokenNames_,
39  const int numTokens_,
40  RefAST node_,
41  int expecting_,
42  bool matchNot
43  );
44 
45  // Expected BitSet / not BitSet
47  const char* const* tokenNames_,
48  const int numTokens_,
49  RefAST node_,
50  BitSet set_,
51  bool matchNot
52  );
53 
54  // Expected range / not range
56  const char* const* tokenNames_,
57  const int numTokens_,
58  RefToken token_,
59  int lower,
60  int upper_,
61  bool matchNot,
62  const ANTLR_USE_NAMESPACE(std)string& fileName_
63  );
64 
65  // Expected token / not token
67  const char* const* tokenNames_,
68  const int numTokens_,
69  RefToken token_,
70  int expecting_,
71  bool matchNot,
72  const ANTLR_USE_NAMESPACE(std)string& fileName_
73  );
74 
75  // Expected BitSet / not BitSet
77  const char* const* tokenNames_,
78  const int numTokens_,
79  RefToken token_,
80  BitSet set_,
81  bool matchNot,
82  const ANTLR_USE_NAMESPACE(std)string& fileName_
83  );
85 
89  ANTLR_USE_NAMESPACE(std)string getMessage() const;
90 
91 public:
93  const RefToken token;
95  const RefAST node;
98 
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;
107 #else
108  enum {
109  TOKEN = 1,
110  NOT_TOKEN = 2,
111  RANGE = 3,
112  NOT_RANGE = 4,
113  SET = 5,
114  NOT_SET = 6
115  };
116 #endif
117 
118 public:
121 
124 
126  int upper;
127 
129  BitSet set;
130 
131 private:
133  const char* const* tokenNames;
135  const int numTokens;
137  ANTLR_USE_NAMESPACE(std)string tokenName(int tokenType) const;
138 };
139 
140 #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE
141 }
142 #endif
143 
144 #endif //INC_MismatchedTokenException_hpp__
Definition: ANTLRException.hpp:15
Definition: TokenRefCount.hpp:43
const RefAST node
The offending AST node if tree walking.
Definition: MismatchedTokenException.hpp:95
#define ANTLR_API
Definition: config.hpp:22
int expecting
For TOKEN/NOT_TOKEN and RANGE/NOT_RANGE.
Definition: MismatchedTokenException.hpp:123
const RefToken token
The token that was encountered.
Definition: MismatchedTokenException.hpp:93
std ::string tokenText
taken from node or token object
Definition: MismatchedTokenException.hpp:97
int mismatchType
One of the above.
Definition: MismatchedTokenException.hpp:120
Definition: ASTRefCount.hpp:43
Definition: BitSet.hpp:40
const int numTokens
Max number of tokens in tokenNames.
Definition: MismatchedTokenException.hpp:135
Definition: RecognitionException.hpp:18
Definition: MismatchedTokenException.hpp:22
int upper
For RANGE/NOT_RANGE (expecting is lower bound of range)
Definition: MismatchedTokenException.hpp:126
#define ANTLR_USE_NAMESPACE(_x_)
Definition: config.hpp:18
~MismatchedTokenException()
Definition: MismatchedTokenException.hpp:84
const char *const * tokenNames
Token names array for formatting.
Definition: MismatchedTokenException.hpp:133