| narrow cross references [message #963982] |
Tue, 30 October 2012 02:55  |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| Re: narrow cross references [message #968198 is a reply to message #965704] |
Fri, 02 November 2012 05:24   |
sri sri Messages: 20 Registered: October 2012 |
Junior Member |
|
|
Hi,
The dropdown is successfully showing all fully qualified names:
sony:sony_emp:sony_1
amazon_emp1:amazon_1
In case of first example, can we have qualified name only upto: "sony:sony_emp" and then ctrl+space should show me : and then the list of corresponding employee Ids
Similarly, I should be able to get : and amazon_1 after amazon_emp1
[Updated on: Fri, 02 November 2012 05:51] Report message to a moderator
|
|
|
|
|
|
|
| Re: narrow cross references [message #971915 is a reply to message #968295] |
Mon, 05 November 2012 03:01  |
sri sri Messages: 20 Registered: October 2012 |
Junior Member |
|
|
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] Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.02556 seconds