Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Creating multiple elements at the root of the model
Creating multiple elements at the root of the model [message #1739383] Sun, 31 July 2016 10:58 Go to next message
Horacio Hoyos is currently offline Horacio HoyosFriend
Messages: 240
Registered: October 2009
Location: Mexico
Senior Member

As an example consider a simple DSL to construct expressions (I have the exp metamodel):

TextualPathExp returns TextualPathExp:
  'path' name=EString path=Path 'end';

Path ...


I would like to know if it is possible to have a file that has multiple path instances, e.g.

path one <path...> end;
path two <path...> end;
....
path n <path...> end;


And the resulting resource when I parse the file would have multiple TextualPathExp instances at the root.

I know I could add a containing class that can contain may TextualPathExp and add a rule:

TPContainer:
    (TextualPathExp)+


But I would prefer not (read as I cant) modify the metamodel.


Horacio Hoyos Rodriguez
Kinori Tech
Need professional support for Epsilon, EMF?
Go to: https://kinori.tech
Re: Creating multiple elements at the root of the model [message #1739384 is a reply to message #1739383] Sun, 31 July 2016 11:12 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14651
Registered: July 2009
Senior Member
this is not possible sry.

so what about doing both:

ifer a second metamodel that consists only of the root and has a list of elements of the imported metamodel?


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Creating multiple elements at the root of the model [message #1739387 is a reply to message #1739384] Sun, 31 July 2016 11:28 Go to previous message
Horacio Hoyos is currently offline Horacio HoyosFriend
Messages: 240
Registered: October 2009
Location: Mexico
Senior Member

Thanks for the quick response. Your solution hadn't occurred to me and it is simple and elegant!

Horacio Hoyos Rodriguez
Kinori Tech
Need professional support for Epsilon, EMF?
Go to: https://kinori.tech
Previous Topic:Xtext 2.10 and Ecore Package Name Conventions
Next Topic:JvmTypeReference isAssignable
Goto Forum:
  


Current Time: Wed Feb 21 19:44:40 GMT 2024

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

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

Back to the top