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

skParseException.h

00001 /*
00002   Copyright 1996-2001
00003   Simon Whiteside
00004 
00005   $Id: skParseException_h-source.html,v 1.19 2001/11/05 19:22:33 sdw Exp $
00006 */
00007 #ifndef SKPARSEEXCEPTION_H
00008 #define SKPARSEEXCEPTION_H
00009 
00010 #include "skString.h"
00011 #include "skValist.h"
00012 
00016 class CLASSEXPORT skCompileError
00017 {
00018  public:
00022   skCompileError() 
00023     : m_LineNum(0){
00024   }
00028   skCompileError(skString location,int line_num,const skString& msg,const skString& lex_buffer)
00029     : m_Location(location),m_LineNum(line_num),m_Msg(msg),m_LexBuffer(lex_buffer){
00030   }
00034   skString location() const{
00035     return m_Location;
00036   }
00040   int lineNum() const{
00041     return m_LineNum;
00042   }
00046   skString msg() const{
00047     return m_Msg;
00048   }
00052   skString lexBuffer() const{
00053     return m_LexBuffer;
00054   }
00058   skString toString() const {
00059     return m_Location+skSTR(":")+skString::from(m_LineNum)+skSTR(":")+m_Msg+skSTR(" near \"")+m_LexBuffer+skSTR("\"");
00060   }
00061   bool operator==(const skCompileError& err) const {
00062     return m_Msg==err.m_Msg;
00063   }
00064  private:
00065   int m_LineNum;
00066   skString m_Location;
00067   skString m_LexBuffer;
00068   skString m_Msg;
00069 };
00070 EXTERN_TEMPLATE template class CLASSEXPORT skTVAList<skCompileError>;
00071 
00075 class CLASSEXPORT skCompileErrorList : public skTVAList<skCompileError> 
00076 {
00077 };
00078 const int skParseException_Code=2;
00079 
00083 class CLASSEXPORT skParseException {
00084  public:
00088   skParseException(const skCompileErrorList& errors) : m_Errors(errors) {
00089   }
00093   const skCompileErrorList& getErrors() const{
00094     return m_Errors;
00095   }
00099   skString toString() const {
00100     skString ret;
00101     for (unsigned int i=0;i<m_Errors.entries();i++)
00102       ret+=m_Errors[i].toString()+skSTR("\n");
00103     return ret;
00104   }
00105  private:
00106   skCompileErrorList m_Errors;
00107 };
00108 
00109 #endif

Generated at Mon Nov 5 19:22:25 2001 for Simkin by doxygen1.2.1 written by Dimitri van Heesch, © 1997-2000