Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » link reference issue
link reference issue [message #760435] Fri, 02 December 2011 11:28 Go to next message
Vlad Dumitrescu is currently offline Vlad DumitrescuFriend
Messages: 431
Registered: July 2009
Location: Gothenburg
Senior Member
Hi!

I have some rule like
Function: Clause (';' Clause)* '.' ;
Clause: ID '(' Args ')' '->' Expressions ;


Each clause has the same name (ID) and it actually belongs naturally to the function itself. Is there a way to let the function inherit the name from the first clause without changing the grammar?

The grammar change feels inelegent
Function: ID Clause0 (';' Clause)* '.' ;
Clause0 returns Clause: '(' Args ')' '->' Expressions ;
Clause: ID '(' Args ')' '->' Expressions ;


best regards,
Vlad
Re: link reference issue [message #760596 is a reply to message #760435] Sat, 03 December 2011 10:20 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
Hi,

am not sure what you exactly want to do since you dont have any assignments in your grammar which is abolutely unrealisitic. never the less if you want to calculate a qualified name (the thing that is used for cross references) with a custom logic this is usually done in the IQualifiedNameProvider. so subclassing and customizing DefaultDeclarativeQualifiedNameProvider should do the trick.

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: link reference issue [message #760616 is a reply to message #760596] Sat, 03 December 2011 14:48 Go to previous messageGo to next message
Vlad Dumitrescu is currently offline Vlad DumitrescuFriend
Messages: 431
Registered: July 2009
Location: Gothenburg
Senior Member
Hi Christian!

Well the example was stripped down of assignments, of course they are present in the full grammar.

Thanks a lot for the pointers, I will look at IQualifiedNameProvider. I suppose it's the same place to look at if the references are not just names but may be more complicated expressions?

best regards,
Vlad
Re: link reference issue [message #760618 is a reply to message #760616] Sat, 03 December 2011 15:22 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
you may have a look at this blog http://blogs.itemis.de/stundzig/archives/773 and its follow ups to be a basic understanding of the topic

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: link reference issue [message #760653 is a reply to message #760618] Sat, 03 December 2011 21:37 Go to previous message
Vlad Dumitrescu is currently offline Vlad DumitrescuFriend
Messages: 431
Registered: July 2009
Location: Gothenburg
Senior Member
Great! Thanks Christian!

regards,
Vlad
Previous Topic:Trigger JDT JavaDoc Formatter for Doc-Comments
Next Topic:[Xtend2] Generating user editable C++ code
Goto Forum:
  


Current Time: Thu Mar 28 17:37:40 GMT 2024

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

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

Back to the top