Skip to content

Commit

Permalink
Swap out eof check to isIdentifierChar since it is used in several pl…
Browse files Browse the repository at this point in the history
…aces and this matches MRI's logic
  • Loading branch information
enebo committed Apr 6, 2015
1 parent 84d9a8b commit 71d91ca
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions core/src/main/java/org/jruby/lexer/yacc/RubyLexer.java
Expand Up @@ -813,7 +813,7 @@ private int getIntegerToken(String value, int radix, int suffix) {
* mri: is_identchar
*/
public boolean isIdentifierChar(int c) {
return Character.isLetterOrDigit(c) || c == '_' || isMultiByteChar(c);
return !eofp && (Character.isLetterOrDigit(c) || c == '_' || isMultiByteChar(c));
}

public boolean isASCII(int c) {
Expand Down Expand Up @@ -1886,7 +1886,7 @@ private int identifier(int c, boolean commandState) throws IOException {
do {
if (!tokadd_mbchar(c)) return EOF;
c = nextc();
} while (c != EOF && isIdentifierChar(c));
} while (isIdentifierChar(c));

boolean lastBangOrPredicate = false;

Expand Down

0 comments on commit 71d91ca

Please sign in to comment.