Skip to content

Commit

Permalink
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions core/src/main/java/org/jruby/lexer/ByteListLexerSource.java
Original file line number Diff line number Diff line change
@@ -43,20 +43,12 @@ public void setEncoding(Encoding encoding) {
@Override
public ByteList gets() {
int length = completeSource.length();
if (offset == length) return null; // At end of source/eof
if (offset >= length) return null; // At end of source/eof

int end = offset;

while (end < length) {
if (completeSource.get(end) == '\n') {
end++; // include newline
break;
}
end++;
}
int end = completeSource.indexOf('\n', offset) + 1;
if (end == 0) end = length;

ByteList line = completeSource.makeShared(offset, end - offset);

offset = end;

if (scriptLines != null) scriptLines.append(RubyString.newString(scriptLines.getRuntime(), line));

0 comments on commit 88b0942

Please sign in to comment.