Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Xtext grammar generated from ECORE( Xtext grammar generated from ECORE forces order of attributes)
Xtext grammar generated from ECORE [message #778197] Wed, 11 January 2012 15:59 Go to next message
Marcello Vitaletti is currently offline Marcello VitalettiFriend
Messages: 7
Registered: July 2009
Junior Member
I am using Xtext to generate the grammar from a plain Ecore model using INDIGO SR1 with Xtext 2.0.1 SDK.
So for example I am getting the following grammar for a 'Pipe' class defined in my e Ecore model

Pipe returns Pipe:
{Pipe}
'Pipe'
name=EString
'{'
('length' length=EDouble)?
('fromNode' fromNode=[Node|EString])?
('toNode' toNode=[Node|EString])?
('group' group=[PipeGroup|EString])?
('data' data=PipeGroupData)?
'}';


When in the editor I tried to define a pipe I saw that I was forced to specify the attributes in the exact order in which they appear in the above grammar (length, fromNode, toNode, ...).

How can I avoid that restriction, perhaps changing the Ecore model or by tweaking the above grammar?

Thanks a lot!
Re: Xtext grammar generated from ECORE [message #778202 is a reply to message #778197] Wed, 11 January 2012 16:28 Go to previous message
Meinte Boersma is currently offline Meinte BoersmaFriend
Messages: 434
Registered: July 2009
Location: Leiden, Netherlands
Senior Member
You'll have to use an unordered group to achieve that: it's a standard feature of the Xtext grammar language and documented in the Reference Guide.


Re: Xtext grammar generated from ECORE [message #778420 is a reply to message #778197] Wed, 11 January 2012 16:28 Go to previous message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
Please refer to the section on unorderd groups in the reference
documentation.

Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com

Am 11.01.12 16:59, schrieb Marcello Vitaletti:
> I am using Xtext to generate the grammar from a plain Ecore model using
> INDIGO SR1 with Xtext 2.0.1 SDK. So for example I am getting the
> following grammar for a 'Pipe' class defined in my e Ecore model
> Pipe returns Pipe:
> {Pipe}
> 'Pipe'
> name=EString
> '{'
> ('length' length=EDouble)?
> ('fromNode' fromNode=[Node|EString])?
> ('toNode' toNode=[Node|EString])?
> ('group' group=[PipeGroup|EString])?
> ('data' data=PipeGroupData)?
> '}';
>
> When in the editor I tried to define a pipe I saw that I was forced to
> specify the attributes in the exact order in which they appear in the
> above grammar (length, fromNode, toNode, ...).
> How can I avoid that restriction, perhaps changing the Ecore model or by
> tweaking the above grammar?
> Thanks a lot!
Previous Topic:Operator mapping wrong since all the overloaded primitive methods are there
Next Topic:Navigating the model tree with xtend
Goto Forum:
  


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

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

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

Back to the top