File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
src/main/java/org/truffleruby/core/exception Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change 10
10
package org .truffleruby .core .exception ;
11
11
12
12
import org .truffleruby .core .klass .RubyClass ;
13
+ import org .truffleruby .language .RubyGuards ;
13
14
import org .truffleruby .language .backtrace .Backtrace ;
14
15
15
16
import com .oracle .truffle .api .CompilerDirectives .TruffleBoundary ;
20
21
import com .oracle .truffle .api .library .ExportMessage ;
21
22
import com .oracle .truffle .api .object .Shape ;
22
23
import com .oracle .truffle .api .source .SourceSection ;
24
+ import org .truffleruby .language .library .RubyStringLibrary ;
23
25
24
26
@ ExportLibrary (InteropLibrary .class )
25
27
public class RubySyntaxError extends RubyException {
@@ -44,9 +46,16 @@ public ExceptionType getExceptionType() {
44
46
return ExceptionType .PARSE_ERROR ;
45
47
}
46
48
49
+ @ TruffleBoundary
47
50
@ ExportMessage
48
51
public boolean isExceptionIncompleteSource () {
49
- return false ; // Unknown
52
+ if (RubyStringLibrary .getUncached ().isRubyString (message )) {
53
+ String messageString = RubyGuards .getJavaString (message );
54
+ return messageString .endsWith (" unexpected end-of-file" ) ||
55
+ messageString .endsWith (" meets end of file" );
56
+ } else {
57
+ return false ;
58
+ }
50
59
}
51
60
52
61
@ ExportMessage
You can’t perform that action at this time.
0 commit comments