eclipse - scoping: get all instances of specific type in current file xtext -


following question: here trying customize scoping. want in scope of 'predicate' in language of objects visible in scope, types 'typedef'.

predicate:     'predicate' name=id ('(' params=typedparamlist ')')?     (':' body=temporalexpression tok_semi)     | ('{' body=temporalexpression '}');  typedef:     'type' name=id '=' type=vartype tok_semi; 

here example of language:

type   move = {left, right};  predicate stop(move m1, move m2) :    m1=left , m2=right; 

it's not recognize left , right.(can't resolve reference)

i tried this:

            val allcontentscurrfile  = ecoreutil2.ealloftype(context,typedef)             val allcontentscurrfile2  = ecoreutil2.getallcontentsoftype(context,typedef) 

i putted parameters scopes.scopefor method (in addition params of predicate) , isn't worked me. don't know how it, how find instances of specific type in current file cross reference work in predicate scope.

thanks.

you have walk root of before walk down. ecoreutil2.getcontaineroftype(context, yourroottype)might this.

update:

the grammar , example model dont fit. can give hints

well seems different problem. can reference thing have name.

then have put stuff scope.

typedparam: (module=[import] '.')? type=[typedef] name=id;

referrable: typedparam | typedef | typeconstant;

``` val root = ecoreutil2.getcontaineroftype(context, domainmodel) val allcontentscurrfile = ecoreutil2.getallcontentsoftype(root,typeconstant)

```


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -