I am trying to generate code from my grammar. I would like to know how to get the final value e not the object. For example, I have:
Interval:
'[' lower_bound=Expr ',' upper_bound=Expr ']'
| '[' lower_bound=Expr ',' upper_bound=Expr'['
| ']' lower_bound=Expr ',' upper_bound=Expr ']'
| ']' lower_bound=Expr ',' upper_bound=Expr '['
;
Expr:
literal=INT
| integer=INT '.' decimal=INT
| no_constraint?='infty'
| group=GroupName
| metric=NM
| right_side=Atomic Operator left_side=Atomic
;
In the code generator template I have:
'''
Term Value = «interval.lower_bound», «interval.upper_bound»
'''
I entered in the file of the language:
[10, 30]
When it generates a code it puts the object:
Term Value = org.xtext.sla.dyslacc.impl.ExprImpl@2a421168 (literal: 10, integer: 0, decimal: 0, no_constraint: false, metric: null), org.xtext.sla.dyslacc.impl.ExprImpl@5784d884 (literal: 30, integer: 0, decimal: 0, no_constraint: false, metric: null)
and what I wanted is simple the value entered in the template no matter if it is a literal or constraint :
10,30
(everything as string is fine)
any idea??
thank you