00001 /* 00002 Copyright 1996-2000 00003 Simon Whiteside 00004 00005 $Id: skParseException.h-source.html,v 1.1 2001/03/05 16:22:45 sdw Exp $ 00006 */ 00007 #ifndef SKPARSEEXCEPTION_H 00008 #define SKPARSEEXCEPTION_H 00009 00010 #include "skString.h" 00011 #include "skValist.h" 00012 00016 class skCompileError 00017 { 00018 public: 00022 skCompileError() 00023 : m_LineNum(0){ 00024 } 00028 skCompileError(skString location,int line_num,const skString& msg) 00029 : m_Location(location),m_LineNum(line_num),m_Msg(msg){ 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 toString() const { 00053 return m_Location+":"+skString::from(m_LineNum)+":"+m_Msg; 00054 } 00055 private: 00056 int m_LineNum; 00057 skString m_Location; 00058 skString m_Msg; 00059 }; 00063 class skCompileErrorList : public skTVAList<skCompileError> 00064 { 00065 }; 00069 class skParseException { 00070 public: 00074 skParseException(const skCompileErrorList& errors) : m_Errors(errors) { 00075 } 00079 const skCompileErrorList& getErrors() const{ 00080 return m_Errors; 00081 } 00085 skString toString() const { 00086 skString ret; 00087 for (unsigned int i=0;i<m_Errors.entries();i++) 00088 ret+=m_Errors[i].toString()+"\n"; 00089 return ret; 00090 } 00091 private: 00092 skCompileErrorList m_Errors; 00093 }; 00094 00095 #endif