narrow cross references [message #963982] |
Tue, 30 October 2012 02:55  |
Eclipse User |
|
|
|
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: narrow cross references [message #971915 is a reply to message #968295] |
Mon, 05 November 2012 03:01  |
Eclipse User |
|
|
|
Hi,
thank you for your replies.
Can I get cross referencing of both at a time with eager linking instead of xtext's lazy linking? I tried by mentioning eager linking in mwe2 file, however did not see any difference in the confusion of xtext after the first ":" .
Is customization of doGenerate method or ProposalProvider class related to the cross referencing problem i am trying to solve?
[Updated on: Wed, 07 November 2012 02:37] by Moderator
|
|
|
Powered by
FUDForum. Page generated in 0.07529 seconds