NoViableAltException.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008 #include "antlr/NoViableAltException.hpp"
00009 #include "antlr/String.hpp"
00010
00011 #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE
00012 namespace antlr {
00013 #endif
00014
00015 ANTLR_USING_NAMESPACE(std)
00016
00017 NoViableAltException::NoViableAltException(RefAST t)
00018 : RecognitionException("NoViableAlt","<AST>",-1,-1),
00019 token(0), node(t)
00020 {
00021 }
00022
00023 NoViableAltException::NoViableAltException(
00024 RefToken t,
00025 const ANTLR_USE_NAMESPACE(std)string& fileName_
00026 ) : RecognitionException("NoViableAlt",fileName_,t->getLine(),t->getColumn()),
00027 token(t), node(nullASTptr)
00028 {
00029 }
00030
00031 ANTLR_USE_NAMESPACE(std)string NoViableAltException::getMessage() const
00032 {
00033 if (token)
00034 {
00035 if( token->getType() == Token::EOF_TYPE )
00036 return string("unexpected end of file");
00037 else if( token->getType() == Token::NULL_TREE_LOOKAHEAD )
00038 return string("unexpected end of tree");
00039 else
00040 return string("unexpected token: ")+token->getText();
00041 }
00042
00043
00044 if (!node)
00045 return "unexpected end of subtree";
00046
00047 return string("unexpected AST node: ")+node->toString();
00048 }
00049
00050 #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE
00051 }
00052 #endif
This file is part of the documentation for KDevelop Version 3.1.2.