upd: tools almost done
This commit is contained in:
@ -8,6 +8,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "Python3ParserBaseVisitor.h"
|
||||
#include "int2048/int2048.h"
|
||||
class InterpretException : public std::exception {
|
||||
public:
|
||||
@ -54,4 +55,33 @@ struct RawVarible {
|
||||
RawVarible() {}
|
||||
RawVarible(const std::string &name) : name(name) {}
|
||||
};
|
||||
struct ParaArguItemType {
|
||||
std::string name;
|
||||
std::any value;
|
||||
ParaArguItemType() {}
|
||||
ParaArguItemType(const std::string &name) : name(name) {}
|
||||
ParaArguItemType(const std::string &name, const std::any &value)
|
||||
: name(name), value(value) {}
|
||||
};
|
||||
struct FunctionItem {
|
||||
Python3Parser::SuiteContext *code_address;
|
||||
std::vector<ParaArguItemType> para_list;
|
||||
};
|
||||
class FucntionContainer {
|
||||
std::unordered_map<std::string, FunctionItem> FunctionIndex;
|
||||
public:
|
||||
void AddFunction(const std::string &name, const FunctionItem &item);
|
||||
std::any CallFunction(const std::string &name, const std::vector<ParaArguItemType> &args);
|
||||
};
|
||||
class VariableContainer {
|
||||
std::unordered_map<std::string, std::any> GlobalScope;
|
||||
std::stack<std::unordered_map<std::string, std::any>> StackScopes;
|
||||
|
||||
public:
|
||||
void CreateFrame();
|
||||
void DestroyFrame();
|
||||
std::any ReadVariable(const std::string &name);
|
||||
void WriteVariable(const std::string &name, const std::any &value);
|
||||
};
|
||||
std::any DeQuate(std::any val,VariableContainer &Variables);
|
||||
#endif
|
Reference in New Issue
Block a user