Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » narrow cross references
narrow cross references [message #963982] Tue, 30 October 2012 02:55 Go to previous message
sri sri is currently offline sri sri
Messages: 20
Registered: October 2012
Junior Member
Hi All,

My grammar for DSL in xtext is like below:

Model: cs+=Company* employees+=Emp* block=Block
;
Block: emp1=company_crossRef
| emp_id=empId_crossRef
;

company_crossRef: empId1=[Company] ;
empId_crossRef: emp1=[Emp] ':' empId1=[empId];

Company: c='Company' name=ID;

Emp: r='Emp' name=ID '{' empIdName+= empId* '}'';' ;
empId: 'Employee_id' name=ID;

I have different companies, having different employees with different names and Ids. I need cross referencing for company names only or for employee with his Id. Both of these separately work for me, by providing dynamic scope in scope provider. and my scope provider looks like:

IScope scope_empId_crossRef_empId1( empId_crossRef emp, EReference ref) {
return Scopes.scopeFor(emp.getEmp1().getEmpIdName());
}

In the language, cross referencing for employee with his Id works, however cross referencing for company names is getting messed up with the cross referencing of employee and errors out. Do I need to write my scope provider in any different way for both of these cross references to work correct or is there any other class i need to change for this to work?

The current drop down in the language is like this:

Company amazon
Company sony

Emp amazon_emp1
{
Employee_id amazon_1
Employee_id amazon_2
};

sony :

with error on line sony :

Thanks,
Sri.
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic:Setting Developer Environment
Next Topic:Exclude files from indexing
Goto Forum:
  


Current Time: Thu May 23 16:22:42 EDT 2013

Powered by FUDForum. Page generated in 0.01650 seconds