Optional ordering with commas where first element can also be optional [message #1841807] |
Sun, 30 May 2021 19:52  |
Eclipse User |
|
|
|
I'm developing a JSON like DSL. Objects appear in the same order, but I want them to be optionals. I can see a solution if the first object is not optional, as the commas would just belong to the next object, but what if the first object as well can be optional?
I've tried setting the commas to being optional, but this does not work when the object in between is also optional - I believe because the written comma can be either of the optional commas then.
Example:
'{'
'"One"' ':' '{'
one = JsonValue
'}' ','
'"Two"' ':' '{'
two = JsonValue
'}' ','
'"Three"' ':' '{'
three = JsonValue
'}'
'}'
;
JsonValue:
'"value"' ':' value = INT
;
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.08284 seconds