use of mb.nabl2.scopegraph.IScopeGraph in project nabl by metaborg.
the class InterpreterTerms method scopeEntries.
private static ITerm scopeEntries(IScopeGraph<Scope, Label, Occurrence> scopeGraph) {
Map<ITerm, ITerm> entries = Maps.newHashMap();
for (Scope scope : scopeGraph.getAllScopes()) {
IListTerm decls = B.newList(scopeGraph.getDecls().inverse().get(scope));
IListTerm refs = B.newList(scopeGraph.getRefs().inverse().get(scope));
IListTerm edges = multimap(scopeGraph.getDirectEdges().get(scope));
IListTerm imports = multimap(scopeGraph.getImportEdges().get(scope));
ITerm entry = B.newAppl("SE", decls, refs, edges, imports);
entries.put(scope, entry);
}
return map(entries.entrySet());
}
use of mb.nabl2.scopegraph.IScopeGraph in project nabl by metaborg.
the class InterpreterTerms method refEntries.
private static ITerm refEntries(IScopeGraph<Scope, Label, Occurrence> scopeGraph) {
Map<ITerm, ITerm> entries = Maps.newHashMap();
for (Occurrence ref : scopeGraph.getAllRefs()) {
ITerm scope = scopeGraph.getRefs().get(ref).map(s -> B.newList(s)).orElse(B.newNil());
ITerm entry = B.newAppl("RE", scope);
entries.put(ref, entry);
}
return map(entries.entrySet());
}
use of mb.nabl2.scopegraph.IScopeGraph in project nabl by metaborg.
the class InterpreterTerms method declEntries.
private static ITerm declEntries(IScopeGraph<Scope, Label, Occurrence> scopeGraph) {
Map<ITerm, ITerm> entries = Maps.newHashMap();
for (Occurrence decl : scopeGraph.getAllDecls()) {
ITerm scope = scopeGraph.getDecls().get(decl).map(s -> B.newList(s)).orElse(B.newNil());
ITerm assocs = multimap(scopeGraph.getExportEdges().get(decl));
ITerm entry = B.newAppl("DE", scope, assocs);
entries.put(decl, entry);
}
return map(entries.entrySet());
}
Aggregations