transform model in XMI to xtext model [message #531059] |
Mon, 03 May 2010 10:38  |
Eclipse User |
|
|
|
Hi guys,
I have build the textual DSL, and I know the code to transform the textual DSL file to XMI. However, how to transform the XMI model back to textual DSL? Any advice?
Thanks.
Yu
|
|
|
|
|
Re: transform model in XMI to xtext model [message #531160 is a reply to message #531071] |
Mon, 03 May 2010 19:38   |
Eclipse User |
|
|
|
Hi guys,
I have made the transformation from XMI to xtext working. However, there is one interesting problem:
In my xtext, I defined my own SHORT type, which is:
terminal SHORT returns ecore:Eshort :
INT's'
;
I also defined my own TerminalConverters to get the short value by removing the last 's'. It works perfect, and transforming the xtext file to XMI model also works fine.
However, now when I transform the XMI model back to xtext file, the short values in the xtext file does not contain the 's', which is not a correct xtext file in my grammar.
Is there anything I can do to solve this problem?
Thanks a lot.
Yu
[Updated on: Mon, 03 May 2010 19:39] by Moderator
|
|
|
Re: transform model in XMI to xtext model [message #531201 is a reply to message #531160] |
Tue, 04 May 2010 03:44   |
Eclipse User |
|
|
|
Hi Yu,
please override the toString(Value) method in your value converter
implementation that removes the 's' from the parsed input. The
toString() should add it as it is required in the concrete syntax.
Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com
Am 04.05.10 01:38, schrieb Yu Sun:
> Hi guys,
>
> I have made the transformation from XMI to xtext working. However, there
> is one interesting problem:
>
> In my xtext, I defined my own SHORT type, which is:
>
> <CODE>
> terminal SHORT returns ecore:Eshort :
> INT's'
> ;
> </CODE>
>
> I also defined my own TerminalConverters to get the short value by
> removing the last 's'. It works perfect, and transforming the xtext file
> to XMI model also works fine.
>
> However, now when I transform the XMI model back to xtext file, the
> short values in the xtext file does not contain the 's', which is not a
> correct xtext file in my grammar.
>
> Is there anything I can do to solve this problem?
>
> Thanks a lot.
>
> Yu
>
>
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.12541 seconds