| Ambiguities in xText scoping "Context" [message #1006852] |
Sat, 02 February 2013 17:26  |
Frank Tagne Messages: 7 Registered: August 2012 |
Junior Member |
|
|
Hello,
I'm dealing an scoping problem in my xtext language.
Let's see the grammar below and the associated MM (see attached)
CallService returns CallService:
{CallService}
'CallService' (=>'::'name=EString)?
'{'
('sourcePort' sourcePort=PortRef)?
('targetPort' targetPort=PortRef)?
'}';
PortRef returns PortRef: {PortRef} referencedPort=[PortEvent];
PortEvent returns PortEvent:'PortEvent'{PortEvent} (=>'::'name=EString)?;

I would like to provide scoping rules for targetPort and sourcePort in such that the targetPort's scope should not contained PortRef assigned to sourcePort ( and vis versa).
big question here is : how can i know where am i ?
To do it, i need to know where i'm : the Context. Precisly, i would like have the "PortRef" instance as Context's return in the function getScope(context, Ereference), but it's not the case.
I tried this function scope_PortRef_referencedPort(Ctx,ref) in scope, but the Context passed in my function is an instance of CallService and not of PortRef like it supposed to be.
And that despite of the fact that i put {PortRef} intructions to force that the object creation.
Am i missing something ?
i hope i was clear.
Best regards.
F.
[Updated on: Sat, 02 February 2013 17:28] Report message to a moderator
|
|
|
|
|
|
|
|
| Re: Ambiguities in xText scoping "Context" [message #1007069 is a reply to message #1007013] |
Mon, 04 February 2013 05:41  |
Frank Tagne Messages: 7 Registered: August 2012 |
Junior Member |
|
|
Re,
Quote:I'm hoping the ref parameter is a ReferencedPort so perhaps its getName() will be either "sourcePort" or "targetPort".
ref parameter is an EReference. Its getName() is "referencedPort" and its eContainer() return an EClass ( not an EObject).
F.
|
|
|
Powered by
FUDForum. Page generated in 0.01993 seconds