Skip to content

Commit 71d91ca

Browse files
committed
Swap out eof check to isIdentifierChar since it is used in several places and this matches MRI's logic
1 parent 84d9a8b commit 71d91ca

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

core/src/main/java/org/jruby/lexer/yacc/RubyLexer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -813,7 +813,7 @@ private int getIntegerToken(String value, int radix, int suffix) {
813813
* mri: is_identchar
814814
*/
815815
public boolean isIdentifierChar(int c) {
816-
return Character.isLetterOrDigit(c) || c == '_' || isMultiByteChar(c);
816+
return !eofp && (Character.isLetterOrDigit(c) || c == '_' || isMultiByteChar(c));
817817
}
818818

819819
public boolean isASCII(int c) {
@@ -1886,7 +1886,7 @@ private int identifier(int c, boolean commandState) throws IOException {
18861886
do {
18871887
if (!tokadd_mbchar(c)) return EOF;
18881888
c = nextc();
1889-
} while (c != EOF && isIdentifierChar(c));
1889+
} while (isIdentifierChar(c));
18901890

18911891
boolean lastBangOrPredicate = false;
18921892

0 commit comments

Comments
 (0)