< prev index next >

src/jdk.compiler/share/classes/com/sun/tools/javac/parser/Tokens.java

Print this page

        

*** 82,93 **** } key = new TokenKind[maxKey+1]; for (int i = 0; i <= maxKey; i++) key[i] = TokenKind.IDENTIFIER; for (TokenKind t : TokenKind.values()) { ! if (t.name != null) ! key[tokenName[t.ordinal()].getIndex()] = t; } } private void enterKeyword(String s, TokenKind token) { Name n = names.fromString(s); --- 82,93 ---- } key = new TokenKind[maxKey+1]; for (int i = 0; i <= maxKey; i++) key[i] = TokenKind.IDENTIFIER; for (TokenKind t : TokenKind.values()) { ! if (t.name != null && !t.reserved()) ! key[tokenName[t.ordinal()].getIndex()] = t; } } private void enterKeyword(String s, TokenKind token) { Name n = names.fromString(s);
*** 224,233 **** --- 224,237 ---- PERCENTEQ("%="), LTLTEQ("<<="), GTGTEQ(">>="), GTGTGTEQ(">>>="), MONKEYS_AT("@"), + VAR("var", Tag.RESERVED), + RECORD("record", Tag.RESERVED), + SEALED("sealed", Tag.RESERVED), + PERMITS("permits", Tag.RESERVED), CUSTOM; public final String name; public final Tag tag;
*** 274,283 **** --- 278,291 ---- default: return name; } } + public boolean reserved() { + return tag == Tag.RESERVED; + } + public String getKind() { return "Token"; } public String toString(Locale locale, Messages messages) {
*** 313,323 **** /** tags constants **/ enum Tag { DEFAULT, NAMED, STRING, ! NUMERIC } /** The token kind */ public final TokenKind kind; --- 321,332 ---- /** tags constants **/ enum Tag { DEFAULT, NAMED, STRING, ! NUMERIC, ! RESERVED; } /** The token kind */ public final TokenKind kind;
< prev index next >