STRING serialization not producing quotes if no whitespace [message #885083] |
Tue, 12 June 2012 12:40 |
Thomas Altenburger Messages: 3 Registered: June 2012 |
Junior Member |
|
|
Hello,
I would like to serialize ecore files conforming to an xtext grammar. I bound the ecore EString type to the STRING terminal (not STRING | ID, as automatically generated when deriving ecore with xtext) because I want strings to be single/double quoted.
The grammar works as expected with the plugin. The problem is that when I tried to serialize an xmi resource through my grammar, EString are not quoted if they do not contain whitespaces (as if they were serialized to ID, despite my grammar).
Any hint on this? Thanks.
[Updated on: Tue, 12 June 2012 12:42] Report message to a moderator
|
|
|
|
Re: STRING serialization not producing quotes if no whitespace [message #885684 is a reply to message #885291] |
Wed, 13 June 2012 12:40 |
Thomas Altenburger Messages: 3 Registered: June 2012 |
Junior Member |
|
|
Hi Christian,
After some more research, I found that Xtext calls org.eclipse.xtext.common.services.Ecore2XtextTerminalConverters when it encounters an EString. And it effectively tries to match the ID_PATTERN before trying to make it fit into a STRING (see Ecore2XtextTerminalConverters). Quite logical.
The problem is the following rule I would like to work when serializing:
EString returns ecore::EString:
STRING; // instead of ID | STRING
But it seems that xtext does not allow ecore data type to be "redefined".
When serializing ecore data types, xtext simply ignore such rules by considering ecore data types as terminals. Making serialized ecore to not conform to the grammar.
Any way to override Ecore2XtextTerminalConverters?
[Updated on: Wed, 13 June 2012 12:43] Report message to a moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03708 seconds