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,v 1.8 2001/11/16 23:03:24 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   }
00064   bool operator==(const skCompileError& err) const {
00065     return m_Msg==err.m_Msg;
00066   }
00067  private:
00068   int m_LineNum;
00069   skString m_Location;
00070   skString m_LexBuffer;
00071   skString m_Msg;
00072 };
00073 EXTERN_TEMPLATE template class CLASSEXPORT skTVAList<skCompileError>;
00074 
00078 class CLASSEXPORT skCompileErrorList : public skTVAList<skCompileError> 
00079 {
00080 };
00081 const int skParseException_Code=2;
00082 
00086 class CLASSEXPORT skParseException {
00087  public:
00091   skParseException(const skCompileErrorList& errors) : m_Errors(errors) {
00092   }
00096   const skCompileErrorList& getErrors() const{
00097     return m_Errors;
00098   }
00102   skString toString() const {
00103     skString ret;
00104     for (unsigned int i=0;i<m_Errors.entries();i++)
00105       ret+=m_Errors[i].toString()+skSTR("\n");
00106     return ret;
00107   }
00108  private:
00109   skCompileErrorList m_Errors;
00110 };
00111 
00112 #endif

Generated on Tue Nov 20 17:56:21 2001 for Simkin by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001