-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_ConvEnumsToNew.lua
94 lines (83 loc) · 1.46 KB
/
_ConvEnumsToNew.lua
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
require "_Utils"
local common = require "_ConvCommon"
local enums = require "_ConvCommonEnums"
local convert = require "_ConvCommonConvert"
local enumerator =
{ test = "enum",
element =
{ name = "enum",
map_attribs =
{
name = "name",
comment = "notation",
},
proc = function(writer, node)
local attrib, data = enums.OldEnumNodeToNewAttrib(node)
writer:AddAttribute(attrib, data)
end
},
}
local unused =
{ test = "unused",
element =
{ name = "unused-range",
map_attribs =
{
start = "range-start",
["end"] = "range-end",
},
},
}
local enumeration =
{ test = "enums",
element =
{ name = "enumeration",
map_attribs =
{
name = "name",
comment = "notation",
start = "range-start",
["end"] = "range-end",
},
attribs =
{
purpose = function(node)
if(node.attr.type == "bitmask") then
return "bitmask"
else
return nil
end
end,
},
},
children =
{
enumerator,
convert.toNotation,
unused,
},
}
return
{ test = "enums",
collate =
{
consecutive = true,
group = true,
start = "enums",
--Process both "enums" and "comment" nodes.
consume = function(node)
if(node.type ~= "element") then
return true
end
if(node.name == "comment" or node.name == "enums") then
return true
end
return false
end,
},
children =
{
enumeration,
convert.toNotation,
},
}