ANTLR Support Libraries 2.7.1+
antlr/MismatchedTokenException.hpp
Go to the documentation of this file.
00001 #ifndef INC_MismatchedTokenException_hpp__
00002 #define INC_MismatchedTokenException_hpp__
00003 
00004 /* ANTLR Translator Generator
00005  * Project led by Terence Parr at http://www.jGuru.com
00006  * Software rights: http://www.antlr.org/license.html
00007  *
00008  * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/MismatchedTokenException.hpp#2 $
00009  */
00010 
00011 #include <antlr/config.hpp>
00012 #include <antlr/RecognitionException.hpp>
00013 #include <antlr/BitSet.hpp>
00014 #include <antlr/Token.hpp>
00015 #include <antlr/AST.hpp>
00016 #include <vector>
00017 
00018 #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE
00019 namespace antlr {
00020 #endif
00021 
00022 class ANTLR_API MismatchedTokenException : public RecognitionException {
00023 public:
00024    MismatchedTokenException();
00025 
00027    MismatchedTokenException(
00028       const char* const* tokenNames_,
00029       const int numTokens_,
00030       RefAST node_,
00031       int lower,
00032       int upper_,
00033       bool matchNot
00034    );
00035 
00036    // Expected token / not token
00037    MismatchedTokenException(
00038       const char* const* tokenNames_,
00039       const int numTokens_,
00040       RefAST node_,
00041       int expecting_,
00042       bool matchNot
00043    );
00044 
00045    // Expected BitSet / not BitSet
00046    MismatchedTokenException(
00047       const char* const* tokenNames_,
00048       const int numTokens_,
00049       RefAST node_,
00050       BitSet set_,
00051       bool matchNot
00052    );
00053 
00054    // Expected range / not range
00055    MismatchedTokenException(
00056       const char* const* tokenNames_,
00057       const int numTokens_,
00058       RefToken token_,
00059       int lower,
00060       int upper_,
00061       bool matchNot,
00062       const ANTLR_USE_NAMESPACE(std)string& fileName_
00063    );
00064 
00065    // Expected token / not token
00066    MismatchedTokenException(
00067       const char* const* tokenNames_,
00068       const int numTokens_,
00069       RefToken token_,
00070       int expecting_,
00071       bool matchNot,
00072       const ANTLR_USE_NAMESPACE(std)string& fileName_
00073    );
00074 
00075    // Expected BitSet / not BitSet
00076    MismatchedTokenException(
00077       const char* const* tokenNames_,
00078       const int numTokens_,
00079       RefToken token_,
00080       BitSet set_,
00081       bool matchNot,
00082       const ANTLR_USE_NAMESPACE(std)string& fileName_
00083    );
00084    ~MismatchedTokenException() throw() {}
00085 
00089    ANTLR_USE_NAMESPACE(std)string getMessage() const;
00090 
00091 public:
00093    const RefToken token;
00095    const RefAST node;
00097    ANTLR_USE_NAMESPACE(std)string tokenText;
00098 
00100 #ifndef NO_STATIC_CONSTS
00101    static const int TOKEN = 1;
00102    static const int NOT_TOKEN = 2;
00103    static const int RANGE = 3;
00104    static const int NOT_RANGE = 4;
00105    static const int SET = 5;
00106    static const int NOT_SET = 6;
00107 #else
00108    enum {
00109       TOKEN = 1,
00110       NOT_TOKEN = 2,
00111       RANGE = 3,
00112       NOT_RANGE = 4,
00113       SET = 5,
00114       NOT_SET = 6
00115    };
00116 #endif
00117 
00118 public:
00120    int mismatchType;
00121 
00123    int expecting;
00124 
00126    int upper;
00127 
00129    BitSet set;
00130 
00131 private:
00133    const char* const* tokenNames;
00135    const int numTokens;
00137    ANTLR_USE_NAMESPACE(std)string tokenName(int tokenType) const;
00138 };
00139 
00140 #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE
00141 }
00142 #endif
00143 
00144 #endif //INC_MismatchedTokenException_hpp__
 All Classes Namespaces Files Functions Variables Typedefs Friends Defines