Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Defined 2-way link-list xtext grammar issues(Defined 2-way link-list xtext grammar issues)
Defined 2-way link-list xtext grammar issues [message #1848907] Thu, 23 December 2021 03:13 Go to next message
Nguyen Duc Dai is currently offline Nguyen Duc DaiFriend
Messages: 10
Registered: December 2021
Junior Member
I am working on creating xtext grammar but am facing 1 problem
I have a defined grammar below
I want to create an AST which 's lthe same as a 2-way link-list (Each Step will have 2 feature to refer to next step and previous step), namely:

Step1 ----(nextStep)---> Step2 ---(nextStep)---->Step3
and Step1 <---(preStep)----- Step2 <--(preStep)------ Step3

BUT i dont know how to define grammar to achive that goal

Can someone help me, plz !!!

Usecase:
 firstStep = Step
;

Step:
 name = ID
 ({Step.preStep = current} nextStep = Step)?
;
Re: Defined 2-way link-list xtext grammar issues [message #1848913 is a reply to message #1848907] Thu, 23 December 2021 09:31 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
xtext is not good with bidi refs, but you know that you can always use eContainer() to navigate to parent element. i assume it would help here

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Defined 2-way link-list xtext grammar issues [message #1848919 is a reply to message #1848913] Thu, 23 December 2021 15:25 Go to previous messageGo to next message
Nguyen Duc Dai is currently offline Nguyen Duc DaiFriend
Messages: 10
Registered: December 2021
Junior Member
Oh my bad ... I forgot this :v ... thank you very much !!!
Re: Defined 2-way link-list xtext grammar issues [message #1848924 is a reply to message #1848919] Thu, 23 December 2021 19:15 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

In regards to the bidirectional reference, it is easiest to just treat it as unidirectional in the most convenient direction. The magic of EMF will automatically maintain the opposite direction for free.

Regards

Ed Willink
Previous Topic:Strange launch and build issue with XText antlr dependency and Eclipse products
Next Topic:Handling of backslash
Goto Forum:
  


Current Time: Wed Apr 24 19:59:07 GMT 2024

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

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

Back to the top