Skip to main content



      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 06:58 Go to next message
Eclipse UserFriend
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.
Re: Creating multiple elements at the root of the model [message #1739384 is a reply to message #1739383] Sun, 31 July 2016 07:12 Go to previous messageGo to next message
Eclipse UserFriend
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?
Re: Creating multiple elements at the root of the model [message #1739387 is a reply to message #1739384] Sun, 31 July 2016 07:28 Go to previous message
Eclipse UserFriend
Thanks for the quick response. Your solution hadn't occurred to me and it is simple and elegant!
Previous Topic:Xtext 2.10 and Ecore Package Name Conventions
Next Topic:JvmTypeReference isAssignable
Goto Forum:
  


Current Time: Thu Jul 10 23:23:05 EDT 2025

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

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

Back to the top