Skip to content
Snippets Groups Projects
Commit 2a8882c7 authored by Lukas Stadler's avatar Lukas Stadler
Browse files

don't convert parse exceptions to RErrors in non-interactive mode

parent ae2879b2
Branches
No related tags found
No related merge requests found
......@@ -53,8 +53,6 @@ import com.oracle.truffle.r.runtime.data.RPromise;
import com.oracle.truffle.r.runtime.data.RTypedValue;
import com.oracle.truffle.r.runtime.env.RScope;
import com.oracle.truffle.r.runtime.ffi.RFFIFactory;
import com.oracle.truffle.r.runtime.interop.R2Foreign;
import com.oracle.truffle.r.runtime.interop.R2ForeignNodeGen;
import com.oracle.truffle.r.runtime.nodes.RBaseNode;
@TruffleLanguage.Registration(name = "R", id = "R", version = "3.3.2", mimeType = {RRuntime.R_APP_MIME, RRuntime.R_TEXT_MIME}, interactive = true)
......@@ -194,12 +192,14 @@ public final class TruffleRLanguageImpl extends TruffleRLanguage {
} catch (IncompleteSourceException e) {
throw e;
} catch (ParseException e) {
throw e.throwAsRError();
if (request.getSource().isInteractive()) {
throw e.throwAsRError();
} else {
throw e;
}
}
}
private static final R2Foreign r2foreign = R2ForeignNodeGen.create();
@Override
protected Object getLanguageGlobal(RContext context) {
// TODO: what's the meaning of "language global" for R?
......
......@@ -33,6 +33,7 @@ import com.oracle.truffle.api.TruffleException;
import com.oracle.truffle.api.frame.MaterializedFrame;
import com.oracle.truffle.api.nodes.Node;
import com.oracle.truffle.api.source.Source;
import com.oracle.truffle.api.source.SourceSection;
import com.oracle.truffle.api.vm.PolyglotEngine;
import com.oracle.truffle.r.runtime.ArgumentsSignature;
import com.oracle.truffle.r.runtime.RCaller;
......@@ -101,7 +102,17 @@ public interface Engine {
@Override
public Node getLocation() {
return null;
if (line <= 0 || line > source.getLineCount()) {
return null;
} else {
SourceSection section = source.createSection(line);
return new Node() {
@Override
public SourceSection getSourceSection() {
return section;
}
};
}
}
@Override
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment