KDevelop API Documentation

lib/antlr/src/NoViableAltException.cpp

Go to the documentation of this file.
00001 /* ANTLR Translator Generator 00002 * Project led by Terence Parr at http://www.jGuru.com 00003 * Software rights: http://www.antlr.org/RIGHTS.html 00004 * 00005 * $Id: NoViableAltException.cpp,v 1.2 2003/05/02 00:36:20 okellogg Exp $ 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 // must a tree parser error if token==null 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
KDE Logo
This file is part of the documentation for KDevelop Version 3.0.4.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Tue Oct 19 08:01:47 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003