00001 /* 00002 Copyright 1996-2002 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: skParser_8h-source.html,v 1.5 2003/01/23 15:31:03 simkin_cvs Exp $ 00020 */ 00021 00022 #ifndef skPARSER_H 00023 #define skPARSER_H 00024 00025 #include "skParseException.h" 00026 #include "skParseNode.h" 00027 00028 const int MAXYYTEXT=4096; 00029 00033 class skParser { 00034 public: 00040 skParser(const skString& code,const skString& location); 00044 ~skParser(); 00050 skMethodDefNode * parseMethod(); 00056 skExprNode * parseExpression(); 00061 void setTopNode(skParseNode* pNode); 00065 void addParseNode(skParseNode* pNode); 00069 void appendError(const skString& msg); 00073 const skCompileErrorList& getErrList(); 00079 int lex(void * lvalp,void * lloc); // returns a token 00083 int nextChar(); 00087 void putbackchar(int i); 00091 bool eof(); 00092 private: 00099 void cleanupTempNodes(); 00103 void clearTempNodes(); 00104 00105 skParseNode* m_TopNode; 00106 skParseNodeList m_TempNodes; 00107 skCompileErrorList m_ErrList; 00108 00109 Char m_LexBuffer[MAXYYTEXT]; // used by lexical analyser to hold the current token 00110 skString m_InputBuffer; // the buffer read by the lexer 00111 int m_PutBack; // character to be put back 00112 int m_LineNum; // linenumber being lexed 00113 unsigned int m_Pos; // position in the line 00114 skString m_Location; 00115 }; 00116 00117 #endif