Evaluator ownEvaluator = getPrivateEvaluator(ctx);
return ownEvaluator.parseModule(ownEvaluator.getMonitor(), str.getValue().toCharArray(), loc.getURI());
}
public IValue parseModule(ISourceLocation loc, final IList searchPath, IEvaluatorContext ctx) {
final Evaluator ownEvaluator = getPrivateEvaluator(ctx);
final URIResolverRegistry otherReg = ctx.getResolverRegistry();
URIResolverRegistry ownRegistry = ownEvaluator.getResolverRegistry();
// bridge the resolvers that are not defined in the new Evaluator, but needed here
for (IValue l : searchPath) {
String scheme = ((ISourceLocation) l).getURI().getScheme();
if (!ownRegistry.supportsInputScheme(scheme)) {
ownRegistry.registerInput(new ResolverBridge(scheme, otherReg));
}
}
// add the given locations to the search path
SourceLocationListContributor contrib = new SourceLocationListContributor("reflective", searchPath);
ownEvaluator.addRascalSearchPathContributor(contrib);
try {
return ownEvaluator.parseModule(ownEvaluator.getMonitor(), loc.getURI());
} catch (IOException e) {
throw RuntimeExceptionFactory.io(values.string(e.getMessage()), null, null);
}
catch (Throwable e) {
throw RuntimeExceptionFactory.javaException(e, null, null);
}
finally {
ownEvaluator.removeSearchPathContributor(contrib);
}
}