00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 #ifndef skPARSER_H
00023 #define skPARSER_H
00024 
00025 #include "skParseException.h"
00026 #include "skParseNode.h"
00027 
00028 #ifdef __SYMBIAN32__
00029 const int MAXYYTEXT=256;
00030 #else
00031 const int MAXYYTEXT=4096;
00032 #endif
00033 
00037 class  skParser 
00038 #ifdef __SYMBIAN32__
00039 : public CBase
00040 #endif
00041 {
00042  public:
00048   skParser(const skString& code,const skString& location);
00052   ~skParser();
00059   skMethodDefNode * parseMethod();
00066 #ifdef EXECUTE_PARSENODES
00067   skExprNode * parseExpression();
00068 #else
00069   skCompiledExprNode * parseExpression();
00070 #endif
00071 #ifdef __SYMBIAN32__
00072 
00077   operator TCleanupItem();
00082   static void Cleanup(TAny * s);
00083 #endif
00084 
00089   void setTopNode(skParseNode* pNode);
00094   void removeTempString(skString* str);
00099   void addParseNode(skParseNode* pNode);
00104   void appendError(const skString& msg);
00109   void appendError(const Char * msg);
00113   skCompileErrorList& getErrList();
00120   int lex(void * lvalp,void * lloc); 
00121  private:
00125   int nextChar(); 
00129   void putbackchar(int i); 
00133   bool eof(); 
00137 #ifdef EXECUTE_PARSENODES
00138 
00142   skString * lookupIdentifier(const Char * id);
00143 #else
00144 
00148   int lookupIdentifier(const Char * id);
00149 #endif
00150 
00153   void cleanupTempNodes(); 
00157   void clearTempNodes();
00158   
00159    skParseNode*         m_TopNode;
00161    skParseNodeList      m_TempNodes;
00163    skTAList<skString>   m_TempStringLiterals;
00165 #ifdef EXECUTE_PARSENODES
00166    skTAList<skString>   m_Identifiers;
00167 #else
00168    skStringList m_Identifiers;
00169 #endif
00170    skCompileErrorList   m_ErrList;
00171    
00172    Char * m_LexBuffer; 
00173    skString m_InputBuffer; 
00174    int m_PutBack; 
00175    int m_LineNum; 
00176    unsigned int m_Pos; 
00177    skString m_Location;
00178 };
00179 
00180 #endif