00001 /* 00002 Copyright 1996-2001 00003 Simon Whiteside 00004 $Id: skParser_h-source.html,v 1.3 2001/05/22 12:30:53 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(char * msg); 00055 const skCompileErrorList& getErrList(); 00059 int lex(void * lvalp); // returns a token 00063 int nextChar(); 00067 void putbackchar(int i); 00071 bool eof(); 00075 void cleanupTempNodes(); 00079 void clearTempNodes(); 00080 00081 private: 00085 skMethodDefNode* m_TopNode; 00086 skParseNodeList m_TempNodes; 00087 skCompileErrorList m_ErrList; 00088 00089 char m_LexBuffer[MAXYYTEXT]; // used by lexical analyser to hold the current token 00090 skString m_InputBuffer; // the buffer read by the lexer 00091 int m_PutBack; // character to be put back 00092 int m_LineNum; // linenumber being lexed 00093 unsigned int m_Pos; // position in the line 00094 skString m_Location; 00095 }; 00096 00097 #endif