Skip to content
Permalink
Browse files
Character#isAlphabetic is from Java 7, so duplicate logic here.
  • Loading branch information
headius committed Nov 4, 2014
1 parent 6505ecf commit bb85d423be5de39d151afb31fa7e7fa8733886df
Showing 1 changed file with 11 additions and 1 deletion.
@@ -140,7 +140,7 @@ private int parsePeekVariableName(RubyYaccLexer lexer, LexerSource src) throws I
return 0;
}

if (significant != -1 && Character.isAlphabetic(significant) || significant == '_') {
if (significant != -1 && isAlphabetic(significant) || significant == '_') {
src.unread(c);
lexer.setValue(new Token("#" + significant, lexer.getPosition()));
return Tokens.tSTRING_DVAR;
@@ -149,6 +149,16 @@ private int parsePeekVariableName(RubyYaccLexer lexer, LexerSource src) throws I
return 0;
}

// Character#isAlphabetic is a 1.7 feature, so we duplicate the logic here
private static boolean isAlphabetic(int codePoint) {
return (((((1 << Character.UPPERCASE_LETTER) |
(1 << Character.LOWERCASE_LETTER) |
(1 << Character.TITLECASE_LETTER) |
(1 << Character.MODIFIER_LETTER) |
(1 << Character.OTHER_LETTER) |
(1 << Character.LETTER_NUMBER)) >> Character.getType(codePoint)) & 1) != 0);
}

public int parseString(RubyYaccLexer lexer, LexerSource src) throws IOException {
boolean spaceSeen = false;
int c;

0 comments on commit bb85d42

Please sign in to comment.