Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Bi-directional reference
Bi-directional reference [message #1851123] Mon, 28 March 2022 12:01 Go to next message
John Henbergs is currently offline John HenbergsFriend
Messages: 239
Registered: October 2020
Senior Member
Hi all,

I was wondering how I can write the grammar for bi directional references where one side is a containment.
If we take the following example:

index.php/fa/41819/0/

The only way I can think of writing this is the following:

Test returns Test:
{Test}
test = [Test | FQN]
 ('{' testeOpposite +=Test ( "," testeOpposite +=Test)* '}' )


However, this is not the same because in this case I get:
index.php/fa/41820/0/

Is there any way around this?

Thank you!
Re: Bi-directional reference [message #1851128 is a reply to message #1851123] Mon, 28 March 2022 13:16 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
maybe you can simply use a containment ref and do the opposite e.g. via giving
the generic eContainer a different name via eoperation

or you simply just use eContainer and live with it.


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Bi-directional reference [message #1851135 is a reply to message #1851128] Mon, 28 March 2022 15:38 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

Xtext is a powerful grammar tool that often produces a useful Ecore metamodel as a side effect.

However if you want to control your metamodel explicitly rather than accidentally you should treat your *.ecore development as your primary activity and then use it with rather than generate it from Xtext.

Regards

Ed Willink
Previous Topic:xtend src-gen folder relative to dsl file
Next Topic:Xtext maven plugin language order
Goto Forum:
  


Current Time: Fri Apr 19 16:04:53 GMT 2024

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

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

Back to the top