diff options
author | isiv <isiv@yandex-team.ru> | 2022-02-10 16:47:54 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:47:54 +0300 |
commit | 40aa65b121746185908e51e32dca11ccee70140b (patch) | |
tree | c0748b5dcbade83af788c0abfa89c0383d6b779c /contrib/libs/antlr3_cpp_runtime/include/antlr3exception.hpp | |
parent | f20e3f1949626df2ef9d81d7618ec367b0c34f6b (diff) | |
download | ydb-40aa65b121746185908e51e32dca11ccee70140b.tar.gz |
Restoring authorship annotation for <isiv@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/libs/antlr3_cpp_runtime/include/antlr3exception.hpp')
-rw-r--r-- | contrib/libs/antlr3_cpp_runtime/include/antlr3exception.hpp | 150 |
1 files changed, 75 insertions, 75 deletions
diff --git a/contrib/libs/antlr3_cpp_runtime/include/antlr3exception.hpp b/contrib/libs/antlr3_cpp_runtime/include/antlr3exception.hpp index d3b873c032c..9bc18a04326 100644 --- a/contrib/libs/antlr3_cpp_runtime/include/antlr3exception.hpp +++ b/contrib/libs/antlr3_cpp_runtime/include/antlr3exception.hpp @@ -12,8 +12,8 @@ one container and hence needs virtual functions. But this would occur only when there is a exception/ while deleting base recognizer. So shouldn't incur the overhead in normal operation */ -#ifndef _ANTLR3_EXCEPTION_HPP -#define _ANTLR3_EXCEPTION_HPP +#ifndef _ANTLR3_EXCEPTION_HPP +#define _ANTLR3_EXCEPTION_HPP // [The "BSD licence"] // Copyright (c) 2005-2009 Gokulakannan Somasundaram, ElectronDB @@ -43,7 +43,7 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -namespace antlr3 { +namespace antlr3 { /** Base structure for an ANTLR3 exception tracker */ @@ -52,14 +52,14 @@ template<class ImplTraits, class StreamType> class ANTLR_ExceptionBase { public: - typedef typename StreamType::UnitType TokenType; - typedef typename StreamType::IntStreamType IntStreamType; - typedef typename ImplTraits::AllocPolicyType AllocPolicyType; - typedef typename ImplTraits::StringType StringType; - typedef typename ImplTraits::StringStreamType StringStreamType; - typedef typename ImplTraits::BitsetType BitsetType; - typedef typename ImplTraits::BitsetListType BitsetListType; - typedef typename ImplTraits::template ExceptionBaseType<StreamType> ExceptionBaseType; + typedef typename StreamType::UnitType TokenType; + typedef typename StreamType::IntStreamType IntStreamType; + typedef typename ImplTraits::AllocPolicyType AllocPolicyType; + typedef typename ImplTraits::StringType StringType; + typedef typename ImplTraits::StringStreamType StringStreamType; + typedef typename ImplTraits::BitsetType BitsetType; + typedef typename ImplTraits::BitsetListType BitsetListType; + typedef typename ImplTraits::template ExceptionBaseType<StreamType> ExceptionBaseType; protected: /** The printable message that goes with this exception, in your preferred @@ -69,22 +69,22 @@ protected: * the users of your product will understand, as they are unlikely to know what * to do with "Recognition exception at: [[TOK_GERUND..... " ;-) */ - StringType m_message; + StringType m_message; /** Name of the file/input source for reporting. Note that this may be empty!! */ - StringType m_streamName; + StringType m_streamName; /** Indicates the index of the 'token' we were looking at when the * exception occurred. */ - ANTLR_MARKER m_index; + ANTLR_MARKER m_index; /** Indicates what the current token/tree was when the error occurred. Since not * all input streams will be able to retrieve the nth token, we track it here * instead. This is for parsers, and even tree parsers may set this. */ - const TokenType* m_token; + const TokenType* m_token; /** Pointer to the next exception in the chain (if any) */ @@ -92,91 +92,91 @@ protected: /** Indicates the token we were expecting to see next when the error occurred */ - ANTLR_UINT32 m_expecting; + ANTLR_UINT32 m_expecting; /** Indicates a set of tokens that we were expecting to see one of when the * error occurred. It is a following bitset list, so you can use load it and use ->toIntList() on it * to generate an array of integer tokens that it represents. */ - BitsetListType* m_expectingSet; + BitsetListType* m_expectingSet; /** If this is a tree parser exception then the node is set to point to the node * that caused the issue. */ - TokenType* m_node; + TokenType* m_node; /** The current character when an error occurred - for lexers. */ - ANTLR_UCHAR m_c; + ANTLR_UCHAR m_c; /** Track the line at which the error occurred in case this is * generated from a lexer. We need to track this since the * unexpected char doesn't carry the line info. */ - ANTLR_UINT32 m_line; + ANTLR_UINT32 m_line; /** Character position in the line where the error occurred. */ - ANTLR_INT32 m_charPositionInLine; + ANTLR_INT32 m_charPositionInLine; /** decision number for NVE */ - ANTLR_UINT32 m_decisionNum; + ANTLR_UINT32 m_decisionNum; /** State for NVE */ - ANTLR_UINT32 m_state; + ANTLR_UINT32 m_state; /** Rule name for failed predicate exception */ - StringType m_ruleName; + StringType m_ruleName; /** Pointer to the input stream that this exception occurred in. */ - IntStreamType* m_input; + IntStreamType* m_input; public: - StringType& get_message(); - StringType& get_streamName(); - ANTLR_MARKER get_index() const; - const TokenType* get_token() const; - ExceptionBaseType* get_nextException() const; - ANTLR_UINT32 get_expecting() const; - BitsetListType* get_expectingSet() const; - TokenType* get_node() const; - ANTLR_UCHAR get_c() const; - ANTLR_UINT32 get_line() const; - ANTLR_INT32 get_charPositionInLine() const; - ANTLR_UINT32 get_decisionNum() const; - ANTLR_UINT32 get_state() const; - StringType& get_ruleName(); - IntStreamType* get_input() const; - void set_message( const StringType& message ); - void set_streamName( const StringType& streamName ); - void set_index( ANTLR_MARKER index ); - void set_token( const TokenType* token ); - void set_nextException( ExceptionBaseType* nextException ); - void set_expecting( ANTLR_UINT32 expecting ); - void set_expectingSet( BitsetListType* expectingSet ); - void set_node( TokenType* node ); - void set_c( ANTLR_UCHAR c ); - void set_line( ANTLR_UINT32 line ); - void set_charPositionInLine( ANTLR_INT32 charPositionInLine ); - void set_decisionNum( ANTLR_UINT32 decisionNum ); - void set_state( ANTLR_UINT32 state ); - void set_ruleName( const StringType& ruleName ); - void set_input( IntStreamType* input ); - StringType getDescription() const; - - virtual StringType getName() const = 0; - virtual ANTLR_UINT32 getType() const = 0; - virtual void print() const = 0; - virtual void displayRecognitionError( ANTLR_UINT8** tokenNames, StringStreamType& str ) const = 0; + StringType& get_message(); + StringType& get_streamName(); + ANTLR_MARKER get_index() const; + const TokenType* get_token() const; + ExceptionBaseType* get_nextException() const; + ANTLR_UINT32 get_expecting() const; + BitsetListType* get_expectingSet() const; + TokenType* get_node() const; + ANTLR_UCHAR get_c() const; + ANTLR_UINT32 get_line() const; + ANTLR_INT32 get_charPositionInLine() const; + ANTLR_UINT32 get_decisionNum() const; + ANTLR_UINT32 get_state() const; + StringType& get_ruleName(); + IntStreamType* get_input() const; + void set_message( const StringType& message ); + void set_streamName( const StringType& streamName ); + void set_index( ANTLR_MARKER index ); + void set_token( const TokenType* token ); + void set_nextException( ExceptionBaseType* nextException ); + void set_expecting( ANTLR_UINT32 expecting ); + void set_expectingSet( BitsetListType* expectingSet ); + void set_node( TokenType* node ); + void set_c( ANTLR_UCHAR c ); + void set_line( ANTLR_UINT32 line ); + void set_charPositionInLine( ANTLR_INT32 charPositionInLine ); + void set_decisionNum( ANTLR_UINT32 decisionNum ); + void set_state( ANTLR_UINT32 state ); + void set_ruleName( const StringType& ruleName ); + void set_input( IntStreamType* input ); + StringType getDescription() const; + + virtual StringType getName() const = 0; + virtual ANTLR_UINT32 getType() const = 0; + virtual void print() const = 0; + virtual void displayRecognitionError( ANTLR_UINT8** tokenNames, StringStreamType& str ) const = 0; virtual ~ANTLR_ExceptionBase(); protected: - ANTLR_ExceptionBase(const StringType& message); + ANTLR_ExceptionBase(const StringType& message); }; @@ -184,23 +184,23 @@ template<class ImplTraits, ExceptionType Ex, class StreamType> class ANTLR_Exception : public ImplTraits::template ExceptionBaseType<StreamType> { public: - typedef typename ImplTraits::StringType StringType; - typedef typename ImplTraits::StringStreamType StringStreamType; - typedef typename ImplTraits::BitsetType BitsetType; - typedef typename ImplTraits::template ExceptionBaseType<StreamType> BaseType; + typedef typename ImplTraits::StringType StringType; + typedef typename ImplTraits::StringStreamType StringStreamType; + typedef typename ImplTraits::BitsetType BitsetType; + typedef typename ImplTraits::template ExceptionBaseType<StreamType> BaseType; public: - template<typename BaseRecognizerType> - ANTLR_Exception(BaseRecognizerType* recognizer, const StringType& message); - - const StringType& get_name() const; - virtual StringType getName() const; - virtual ANTLR_UINT32 getType() const; - virtual void print() const; - virtual void displayRecognitionError( ANTLR_UINT8** tokenNames, StringStreamType& str_stream) const; + template<typename BaseRecognizerType> + ANTLR_Exception(BaseRecognizerType* recognizer, const StringType& message); + + const StringType& get_name() const; + virtual StringType getName() const; + virtual ANTLR_UINT32 getType() const; + virtual void print() const; + virtual void displayRecognitionError( ANTLR_UINT8** tokenNames, StringStreamType& str_stream) const; }; -} +} #include "antlr3exception.inl" |