Xtext enum value setting -
i have ecore metamodel this
pattern direction:direction patterndetail:details direction both=0 left=1 right=2
this simplification representation of graph query language use patterns. pattern direction , details (name, whatever)
in grammar want parse input direction information on 2 places, example
<-[patterndetails]-> (direction = both) -[patterndetails]-> (direction = right) <-[patterndetails]- (direction = left)
so have created rule
pattern returns pattern: '<-'patterndetails=patterndetails'->' |'<-'patterndetails=patterndetails'-' |'-'patterndetails=patterndetails'->' ;
but can't figure out how can set direction associated. try add direction=direction.both
@ end of first line not possible. seems strange because possible affect value estring attribute example, not enums.
am missing on enum access or doing wrong ?
you can have multiple rules same enum
pattern returns pattern: '<-' patterndetails=patterndetails direction=both | '<-' patterndetails=patterndetails direction=left | '-' patterndetails=patterndetails direction=right; enum direction: both | left | right; enum both returns direction: both='->'; enum right returns direction: right='->'; enum left returns direction: left='-';
Comments
Post a Comment