22.08.2013, 12:03
@Y_Less: Well, in fact enums aren't used there at all. Take a look at this code (not quite valid, but works can be parsed with -a flag)
It simply produces
They are substituted in order of declaraction with numbers. Even "__" as state name will get parsed, but I can't find official rules for their labels.
@theYiin: Yup, I thought about this version (which is very clever by the way), but then I changed my main goal to grouping (so you don't have to do something like)
pawn Code:
enum A {}
enum B {}
main() {
state s:A;
Fnc();
state z:B;
Fnck();
}
Fnc() <s:A> {
#emit STATEA
}
Fnc() <s:B> {
#emit STATEB
}
Fnck() <z:B> {
#emit STATEB
}
Fnck() <z:A> {
#emit STATEA
}
pawn Code:
load.pri 4 ; Fnc
switch 3
l.3 ; 20
casetbl
case 2 0
case 1 1
case 2 2
load.pri 8 ; Fnck
switch 6
l.6 ; 4c
casetbl
case 2 0
case 1 4
case 2 5
@theYiin: Yup, I thought about this version (which is very clever by the way), but then I changed my main goal to grouping (so you don't have to do something like)
pawn Code:
enum g_Main {
d_n_1,
d_n_2,
d_n_3
}
enum g_Additional {
d_a_1 = 3,
d_a_2,
d_a_3
}