Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » cross-references without grammar(Is it possible to configure cross-references outside of the .xtext file?)
cross-references without grammar [message #1743678] Sun, 18 September 2016 21:48 Go to next message
Jonathan L. is currently offline Jonathan L.Friend
Messages: 24
Registered: May 2016
Junior Member
Hi,

I was wondering if it's possible to add cross-references outside of the grammar.
I am a bit constrained to add them inside of it.

Is there a way, maybe via scopeprovider, to apply that?
Re: cross-references without grammar [message #1743697 is a reply to message #1743678] Mon, 19 September 2016 06:01 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14669
Registered: July 2009
Senior Member
Can you be a bit more specific in the question

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: cross-references without grammar [message #1743700 is a reply to message #1743678] Mon, 19 September 2016 06:24 Go to previous messageGo to next message
Anton Kosyakov is currently offline Anton KosyakovFriend
Messages: 9
Registered: March 2016
Junior Member
What is your case? Why cannot you change a grammar?

Anyway you can install synthetic references as a derived state with SyntheticLinkingSupport:https://github.com/eclipse/xtext-core/blob/e1a4782403497dd27f73276c409049a3d3ecdcf9/org.eclipse.xtext/src/org/eclipse/xtext/linking/lazy/SyntheticLinkingSupport.java#L35


Get professional support from the Xtext committers at www.typefox.io.
Re: cross-references without grammar [message #1743712 is a reply to message #1743700] Mon, 19 September 2016 07:50 Go to previous messageGo to next message
Jonathan L. is currently offline Jonathan L.Friend
Messages: 24
Registered: May 2016
Junior Member
Quote:
What is your case? Why cannot you change a grammar?

The problem is that I've just ported a grammar from a language and not defined it by myself.
There I got multiple rules using the same terminal rule.
for example:
Dcl_var:
	'var' type=Type name=ID_VAR;
Dcl_int:
	'event' type=Type name=ID_VAR;

when I now define cross-references in the expression rule e.g. it can't handle both rules.

Quote:
Can you be a bit more specific in the question

I want to make a cross-reference to both of the rules. Because it didn't work in the grammar I was asking if there is another way to define them.
Re: cross-references without grammar [message #1743713 is a reply to message #1743712] Mon, 19 September 2016 07:54 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14669
Registered: July 2009
Senior Member
I dont get that Point:

AbstractDecl: Dcl_var | Dcl_int;

MyRef: ref=[AbstractDecl|ID_VAR]


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: cross-references without grammar [message #1743728 is a reply to message #1743713] Mon, 19 September 2016 09:43 Go to previous messageGo to next message
Jonathan L. is currently offline Jonathan L.Friend
Messages: 24
Registered: May 2016
Junior Member
Hm okay, thanks!
I've tried it before with some kind of
( var=[Dcl_var|ID_VAR] | event=[Dcl_int|ID_VAR] )
which didn't worked for both

But now it works, thank you
Re: cross-references without grammar [message #1743986 is a reply to message #1743728] Wed, 21 September 2016 09:59 Go to previous messageGo to next message
Jonathan L. is currently offline Jonathan L.Friend
Messages: 24
Registered: May 2016
Junior Member
I got one more question to this..
Is it not possible to cross-reference a list of name?
like:
name+=ID_VAR ( ',' name+=ID_VAR )*
Re: cross-references without grammar [message #1743998 is a reply to message #1743986] Wed, 21 September 2016 11:47 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14669
Registered: July 2009
Senior Member
You have to adapt idefaultresourcedescrptionstrategy to put a element under different names into the index. Locally you need to adapt importednamespaceawarelocalscopeprovider

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: cross-references without grammar [message #1744040 is a reply to message #1743998] Wed, 21 September 2016 16:24 Go to previous message
Jonathan L. is currently offline Jonathan L.Friend
Messages: 24
Registered: May 2016
Junior Member
Thanks, I will have a look at it
Previous Topic:use of EOF
Next Topic:Providing library for an XText IDEA plugin
Goto Forum:
  


Current Time: Sat Apr 27 03:30:23 GMT 2024

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

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

Back to the top