Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » arbitrary returns
arbitrary returns [message #772745] Fri, 30 December 2011 13:34 Go to next message
Mauro Condarelli is currently offline Mauro CondarelliFriend
Messages: 428
Registered: September 2009
Senior Member
Hi,
is there a way to associate arbitrary values to productions?

something like:

Num returns ecore::EInt: [num=0]"zero" | [num=1]"one" | [num=2]"two";

Regards
Mauro
Re: arbitrary returns [message #772750 is a reply to message #772745] Fri, 30 December 2011 13:40 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14669
Registered: July 2009
Senior Member
Hi this is done with an ValueConverter

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: arbitrary returns [message #772755 is a reply to message #772750] Fri, 30 December 2011 13:54 Go to previous messageGo to next message
Mauro Condarelli is currently offline Mauro CondarelliFriend
Messages: 428
Registered: September 2009
Senior Member
Il 30/12/2011 14:40, Christian Dietrich ha scritto:
> Hi this is done with an ValueConverter
You mean I should override two classes
(AbstractDeclarativeValueConverterService & Xxx implements
IValueConverter<Integer>) to associate a value with a token?

Doing so seems the right way to go when You need a real conversion
(e.g.: String<=>Integer), but to associate a single static value to a
token seems a bit too much.

Am I forgetting something?

TiA
Mauro
Re: arbitrary returns [message #772759 is a reply to message #772755] Fri, 30 December 2011 14:04 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14669
Registered: July 2009
Senior Member
Hi even for simple stupid INTs such a Conversion is done

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Fri, 30 December 2011 16:23]

Report message to a moderator

Previous Topic:Constructor Inference (JvmConstructor)
Next Topic:validation invocation from the generator.Main
Goto Forum:
  


Current Time: Sat Apr 27 00:02:40 GMT 2024

Powered by FUDForum. Page generated in 0.04096 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top