00001 00002 00003 00004 00005 00006
00007 #ifndef skINTERPRETER_H
00008 #define skINTERPRETER_H
00009
00010 #include "skRValue.h"
00011 #include "skExecutable.h"
00012 #include "skNull.h"
00013 #include "skParseException.h"
00014 #include "skParseNode.h"
00015
00016 class skRValueArray;
00017 class skParseNode;
00018 class skStringList;
00019 class skMethodDefNode;
00020
00021
00029 class skInterpreter : public skExecutable
00030 {
00031 public:
00032
00033
00034
00035
00045 skMethodDefNode * parseString(const skString& location,const skString& code);
00056 skMethodDefNode * parseExternalParams(const skString& location,skStringList& paramNames,const skString& code);
00069 void executeString(const skString& location,skExecutable * obj,const skString& code,skRValueArray& args,skRValue& return_value,skMethodDefNode ** parseTree);
00070
00083 void executeStringExternalParams(const skString& location,skExecutable * obj,skStringList& paramNames,const skString& code,skRValueArray& args,skRValue& r,skMethodDefNode ** keepParseTree);
00084
00094 void executeParseTree(const skString& location,skExecutable * obj,skMethodDefNode * parseTree,skRValueArray& args,skRValue& return_value);
00095
00096
00097
00098
00104 void addGlobalVariable(const skString& name,skRValue value);
00109 void removeGlobalVariable(const skString& name);
00116 bool findGlobalVariable(const skString& name,skRValue& return_value);
00117
00118
00119
00120
00121
00126 bool setValue(const skString& s,const skString& attribute,const skRValue& v);
00127
00128
00129
00130
00131
00135 static skInterpreter * getInterpreter();
00139 static void setInterpreter(skInterpreter *);
00140
00141
00142
00143
00144
00148 skInterpreter();
00152 ~skInterpreter();
00153
00154 class P_Interpreter * pimp;
00155
00159 static skNull g_Null;
00160
00161
00162 public:
00166 void setTopNode(skMethodDefNode* pNode) { m_TopNode = pNode; }
00167 void addParseNode(skParseNode* pNode) { m_TempNodes.append(pNode); }
00168 void appendError(skCompileError pErr);
00169 private:
00173 skMethodDefNode* m_TopNode;
00174 skParseNodeList m_TempNodes;
00175 skCompileErrorList m_ErrList;
00176
00177 private:
00178
00179
00180
00181
00182
00186 skInterpreter(const skInterpreter&);
00190 skInterpreter& operator=(const skInterpreter&);
00191 };
00192
00193
00194 #endif
00195
00196