| Questions about scoping [message #987333] |
Mon, 26 November 2012 03:30  |
Cedric Moonen Messages: 214 Registered: August 2009 |
Senior Member |
|
|
Hello,
I'm trying to provide scoping for some references in my model. I have a specific case where providing scoping becomes tricking.
Suppose that we have the following piece of grammar:
Ecu returns Ecu:
'ecu' name=EString '{'
'components:' componentRef+=ComponentPrototypeInstRef ("," componentRef+=ComponentPrototypeInstRef)* ';'
'}';
ComponentPrototypeInstRef returns ComponentPrototypeInstRef:
(context+=[ComponentPrototype]'.')* target=[ComponentPrototype]
;
I would like to provide a scoping rule for the 'context' and 'target' references. However, two problems occur:
1) If the user types 'components:' and ask for content assist (Ctrl+space) my scoping rule is not invoked but however, the full list of existing ComponentPrototype is still displayed. I understood that the problem here is that because no instance of a ComponentPrototypeInstRef is created at that time, so my scoping rule cannot be called. However, I don't understand how Xtext is then able to supply the list. How can I override that behavior ?
2) If you look at the ComponentPrototypeInstRef, the 'context' reference is in fact a list of references. This is because a ComponentPrototype can be deeply nested (in the ComponentType, look at the attached picture to understand the domain model). So there, I need to provide scoping for this reference but I need to know which element in the list of 'context' I have to provide scoping for, otherwise I'll end up in a cyclic resolution of lazy links.
I however have one requirement (which is pretty strict): I cannot change the domain model! The Xtext syntax is based on a domain model and not the opposite.
Attachment: EMFmodel.PNG
(Size: 7.09KB, Downloaded 31 times)
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.01730 seconds