Lists and Attributes without order [message #881345] |
Mon, 04 June 2012 11:30 |
Nicole Behlen Messages: 8 Registered: May 2012 Location: Madrid |
Junior Member |
|
|
Can anyone help me with the following grammar. We need to be able to allow
lists and unique values (attributes) mixed up, without any order, so I defined
the following grammar. (It is just an example, but I need it in a very similar case)
Town:
'TOWN' name=STRING
'START'
(size = Size) &
(elevation = Elevation)? &
(inhabitant += (Adult | Child)+
'END'
;
Size:
'SIZE' size=INT;
Elevation:
'ELEVATION' elevation=INT 'm';
Adult:
'ADULT' name=STRING;
Child:
'CHILD' name=STRING;
Actually this definition, doesn't allow the following syntax. The CHILD Ana Belen wouldn't be allowed, as ELEVATION is coming after ADULT.
TOWN "Madrid"
START
SIZE 3265038
ADULT "Mariano Rajoy"
ELEVATION 667m
CHILD "Ana Belen"
END
Anyone can knows, how I could improve the grammar.
I would need some grammar definition like this, but actually it is not supported.
Town:
'TOWN' name=STRING
'START'
description=(Size | Evelation? | Adult* | Child*)
'END'
;
Is there a workaround? Thanks a lot in advance.
[Updated on: Mon, 04 June 2012 12:01] Report message to a moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03221 seconds