diff -r 916143318f10 -r 2d2b2be57c78 src/share/classes/com/sun/tools/javac/parser/Tokens.java --- a/src/share/classes/com/sun/tools/javac/parser/Tokens.java Wed Jan 16 20:41:14 2013 -0800 +++ b/src/share/classes/com/sun/tools/javac/parser/Tokens.java Thu Jan 17 18:15:20 2013 +0000 @@ -33,6 +33,7 @@ import com.sun.tools.javac.util.List; import com.sun.tools.javac.util.Name; import com.sun.tools.javac.util.Context; +import com.sun.tools.javac.util.Filter; import com.sun.tools.javac.util.ListBuffer; import com.sun.tools.javac.util.Names; @@ -74,7 +75,6 @@ protected Tokens(Context context) { context.put(tokensKey, this); names = Names.instance(context); - for (TokenKind t : TokenKind.values()) { if (t.name != null) enterKeyword(t.name, t); @@ -113,7 +113,7 @@ * This enum defines all tokens used by the javac scanner. A token is * optionally associated with a name. */ - public enum TokenKind implements Formattable { + public enum TokenKind implements Formattable, Filter { EOF(), ERROR(), IDENTIFIER(Tag.NAMED), @@ -176,6 +176,7 @@ TRUE("true", Tag.NAMED), FALSE("false", Tag.NAMED), NULL("null", Tag.NAMED), + UNDERSCORE("_", Tag.NAMED), ARROW("->"), COLCOL("::"), LPAREN("("), @@ -283,6 +284,11 @@ public String toString(Locale locale, Messages messages) { return name != null ? toString() : messages.getLocalizedString(locale, "compiler.misc." + toString()); } + + @Override + public boolean accepts(TokenKind that) { + return this == that; + } } public interface Comment {