-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathtest_enum_symbol_def.dao
177 lines (130 loc) · 2 KB
/
test_enum_symbol_def.dao
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
#{
EnumEntry ::= Identifier [ = ConstExpr ]
Enum1 ::= 'enum' Identifier '{' EnumEntry { ',' EnumEntry } '}'
Enum2 ::= 'enum' Identifier '{' EnumEntry { ';' EnumEntry } '}'
Enum ::= Enum1 | Enum2
EnumType1 ::= 'enum' '<' EnumEntry { ',' EnumEntry } '>'
EnumType2 ::= 'enum' '<' EnumEntry { ';' EnumEntry } '>'
EnumType ::= EnumType1 | EnumType2
#}
@[test()]
enum
{
}
@[test()]
@[test()]
{{ERROR}} .* {{At line}} .* {{Invalid enum definition}}
@[test()]
enum Bool
{
False,
True
}
@[test()]
io.writeln( Bool::False )
io.writeln( Bool.True )
@[test()]
@[test()]
$False(0)
$True(1)
@[test()]
@[test()]
switch( Bool.False ){
case Bool::False : io.writeln( "Bool::False" )
case Bool::True : io.writeln( "Bool::True" )
}
@[test()]
@[test()]
Bool::False
@[test()]
@[test()]
switch( (Bool) $True ){
case Bool::False : io.writeln( "Bool::False" )
case Bool::True : io.writeln( "Bool::True" )
}
@[test()]
@[test()]
Bool::True
@[test()]
@[test()]
bl : Bool = $True
io.writeln( bl )
@[test()]
@[test()]
$True(1)
@[test()]
@[test()]
a = True;
@[test()]
@[test()]
{{ERROR}} .* {{At line}} .* {{Symbol not defined}}
@[test()]
@[test()]
flag = Bool.False + Bool.True
@[test()]
@[test()]
{{not combinable enum}}
@[test()]
@[test()]
const False : int = Bool::False
const True : int = Bool::True
io.writeln( False, True )
@[test()]
@[test()]
0 1
@[test()]
@[test()]
enum EC
{
AA;
BB = 3;
CC
}
io.writeln( EC::AA )
io.writeln( EC::BB )
io.writeln( EC::CC )
@[test()]
@[test()]
$AA(1)
$AA$BB(3)
$CC(6)
@[test()]
@[test()]
enum Test
{
ABC = 'abc'
}
@[test()]
@[test()]
{{ERROR}} .* {{At line}} .* {{Invalid enum definition}}
@[test()]
@[test()]
enum Test
{
A = 1
B = 1
}
@[test()]
@[test()]
{{ERROR}} .* {{At line}} .* {{Invalid enum definition}}
@[test()]
@[test()]
enum Test
{
A = 1,
A = 1
}
@[test()]
@[test()]
{{ERROR}} .* {{At line}} .* {{Symbol was defined}}
@[test()]
@[test()]
enum Test
{
A = 1,
B = 2 - 1
}
@[test()]
@[test()]
{{ERROR}} .* {{At line}} .* {{Value was used}}
@[test()]