Repository navigation
Expand file tree
/
Copy pathoperations_code.lua
More file actions
85 lines (65 loc) · 2.21 KB
/
Copy pathoperations_code.lua
File metadata and controls
85 lines (65 loc) · 2.21 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
--==============================================================================
-- Debug
--==============================================================================
--==============================================================================
-- Dependency
--==============================================================================
--==============================================================================
-- Data Structure
--==============================================================================
local Class = {}
-- code of each node
-- {
-- ["operation id"] = $number,
-- }
local codes = {
["CALLID"] = 01,
["GOTO"] = 02,
["IFFALSEGOTO"] = 03,
["IFGOTO"] = 04,
["LABEL"] = 05,
["PARAM"] = 06,
["RET_OP"] = 07,
["RET_NIL"] = 08,
["ID=rval"] = 10,
["ID=BYTErval"] = 11,
["ID=ID[rval]"] = 12,
["ID=BYTEID[rval]"] = 13,
["ID=-rval"] = 14,
["ID=NEWrval"] = 15,
["ID=NEWBYTErval"] = 16,
["ID=rvalEQrval"] = 17,
["ID=rvalNErval"] = 18,
["ID=rvalGErval"] = 19,
["ID=rvalLErval"] = 20,
["ID=rval<rval"] = 21,
["ID=rval>rval"] = 22,
["ID=rval+rval"] = 23,
["ID=rval-rval"] = 24,
["ID=rval*rval"] = 25,
["ID=rval/rval"] = 26,
["ID[rval]=rval"] = 27,
["ID[rval]=BYTErval"] = 28,
}
--==============================================================================
-- Public Methods
--==============================================================================
function Class.GetList ()
return codes
end
function Class.GetName (operation_code)
assert(type(operation_code) == "number")
for name, code in pairs(codes) do
if (code == operation_code) then
return name
end
end
return nil
end
--==============================================================================
-- Private Methods
--==============================================================================
--==============================================================================
-- Return
--==============================================================================
return Class