langtools/src/share/classes/com/sun/tools/javac/parser/Keywords.java
changeset 939 38e24969c7e9
parent 10 06bc494ca11e
child 1260 a772ba9ba43d
equal deleted inserted replaced
938:13aae74ca013 939:38e24969c7e9
    89 
    89 
    90     /** The names of all tokens.
    90     /** The names of all tokens.
    91      */
    91      */
    92     private Name[] tokenName = new Name[Token.values().length];
    92     private Name[] tokenName = new Name[Token.values().length];
    93 
    93 
    94     public String token2string(Token token) {
       
    95         switch (token) {
       
    96         case IDENTIFIER:
       
    97             return log.getLocalizedString("token.identifier");
       
    98         case CHARLITERAL:
       
    99             return log.getLocalizedString("token.character");
       
   100         case STRINGLITERAL:
       
   101             return log.getLocalizedString("token.string");
       
   102         case INTLITERAL:
       
   103             return log.getLocalizedString("token.integer");
       
   104         case LONGLITERAL:
       
   105             return log.getLocalizedString("token.long-integer");
       
   106         case FLOATLITERAL:
       
   107             return log.getLocalizedString("token.float");
       
   108         case DOUBLELITERAL:
       
   109             return log.getLocalizedString("token.double");
       
   110         case ERROR:
       
   111             return log.getLocalizedString("token.bad-symbol");
       
   112         case EOF:
       
   113             return log.getLocalizedString("token.end-of-input");
       
   114         case DOT: case COMMA: case SEMI: case LPAREN: case RPAREN:
       
   115         case LBRACKET: case RBRACKET: case LBRACE: case RBRACE:
       
   116             return "'" + token.name + "'";
       
   117         default:
       
   118             return token.name;
       
   119         }
       
   120     }
       
   121 
       
   122     private void enterKeyword(String s, Token token) {
    94     private void enterKeyword(String s, Token token) {
   123         Name n = names.fromString(s);
    95         Name n = names.fromString(s);
   124         tokenName[token.ordinal()] = n;
    96         tokenName[token.ordinal()] = n;
   125         if (n.index > maxKey) maxKey = n.index;
    97         if (n.index > maxKey) maxKey = n.index;
   126     }
    98     }