Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Cross references in DSLs of xtext(Cross references in DSLs of xtext)
icon5.gif  Cross references in DSLs of xtext [message #1240855] Fri, 07 February 2014 06:26 Go to next message
Arshad Adavani is currently offline Arshad AdavaniFriend
Messages: 163
Registered: July 2013
Location: Bangalore
Senior Member
Hi all,
Currently I have 2 DSLs say model1.dsl1 and model2.dsl2.
I am importing model1.dsl1 in model2.dsl2.

So my grammar for import in model2.dsl2 looks like this:

ModelImport: 
	"import" importedNamespace=QualifiedIDWithWildcard
;

QualifiedIDWithWildcard:
	QualifiedID(".*")?
;

QualifiedID:
	ID("."ID)*
;


This works fine if both the .dsl1 and .dsl2 are in same folders.
If my .dsl1 is under "Example" folder i.e. Example/model1.dsl1 and model2.dsl2 is outside Example folder then how the grammar needs to be changed to support this?



Thanks in advance Smile


Arshad
Re: Cross references in DSLs of xtext [message #1240859 is a reply to message #1240855] Fri, 07 February 2014 06:30 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi cross refs is about objects not files.
Imports are for visibility.

If you actually want to crossref adsl stuff from bdsl
http://christiandietrich.wordpress.com/2012/08/07/xtext-referencing-elements-of-one-dsl-from-another-dsl/


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Cross references in DSLs of xtext [message #1240862 is a reply to message #1240859] Fri, 07 February 2014 06:31 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
P.s. by default it is OK if both files are in the same project or in a referenced project

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Cross references in DSLs of xtext [message #1240895 is a reply to message #1240862] Fri, 07 February 2014 07:45 Go to previous messageGo to next message
Arshad Adavani is currently offline Arshad AdavaniFriend
Messages: 163
Registered: July 2013
Location: Bangalore
Senior Member
Hi Christian,
I just want this because I don't want to include namespace in referenced objects always.
i.e. instead of SomeName.a1, SomeName.a2, I will add an import statement which says

import SomeName.*;

and then use a1, a2 and so on directly. But when this SomeName dsl is present in the other folder as explained above, I am not able to refer it, it says it couldn't resolve it.


Regards,
Arshad


Arshad
Re: Cross references in DSLs of xtext [message #1240898 is a reply to message #1240895] Fri, 07 February 2014 07:50 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

this will work out of the box if
. you reference the stuff as described in my blog
- have a construct with importedNamespace

so what do you mean with other folder? as i said: if the other folder is in the same project or a referenced project it is fine.
and it will work out of the box.

if not you have to share more detail...


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:javadoc Problem with code compiled by Xtend 2.5.1
Next Topic:Generating Java code for models with link errors
Goto Forum:
  


Current Time: Sat Apr 20 00:28:44 GMT 2024

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

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

Back to the top