-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathcpps_node.h
More file actions
96 lines (89 loc) · 2.27 KB
/
cpps_node.h
File metadata and controls
96 lines (89 loc) · 2.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#ifndef CPPS_OBJ_CPPS_HEAD_
#define CPPS_OBJ_CPPS_HEAD_
//===================================
//@Author : Johnson
//@QQ : 88481106
//@Email : 88481106@qq.com
//@Date : 2015/11/20 (yy/mm/dd)
//@Module : CPPS_NODE
//@Description : Cpps节点
//@website : http://cppscript.org
//==================================
namespace cpps
{
struct C;
struct cpps_node_domain;
typedef phmap::flat_hash_map<std::string, node*> var_list_type;
struct cpps_value;
struct Buffer;
enum node_var_type
{
node_var_type_var,
node_var_type_constvar,
node_var_type_asyncvar,
node_var_type_externvar,
};
struct node
{
node();
node(std::string f);
node(node *n,std::string f,int32 ln);
node(std::string f, int32 ln);
~node();
void release();
void add(node *o);
void clone(node * v);
void setparent(node* p);
void addtoleft(node *p);
inline node* getleft()
{
return l.size() >= 1 ? l[0] : NULL;
}
void addtoright(node *p);
inline node* getright()
{
return l.size() >= 2 ? l[1] : NULL;
}
inline node* getthird()
{
return l.size() >= 3 ? l[2] : NULL;
}
void setdomain(cpps_node_domain* d);
void regnode(std::string& s, node* n);
void unregnode(std::string& s);
node* getnode(std::string& s, bool b = false);
void cpps_release();
inline bool empty() { return l.empty(); }
void write(cpps::Buffer* _buffer);
void read(cpps::Buffer* _buffer);
void swap(node* _n);
std::string s;
std::vector<node*> l;
int32 type;
std::string filename;
cpps_symbol* symbol;
node *parent;
cpps_node_domain* domain;
int32 line;
bool closure;
bool quote;
//解释转化
union Value
{
cpps_number number; // double float
cpps_integer integer; // int
cpps_uinteger uinteger; // int
int32 b; // bool
cpps_value* val; // value
};
Value value; //值。
bool needdelete;
//解释层动态计算内存地址.=========
int8 varsize; //类变量计数 (只包含变量) 前提是类
int16 offset; //自身偏移
int8 offsettype; //偏移类型 0 global 1 left 2 self
int16 size; //子节点数量 ( 只包含类 名空间 函数 , 非类情况下包含变量) 65535个节点还不够吗?
var_list_type *varlist; //为了运行提速,牺牲解释速度.
};
}
#endif // CPPS_OBJ_CPPS_HEAD_