Reputation: 615
My xtext grammar constrains a hierarchical structure. When the scope of an element in the hierarchical needs to be computed the following must be done:
add the two list to the scope. Repeat the for the parent element and add the parents scope to the current scope.
I use
scope_a = Scopes.scopeFor(list_a)
scope_b = Scopes.scopeFor(list_b, scope_a)
but get stuck when adding the parents scope to scope_b
to create the final scope.
Upvotes: 0
Views: 380
Reputation: 11868
the scopeFor
methods are just helpers. have a look at their code. they call
org.eclipse.xtext.scoping.Scopes.scopeFor(Iterable<? extends T>, Function<T, QualifiedName>, IScope)
which allows to pass a parent scope
Upvotes: 1