Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » [Xtext 2.3] Cross references in DSL across multiple DSL files?
[Xtext 2.3] Cross references in DSL across multiple DSL files? [message #1023202] Sat, 23 March 2013 15:45 Go to next message
Alan DW is currently offline Alan DWFriend
Messages: 119
Registered: March 2012
Senior Member
Hello everyone,

I've written a DSL in Xtext 2.3 and the editor is working fine, except for one detail. I need to be able to cross-reference instances specified in one DSL file in a different file within the same project (preferably via qualified name). This works well within one file with the default configuration, but across file borders, I only have access to the root objects, not to the objects contained within them.

I've tried to replace this line:

fragment = exporting.QualifiedNamesFragment {}


... with this:

fragment = exporting.SimpleNamesFragment {}


in the MWE2 file, which makes it work, but I would strongly prefer to have qualified names instead of the plain names. I also tried to define the rule

QualifiedName: ID ('.' ID)*;


as an unreferenced parser rule in my .xtext file, but it did not change anything.


Any hints about what has to be changed in the default configuration to make qualified name references in the DSL files work across file borders? Basically I just want to be able to reference *any* object from *any* file by its qualified name, no restrictions needed.


Thanks,


Alan
Re: [Xtext 2.3] Cross references in DSL across multiple DSL files? [message #1023217 is a reply to message #1023202] Sat, 23 March 2013 16:48 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13322
Registered: July 2009
Senior Member
Hi,

it works out of the box with qualified names too besides one fact

ref=[Type] is short for ref=[Type|ID] an thus allows only simple names => you have to use imports or change the grammar to

ref=[Type|QualifiedName] with QualifiedName: ID ('.' ID)*;


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: [Xtext 2.3] Cross references in DSL across multiple DSL files? [message #1023302 is a reply to message #1023217] Sat, 23 March 2013 22:31 Go to previous message
Alan DW is currently offline Alan DWFriend
Messages: 119
Registered: March 2012
Senior Member
Oh my god... If only somebody had told me that earlier... xD
It's working perfectly now, thanks a lot Christian!

Best regards,

Alan
Previous Topic:Logical containers for expressions (again)
Next Topic:slf4j logging for runtime debugging
Goto Forum:
  


Current Time: Wed Jan 29 13:45:01 GMT 2020

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

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

Back to the top