Stefano Cottafavi schrieb:
> I would like to build a terminal rule that returns value of type float.
> import "http://www.eclipse.org/emf/2002/Ecore" as ecore
> terminal ENG returns ecore::EFloat :
> ('-'|'+')? (INT '.' INT| '.' INT | INT '.') ('e' ('-'|'+') INT)?;
> (the rule definition come from another thread in this forum about how to
> define a Real)
> I stick with the same error marker in the editor --- java.lang.String
> cannot be cast to java.lang.Float ...on every "supposed" float value
> Any idea?
Horacio Hoyos Messages: 177 Registered: October 2009 Location: UK
I am trying to do the same, bur I wasn't able to figure in what class to add the methods. I tried creating a new one that extends DefaultTerminalConverters as suggested in the manual, but I think it is not being compiled and added to the generated dsl files.
Horacio Hoyos Rodriguez
University Of York
I had similar problems and tried my way with value converter.
However, if you use the latest milestone of 0.8.0 stream the value converter will automatically delegate to the EcoreFactory for datatypes without an explicit conversion rule. Floats, Doubles, Dates etc should work out of the box this way.
Michel Simeon schrieb:
> I had similar problems and tried my way with value converter.
> However, if you use the latest milestone of 0.8.0 stream the value
> converter will automatically delegate to the EcoreFactory for datatypes
> without an explicit conversion rule. Floats, Doubles, Dates etc should
> work out of the box this way.
As long as you stick with the string representation used in EcoreFactory.
For float that is the contract of
Need professional support for Xtext and EMF?
Go to: http://xtext.itemis.com
Twitter : @svenefftinge
Blog : blog.efftinge.de