Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

skParseException.h

00001 /*
00002   Copyright 1996-2003
00003   Simon Whiteside
00004 
00005     This library is free software; you can redistribute it and/or
00006     modify it under the terms of the GNU Lesser General Public
00007     License as published by the Free Software Foundation; either
00008     version 2 of the License, or (at your option) any later version.
00009 
00010     This library is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013     Lesser General Public License for more details.
00014 
00015     You should have received a copy of the GNU Lesser General Public
00016     License along with this library; if not, write to the Free Software
00017     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 
00019   $Id: skParseException_8h-source.html,v 1.5 2003/01/23 15:31:03 simkin_cvs Exp $
00020 */
00021 #ifndef SKPARSEEXCEPTION_H
00022 #define SKPARSEEXCEPTION_H
00023 
00024 #include "skException.h"
00025 #include "skString.h"
00026 #include "skValist.h"
00027 
00031 class CLASSEXPORT skCompileError
00032 {
00033  public:
00037   skCompileError() 
00038     : m_LineNum(0){
00039   }
00043   skCompileError(skString location,int line_num,const skString& msg,const skString& lex_buffer)
00044     : m_Location(location),m_LineNum(line_num),m_Msg(msg),m_LexBuffer(lex_buffer){
00045   }
00049   skString location() const{
00050     return m_Location;
00051   }
00055   int lineNum() const{
00056     return m_LineNum;
00057   }
00061   skString msg() const{
00062     return m_Msg;
00063   }
00067   skString lexBuffer() const{
00068     return m_LexBuffer;
00069   }
00073   skString toString() const {
00074     return m_Location+skSTR(":")+skString::from(m_LineNum)+skSTR(":")+m_Msg+skSTR(" near \"")+m_LexBuffer+skSTR("\"");
00075   }
00079   bool operator==(const skCompileError& err) const {
00080     return m_Msg==err.m_Msg;
00081   }
00082  private:
00083   int m_LineNum;
00084   skString m_Location;
00085   skString m_LexBuffer;
00086   skString m_Msg;
00087 };
00088 EXTERN_TEMPLATE template class CLASSEXPORT skTVAList<skCompileError>;
00089 
00093 class CLASSEXPORT skCompileErrorList : public skTVAList<skCompileError> 
00094 {
00095 };
00099 class CLASSEXPORT skParseException : public skException
00100 {
00101  public:
00105   skParseException(const skCompileErrorList& errors) : m_Errors(errors) {
00106   }
00110   const skCompileErrorList& getErrors() const{
00111     return m_Errors;
00112   }
00116   skString toString() const {
00117     skString ret;
00118     for (unsigned int i=0;i<m_Errors.entries();i++)
00119       ret+=m_Errors[i].toString()+skSTR("\n");
00120     return ret;
00121   }
00122  private:
00123   skCompileErrorList m_Errors;
00124 };
00125 
00126 #endif

Generated on Thu Jan 23 15:25:39 2003 for Simkin by doxygen1.3-rc1