|
|
Re: Scoping: merge elements in logical groups [message #629049 is a reply to message #629044] |
Sun, 26 September 2010 19:34 |
Sebastian Zarnekow Messages: 3118 Registered: July 2009 |
Senior Member |
|
|
Hi A,
what do you mean - it does not work? I don't see any cross references in
your example so the code should not depend on scopes. If you are
refering to validation problems for duplicate names, please bind your
own implementation of NamesAreUniqueValidationHelper.getClusterTypes()
according to its JavaDoc.
Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com
Am 26.09.10 20:32, schrieb awidegreen:
> Hej everyone,
>
> I want to implement a construct that is able to distinguish between
> different logical groups (see example below).
> Therefore I defined the following grammar:
>
> grammar org.test.ExtScope with org.eclipse.xtext.common.Terminals
>
> generate extScope "http://www.test.org/ExtScope"
>
> Model:
> (elements+=Element)+;
>
> Element:
> 'element' name=QualifiedName '{'
> 'desc' '=' string=STRING
> (functions+=AbstractFunction)*
> '}';
>
> AbstractFunction:
> RequestFunction | ResponseFunction;
>
> RequestFunction:
> 'request' name=QualifiedName 'desc' '=' desc=STRING;
>
> ResponseFunction:
> 'response' name=QualifiedName 'desc' '=' desc=STRING;
>
> QualifiedName:
> ID ('.' ID)*;
>
>
> As you can see, the name of the "response" and "request" functions are
> in the same scope (of element a). So the following example do NOT work.
>
> element a {
> desc = "general desc"
> request myFunc desc = "myDescForReq"
> response myFunc desc = "myDescForRes"
> // more requests and responses
> }
>
> Generally, I want to reference request respectively response functions
> with QualifiedName like: a.responses.myFunc and a.requests.myFunc, to
> distinguish that the one is a request and the other one a response.
>
> Is there an appropriate solution for that functionality? Do I have to
> define my own ScopeProvider? Or maybe I only have to adjust my
> grammar-definition....? Please keep in mind that this is only an example
> grammar, the actual grammar is much bigger.
> tack,
> a
>
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03023 seconds