alternate between assignment and terminal [message #948796] |
Thu, 18 October 2012 07:36  |
Eclipse User |
|
|
|
I want to define as part of a grammar, the possibility to define the length of a given parameter with these xtext parser rule:
Length:
((min=INT)? ('..')? max=INT) | '#'
;
Such a rule is syntactically correct and makes the following terms possible:
1..5
..4
3
#
I want to express, that for the case '#' the length isn't defined and set min=max=-1. How can I achieve that ? This is not only important for the unit test which can't check min and max values because they are not defined:
val de = model.segments.head.datenElemente.head as DE
assertEquals("0", de.length.min) <-- NullPointerException
How can I mix the assignments of min and max and this special case with terminal '#' ?
Kind Regards
Dominik
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.13829 seconds