Skip to main content



      Home
Home » Modeling » TMF (Xtext) » cross-reference ambiguity with grammar rules
cross-reference ambiguity with grammar rules [message #1696024] Thu, 21 May 2015 05:06 Go to next message
Eclipse UserFriend
I currently have cross-reference defined in a place that will solve a lot of issues in the cross referencing but I have to OR with this cross reference another rule that causes ambiguity and adding a syntactic predicate for anyone of them totally disables the other.
Example:

leaf_name returns LeafName:

declarations=[Declarations] | otherName=ID | string=String

;

Declarations cross reference a lot of rules that has something like ('int' name=ID)
All I want from the parser/linker is to link/cross-reference the object IF and ONLY IF it found a declaration with this name otherwise it considers it as a normal ID with no cross-reference.
I tried adding syntactic predicates to anyone of them but It didnt solve my issue.
Any help will be appreciated Smile
Re: cross-reference ambiguity with grammar rules [message #1696027 is a reply to message #1696024] Thu, 21 May 2015 05:14 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

since cross references are not a parsing thing but done afterwards, the grammar from a parser point of view looks like

declarations=ID | otherName=ID | string=String

=> on parsing side this cannot be resolved.

of course you could hook into linking and could create a fake Declarations on the fly,
but this is not what you want to do.

if this is not an existing language i strictly recommend you to differentiate both cases syntactically

another possiblility would be not to cross link at all and do the byname lookup in generation, hyperlinking etc manually
Re: cross-reference ambiguity with grammar rules [message #1696029 is a reply to message #1696027] Thu, 21 May 2015 05:19 Go to previous messageGo to next message
Eclipse UserFriend
what is the byname lookup? will it do the same job as cross referencing in the grammar? I hope the byname lookup can get me out of grammar cross referencing.
Does hyperlinking help in adding a link between two objects and adding them in the index?
I actually added the cross-reference just for the sake of scoping (and later I found it enabled the go to declaration and quick fixes for free Very Happy ).

[Updated on: Thu, 21 May 2015 05:29] by Moderator

Re: cross-reference ambiguity with grammar rules [message #1696030 is a reply to message #1696029] Thu, 21 May 2015 05:28 Go to previous messageGo to next message
Eclipse UserFriend
No,

then you would not have cross reference and you would have to care yourself.
Re: cross-reference ambiguity with grammar rules [message #1696032 is a reply to message #1696030] Thu, 21 May 2015 05:30 Go to previous messageGo to next message
Eclipse UserFriend
how can I start in byname lookup and these stuff?
Re: cross-reference ambiguity with grammar rules [message #1696033 is a reply to message #1696030] Thu, 21 May 2015 05:30 Go to previous message
Eclipse UserFriend
of course you could try to dive deep into metamodel and linking and

- use a metamodelpostprocesstor to add the cross reference to the model
- make it transient though the transientvalueservice
- adopt linking with your logik.

but it cannot deeply help you with that and dont know if it will finally work out.
Previous Topic:Debugging parser
Next Topic:another code generation question
Goto Forum:
  


Current Time: Sun Jul 27 06:52:16 EDT 2025

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

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

Back to the top