KDevelop API Documentation

RecognitionException.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: RecognitionException.cpp,v 1.2 2003/05/02 00:36:20 okellogg Exp $
00006  */
00007 
00008 #include "antlr/RecognitionException.hpp"
00009 #include "antlr/String.hpp"
00010 
00011 #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE
00012 namespace antlr {
00013 #endif
00014 
00015 RecognitionException::RecognitionException()
00016 : ANTLRException("parsing error")
00017 , line(-1)
00018 , column(-1)
00019 {
00020 }
00021 
00022 RecognitionException::RecognitionException(const ANTLR_USE_NAMESPACE(std)string& s)
00023 : ANTLRException(s)
00024 , line(-1)
00025 , column(-1)
00026 {
00027 }
00028 
00029 RecognitionException::RecognitionException(const ANTLR_USE_NAMESPACE(std)string& s,
00030                                            const ANTLR_USE_NAMESPACE(std)string& fileName_,
00031                                            int line_,int column_)
00032 : ANTLRException(s)
00033 , fileName(fileName_)
00034 , line(line_)
00035 , column(column_)
00036 {
00037 }
00038 
00039 ANTLR_USE_NAMESPACE(std)string RecognitionException::getFileLineColumnString() const
00040 {
00041     ANTLR_USE_NAMESPACE(std)string fileLineColumnString;
00042 
00043     if ( fileName.length() > 0 )
00044         fileLineColumnString = fileName + ":";
00045 
00046     if ( line != -1 )
00047     {
00048         if ( fileName.length() == 0 )
00049             fileLineColumnString = fileLineColumnString + "line ";
00050 
00051         fileLineColumnString = fileLineColumnString + line;
00052 
00053         if ( column != -1 )
00054             fileLineColumnString = fileLineColumnString + ":" + column;
00055 
00056         fileLineColumnString = fileLineColumnString + ":";
00057     }
00058 
00059     fileLineColumnString = fileLineColumnString + " ";
00060 
00061     return fileLineColumnString;
00062 }
00063 
00064 ANTLR_USE_NAMESPACE(std)string RecognitionException::toString() const
00065 {
00066     return getFileLineColumnString()+getMessage();
00067 }
00068 
00069 #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE
00070 }
00071 #endif
KDE Logo
This file is part of the documentation for KDevelop Version 3.1.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Mar 23 00:03:50 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003