• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2016 Google Inc. All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.google.turbine.parse;
18 
19 /** Java tokens, defined by JLS §3.8 - §3.12. */
20 public enum Token {
21   IDENT("<identifier>"),
22   LPAREN("("),
23   RPAREN(")"),
24   LBRACE("{"),
25   RBRACE("}"),
26   LBRACK("<"),
27   RBRACK(">"),
28   EOF("<eof>"),
29   SEMI(";"),
30   COMMA(","),
31   DOT("."),
32   TRUE("true"),
33   FALSE("false"),
34   NULL("null"),
35   ELLIPSIS("..."),
36   INT_LITERAL("<int literal>"),
37   LONG_LITERAL("<long literal>"),
38   FLOAT_LITERAL("<float literal>"),
39   DOUBLE_LITERAL("<double literal>"),
40   CHAR_LITERAL("<char literal>"),
41   STRING_LITERAL("<string literal>"),
42   AT("@"),
43   EQ("=="),
44   ASSIGN("="),
45   GT(">"),
46   GTE(">="),
47   GTGT(">>"),
48   GTGTE(">>="),
49   GTGTGT(">>>"),
50   GTGTGTE(">>>="),
51   LTLT("<<"),
52   LTLTE("<<="),
53   LT("<"),
54   LTE("<="),
55   NOT("!"),
56   NOTEQ("!="),
57   TILDE("~"),
58   COND("?"),
59   COLON(":"),
60   COLONCOLON("::"),
61   MINUS("-"),
62   DECR("--"),
63   MINUSEQ("-="),
64   ARROW("->"),
65   ANDAND("&&"),
66   ANDEQ("&="),
67   AND("&"),
68   OR("|"),
69   OROR("||"),
70   OREQ("|="),
71   PLUS("+"),
72   INCR("++"),
73   PLUSEQ("+="),
74   MULT("*"),
75   MULTEQ("*"),
76   DIV("/"),
77   DIVEQ("/="),
78   MOD("%"),
79   MODEQ("%="),
80   XOR("^"),
81   XOREQ("^="),
82   ABSTRACT("abstract"),
83   ASSERT("assert"),
84   BOOLEAN("boolean"),
85   BREAK("break"),
86   BYTE("byte"),
87   CASE("case"),
88   CATCH("catch"),
89   CHAR("char"),
90   CLASS("class"),
91   CONST("const"),
92   CONTINUE("continue"),
93   DEFAULT("default"),
94   DO("do"),
95   DOUBLE("double"),
96   ELSE("else"),
97   ENUM("enum"),
98   EXTENDS("extends"),
99   FINAL("final"),
100   FINALLY("finally"),
101   FLOAT("float"),
102   FOR("for"),
103   GOTO("goto"),
104   IF("if"),
105   IMPLEMENTS("implements"),
106   IMPORT("import"),
107   INSTANCEOF("instanceof"),
108   INT("int"),
109   INTERFACE("interface"),
110   LONG("long"),
111   NATIVE("native"),
112   NEW("new"),
113   PACKAGE("package"),
114   PRIVATE("private"),
115   PROTECTED("protected"),
116   PUBLIC("public"),
117   RETURN("return"),
118   SHORT("short"),
119   STATIC("static"),
120   STRICTFP("strictfp"),
121   SUPER("super"),
122   SWITCH("switch"),
123   SYNCHRONIZED("synchronized"),
124   THIS("this"),
125   THROW("throw"),
126   THROWS("throws"),
127   TRANSIENT("transient"),
128   TRY("try"),
129   VOID("void"),
130   VOLATILE("volatile"),
131   WHILE("while");
132 
133   private final String value;
134 
Token(String value)135   Token(String value) {
136     this.value = value;
137   }
138 
139   @Override
toString()140   public String toString() {
141     return value;
142   }
143 }
144