Skip to main content



      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] Wed, 22 December 2021 22:13 Go to next message
Eclipse UserFriend
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 04:31 Go to previous messageGo to next message
Eclipse UserFriend
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
Re: Defined 2-way link-list xtext grammar issues [message #1848919 is a reply to message #1848913] Thu, 23 December 2021 10:25 Go to previous messageGo to next message
Eclipse UserFriend
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 14:15 Go to previous message
Eclipse UserFriend
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: Thu Jul 03 04:43:27 EDT 2025

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

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

Back to the top