Skip to main content



      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 11:45 Go to next message
Eclipse UserFriend
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 12:48 Go to previous messageGo to next message
Eclipse UserFriend
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)*;
Re: [Xtext 2.3] Cross references in DSL across multiple DSL files? [message #1023302 is a reply to message #1023217] Sat, 23 March 2013 18:31 Go to previous message
Eclipse UserFriend
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: Mon Jul 14 20:33:32 EDT 2025

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

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

Back to the top