Serializing a manually created xtext model [message #486953] |
Mon, 21 September 2009 06:00  |
Eclipse User |
|
|
|
Dear Xtext team,
I have created a grammar, say MyDsl.
Using the MyDslFactory class, Ive created a model and would like to serialize it into the textual representation.
In my grammar I have an annotation terminal rule:
terminal ML_DESC returns ecore::EString : ('@desc') WS* '{' -> '}';
How do I configure the serializer to include this terminal rule so that the textual representation will display the"@desc" with the description annotation.
So far, I have been able to print out the value of the annotation without the "@desc".
In my code, I have created the model, and added it to the contents of a resource before calling save. Therefore, the XtextResource does not have a parseresult.
Any hints into the right direction would be appreciated!
Many thanks
Dana
|
|
|
Re: Serializing a manually created xtext model [message #486990 is a reply to message #486953] |
Mon, 21 September 2009 08:42   |
Eclipse User |
|
|
|
Hi Dana,
did you implement a value converter for your ML_DESC?
The toString(String value) should prepend the @desc keyword before the
actual value of your comment.
See
http://www.eclipse.org/Xtext/documentation/0_7_2/xtext.html# valueconverter
Hope that helps,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com
Dana Wong schrieb:
> Dear Xtext team,
>
> I have created a grammar, say MyDsl. Using the MyDslFactory class, Ive
> created a model and would like to serialize it into the textual
> representation.
>
> In my grammar I have an annotation terminal rule:
>
> terminal ML_DESC returns ecore::EString : (mailto:'@desc') WS* '{' -> '}';
>
> How do I configure the serializer to include this terminal rule so that
> the textual representation will display the"@desc" with the description
> annotation.
>
> So far, I have been able to print out the value of the annotation
> without the "@desc".
>
> In my code, I have created the model, and added it to the contents of a
> resource before calling save. Therefore, the XtextResource does not
> have a parseresult.
>
> Any hints into the right direction would be appreciated!
> Many thanks
> Dana
|
|
|
|
Powered by
FUDForum. Page generated in 0.03776 seconds