Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » How to provide a valid reference of an imported method(How to provide a valid reference of an imported method)
How to provide a valid reference of an imported method [message #791759] Mon, 06 February 2012 08:23 Go to next message
rahul kumar is currently offline rahul kumarFriend
Messages: 4
Registered: July 2009
Junior Member
I have a grammar that uses importURI statement to import the required DSLs and The DSLs have almost same informations. e.g.

in myFirst.mydsl:

entity student{
roll 1;
name "rahul"
}

in mySecond.mydsl:

entity student{
roll 2;
name "rahul"
}


Then in my another dsl I want to use the student of myFirst.mydsl

So I write something like:

import "mySecond.mydsl"
import "myFirst.mydsl"
colEntity college1{
enrolledStudent : student // I am considering enrolledStudent as String
}

But in this case I can get the student reference only from mySecond.mydsl and I need to change the import order to get the reference from myFirst.dsl. This creates a problem if want students from both the dsl.

Isn't there any way by which I can refer to both the students in the same file. i.e. I want something like:

import "mySecond.mydsl" as mySecond
import "myFirst.mydsl" as myFirst
colEntity college1{
enrolledStudent : myFirst.student
}


Re: How to provide a valid reference of an imported method [message #791816 is a reply to message #791759] Mon, 06 February 2012 09:47 Go to previous message
Meinte Boersma is currently offline Meinte BoersmaFriend
Messages: 434
Registered: July 2009
Location: Leiden, Netherlands
Senior Member
You'll have to customize scoping for this. You can't use any of the out-of-the-box scoping fragments because the qualified names depend on the particular import statements in a DSL file, so they're not constant throughout. It's not very difficult to do this: e.g., the Xtext grammar language has the same construct. You can also look at how it did this here.

Previous Topic:Best practice with this xtend function?
Next Topic:Strange Parser-Behavior
Goto Forum:
  


Current Time: Tue Apr 23 17:21:10 GMT 2024

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

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

Back to the top