ANTLR Support Libraries 2.7.1+
MismatchedCharException.hpp
Go to the documentation of this file.
1 #ifndef INC_MismatchedCharException_hpp__
2 #define INC_MismatchedCharException_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/MismatchedCharException.hpp#2 $
9  */
10 
11 #include <antlr/config.hpp>
13 #include <antlr/BitSet.hpp>
14 
15 #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE
16 namespace antlr {
17 #endif
18 
19 class CharScanner;
20 
22 public:
23  // Types of chars
24 #ifndef NO_STATIC_CONSTS
25  static const int CHAR = 1;
26  static const int NOT_CHAR = 2;
27  static const int RANGE = 3;
28  static const int NOT_RANGE = 4;
29  static const int SET = 5;
30  static const int NOT_SET = 6;
31 #else
32  enum {
33  CHAR = 1,
34  NOT_CHAR = 2,
35  RANGE = 3,
36  NOT_RANGE = 4,
37  SET = 5,
38  NOT_SET = 6
39  };
40 #endif
41 
42 public:
43  // One of the above
45 
46  // what was found on the input stream
47  int foundChar;
48 
49  // For CHAR/NOT_CHAR and RANGE/NOT_RANGE
50  int expecting;
51 
52  // For RANGE/NOT_RANGE (expecting is lower bound of range)
53  int upper;
54 
55  // For SET/NOT_SET
56  BitSet set;
57 
58 protected:
59  // who knows...they may want to ask scanner questions
61 
62 public:
64 
65  // Expected range / not range
67  int c,
68  int lower,
69  int upper_,
70  bool matchNot,
71  CharScanner* scanner_
72  );
73 
74  // Expected token / not token
76  int c,
77  int expecting_,
78  bool matchNot,
79  CharScanner* scanner_
80  );
81 
82  // Expected BitSet / not BitSet
84  int c,
85  BitSet set_,
86  bool matchNot,
87  CharScanner* scanner_
88  );
89 
91 
95  ANTLR_USE_NAMESPACE(std)string getMessage() const;
96 };
97 
98 #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE
99 }
100 #endif
101 
102 #endif //INC_MismatchedCharException_hpp__
Definition: ANTLRException.hpp:15
int expecting
Definition: MismatchedCharException.hpp:50
#define ANTLR_API
Definition: config.hpp:22
Definition: CharScanner.hpp:88
CharScanner * scanner
Definition: MismatchedCharException.hpp:60
Definition: MismatchedCharException.hpp:21
int mismatchType
Definition: MismatchedCharException.hpp:44
Definition: BitSet.hpp:40
int foundChar
Definition: MismatchedCharException.hpp:47
Definition: RecognitionException.hpp:18
int upper
Definition: MismatchedCharException.hpp:53
#define ANTLR_USE_NAMESPACE(_x_)
Definition: config.hpp:18
~MismatchedCharException()
Definition: MismatchedCharException.hpp:90