[Xtext] Problem: Scoping on objects at runtime [message #544293] |
Fri, 02 July 2010 09:03 |
Martin Messages: 5 Registered: June 2010 Location: Dresden |
Junior Member |
|
|
I'am trying to to some kind of scoping. I have the following DSL:
Definition Name{
property Name_prop
property Name_prop1
}
Definition Test{
property Test_prop
}
Access Test {
propertyRef Test_prop
}
Now I want to press [Strg + Space] after 'propertyRef' and
I want to see just "Test_prop" as proposal in the context menu!
By default Xtext generates me 'Name_prop", "Name_prop1"
and "Test_prop" as proposal.
Is there any posibility to do that with Xtext? My grammar looks like this: (notice the {FunctionCall} was just a try to get access to the objects at runtime for scoping?)
Language returns Language:
(statement+=Statement)*;
Statement returns Statement:
Definition | Access;
Definition returns Definition:
'Definition'
name=DefName
'{'
(properties+=Property)*
'}';
DefName:
name = ID;
AbstractDefName:
Definition |DefName ;
Access returns Access:
'Access' {FunctionCall} DefinitionName=[AbstractDefName]
'{'
propAccesses+=PropAccess
'}';
PropAccess : 'propertyRef' propertyRef=[Property];
Property returns Property:
'property'
name=ID
;
EString returns ecore::EString:
STRING | ID("." ID)*;
If there is no way to do that automatically by using Xtext? What
API can I use to implement this feature? How to do that using the ScopeProvider?
Thanks and Regards,
Martin
[Updated on: Fri, 02 July 2010 15:52] Report message to a moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03007 seconds