scope with internal rule [message #641739] |
Sat, 27 November 2010 13:56 |
chuck Messages: 160 Registered: July 2010 |
Senior Member |
|
|
i have a situation like that:
ClassOp:
(
"bla bla "
"{"
( ROps+=ROp)
...
"}";
ROp :
( var=R )
....
"tot("ref= [type::R]
....
;
R returns mm::type:{R} "..." name=ID
the scope:
public IScope scope_ROp_ref(ROp el, EReference r) {
...
}
in scope provider i have problems because the attribute name with ID is internal to R and i'm getting scope into ROp on var ....and i receive 0 suggetions...
thx for the help...
[Updated on: Sat, 27 November 2010 14:35] Report message to a moderator
|
|
|
|
|
Re: scope with internal rule [message #641745 is a reply to message #641744] |
Sat, 27 November 2010 15:32 |
|
grammar org.xtext.example.mydsl.MyDsl with org.eclipse.xtext.common.Terminals
generate myDsl "http://www.xtext.org/example/mydsl/MyDsl"
ClassOp:
"bla" "bla"
"{"
( ROps+=ROp)
"}";
ROp:
var=R
"tot("ref=[R]")";
R :{R} "..." name=ID;
works for me
And what do you you do in your scope provider?
once more a concrete example with a concrete example model and a description of the problem would help.
btw
R returns mm::type:{R} "..." name=ID
looks strage for me
shouldn't that be
R returns type::R :{R} "..." name=ID;
~Christian
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
[Updated on: Sat, 27 November 2010 15:39] Report message to a moderator
|
|
|
|
|
|
Re: scope with internal rule [message #641765 is a reply to message #641764] |
Sat, 27 November 2010 18:39 |
|
Hi,
you add ROps to the Scope but the ref is of Type R - so you won't get any elements in the scope that match the type of the reference.
Maybe you want to do something like
public IScope scope_ROp_ref(ROp ref, EReference r) {
List<R> union=new ArrayList<R>();
for (ROp rop : ((ClassOp)ref.eContainer()).getROps()) {
union.add(rop.getVar());
}
return Scopes.scopeFor(union);
}
~Christian
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
|
|
|
|
Powered by
FUDForum. Page generated in 0.04010 seconds