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.h,v 1.7 2002/12/13 17:21:54 sdw 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(); 00049 void parse(); 00054 void setTopNode(skMethodDefNode* pNode); 00058 skMethodDefNode * getTopNode(); 00062 void addParseNode(skParseNode* pNode); 00066 void appendError(const skString& msg); 00070 const skCompileErrorList& getErrList(); 00076 int lex(void * lvalp,void * lloc); // returns a token 00080 int nextChar(); 00084 void putbackchar(int i); 00088 bool eof(); 00092 void cleanupTempNodes(); 00096 void clearTempNodes(); 00097 00098 private: 00102 skMethodDefNode* m_TopNode; 00103 skParseNodeList m_TempNodes; 00104 skCompileErrorList m_ErrList; 00105 00106 Char m_LexBuffer[MAXYYTEXT]; // used by lexical analyser to hold the current token 00107 skString m_InputBuffer; // the buffer read by the lexer 00108 int m_PutBack; // character to be put back 00109 int m_LineNum; // linenumber being lexed 00110 unsigned int m_Pos; // position in the line 00111 skString m_Location; 00112 }; 00113 00114 #endif