00001 /* 00002 Copyright 1996-2001 00003 Simon Whiteside 00004 $Id: skParser.h,v 1.4 2001/10/29 18:17:25 sdw Exp $ 00005 */ 00006 00007 #ifndef skPARSER_H 00008 #define skPARSER_H 00009 00010 #include "skParseException.h" 00011 #include "skParseNode.h" 00012 00013 const int MAXYYTEXT=256; 00014 00018 class skParser { 00019 public: 00025 skParser(const skString& code,const skString& location); 00029 ~skParser(); 00034 void parse(); 00039 void setTopNode(skMethodDefNode* pNode); 00043 skMethodDefNode * getTopNode(); 00047 void addParseNode(skParseNode* pNode); 00051 void appendError(const skString& msg); 00055 const skCompileErrorList& getErrList(); 00061 int lex(void * lvalp,void * lloc); // returns a token 00065 int nextChar(); 00069 void putbackchar(int i); 00073 bool eof(); 00077 void cleanupTempNodes(); 00081 void clearTempNodes(); 00082 00083 private: 00087 skMethodDefNode* m_TopNode; 00088 skParseNodeList m_TempNodes; 00089 skCompileErrorList m_ErrList; 00090 00091 Char m_LexBuffer[MAXYYTEXT]; // used by lexical analyser to hold the current token 00092 skString m_InputBuffer; // the buffer read by the lexer 00093 int m_PutBack; // character to be put back 00094 int m_LineNum; // linenumber being lexed 00095 unsigned int m_Pos; // position in the line 00096 skString m_Location; 00097 }; 00098 00099 #endif