Optional arguments [message #1009506] |
Fri, 15 February 2013 08:47 |
Gaspar Din Messages: 21 Registered: September 2012 |
Junior Member |
|
|
Hi,
in my grammar there is a definition Func which can hold 0 to n params.
Simplified xtext fragment:
Func: {Func} '(' ( params+=INT(',' params+=INT)* )? ')' ';';
This allows to edit code like:
Now I want some parameters to be optional to edit code like:
My question:
How can I change the grammar to omit single params? It then must be possible accessing the values where the omitted values keep some empty/null value like:
params[0] // value is 7
params[1] // value is empty/null
params[2] // value is 15
Therefore, I can not make the single params completely optional like
(params+=INT)? // this would not set an empty/null value to an omitted param
Any suggestions?
Thanks in advance,
Gaspar
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03478 seconds