1 
2 module hunt.sql.parser.Token;
3 
4 /**
5  * 
6  * SQL Token 
7  */
8 enum Token : string {
9     SELECT = "SELECT", 
10     DELETE = "DELETE", 
11     INSERT = "INSERT", 
12     UPDATE = "UPDATE", 
13     
14     FROM = "FROM", 
15     HAVING = "HAVING", 
16     WHERE = "WHERE", 
17     ORDER = "ORDER", 
18     BY = "BY",
19     GROUP = "GROUP", 
20     INTO = "INTO", 
21     AS = "AS", 
22     
23     CREATE = "CREATE",
24     ALTER = "ALTER", 
25     DROP = "DROP", 
26     SET = "SET", 
27    
28     NULL = "NULL", 
29     NOT = "NOT", 
30     DISTINCT = "DISTINCT",
31 
32     TABLE = "TABLE", 
33     TABLESPACE = "TABLESPACE", 
34     VIEW = "VIEW", 
35     SEQUENCE = "SEQUENCE", 
36     TRIGGER = "TRIGGER", 
37     USER = "USER", 
38     INDEX = "INDEX", 
39     SESSION = "SESSION",
40     PROCEDURE = "PROCEDURE",
41     FUNCTION = "FUNCTION",
42     
43     PRIMARY = "PRIMARY", 
44     KEY = "KEY", 
45     DEFAULT = "DEFAULT", 
46     CONSTRAINT = "CONSTRAINT", 
47     CHECK = "CHECK", 
48     UNIQUE = "UNIQUE", 
49     FOREIGN = "FOREIGN", 
50     REFERENCES = "REFERENCES", 
51     
52     EXPLAIN = "EXPLAIN", 
53     FOR = "FOR", 
54     IF = "IF",
55     SORT = "SORT",
56    
57    
58     ALL = "ALL", 
59     UNION = "UNION", 
60     EXCEPT = "EXCEPT", 
61     INTERSECT = "INTERSECT", 
62     MINUS = "MINUS",
63     INNER = "INNER", 
64     LEFT = "LEFT", 
65     RIGHT = "RIGHT", 
66     FULL = "FULL", 
67     OUTER = "OUTER", 
68     JOIN = "JOIN", 
69     ON = "ON", 
70     SCHEMA = "SCHEMA", 
71     CAST = "CAST",
72     COLUMN = "COLUMN",
73     USE = "USE",
74     DATABASE = "DATABASE",
75     TO = "TO",
76 
77     AND = "AND", 
78     OR = "OR", 
79     XOR = "XOR", 
80     CASE = "CASE", 
81     WHEN = "WHEN", 
82     THEN = "THEN", 
83     ELSE = "ELSE",
84     ELSIF = "ELSIF",
85     END = "END", 
86     EXISTS = "EXISTS", 
87     IN = "IN",
88     CONTAINS = "CONTAINS",
89     RLIKE = "RLIKE",
90     FULLTEXT = "FULLTEXT",
91 
92     NEW = "NEW", 
93     ASC = "ASC", 
94     DESC = "DESC", 
95     IS = "IS", 
96     LIKE = "LIKE", 
97     ESCAPE = "ESCAPE", 
98     BETWEEN = "BETWEEN", 
99     VALUES = "VALUES", 
100     INTERVAL = "INTERVAL",
101 
102     LOCK = "LOCK", 
103     SOME = "SOME", 
104     ANY = "ANY",
105     TRUNCATE = "TRUNCATE",
106 
107     RETURN = "RETURN",
108 
109     // mysql
110     TRUE = "TRUE", 
111     FALSE = "FALSE",
112     LIMIT = "LIMIT",
113     KILL = "KILL",
114     IDENTIFIED = "IDENTIFIED",
115     PASSWORD = "PASSWORD",
116     ALGORITHM = "ALGORITHM",
117     DUAL = "DUAL",
118     BINARY = "BINARY",
119     SHOW = "SHOW",
120     REPLACE = "REPLACE",
121 
122     BITS = "BITS",
123 
124     // MySql procedure add by zz
125     WHILE = "WHILE",
126     DO = "DO",
127     LEAVE = "LEAVE",
128     ITERATE = "ITERATE",
129     REPEAT = "REPEAT",
130     UNTIL = "UNTIL",
131     OPEN = "OPEN",
132     CLOSE = "CLOSE",
133     OUT = "OUT",
134     INOUT = "INOUT",
135     EXIT = "EXIT",
136     UNDO = "UNDO",
137     SQLSTATE = "SQLSTATE",
138     CONDITION = "CONDITION",
139     DIV = "DIV",
140     
141     //postgresql
142     WINDOW = "WINDOW",
143     OFFSET = "OFFSET",
144     ROW = "ROW",
145     ROWS = "ROWS",
146     ONLY = "ONLY",
147     FIRST = "FIRST",
148     NEXT = "NEXT",
149     FETCH = "FETCH",
150     OF = "OF",
151     SHARE = "SHARE",
152     NOWAIT = "NOWAIT",
153     RECURSIVE = "RECURSIVE",
154     TEMPORARY = "TEMPORARY",
155     TEMP = "TEMP",
156     UNLOGGED = "UNLOGGED",
157     RESTART = "RESTART",
158     IDENTITY = "IDENTITY",
159     CONTINUE = "CONTINUE",
160     CASCADE = "CASCADE",
161     RESTRICT = "RESTRICT",
162     USING = "USING",
163     CURRENT = "CURRENT",
164     RETURNING = "RETURNING",
165     COMMENT = "COMMENT",
166     OVER = "OVER",
167     TYPE = "TYPE",
168     ILIKE = "ILIKE",
169 
170     // oracle
171     START = "START",
172     PRIOR = "PRIOR",
173     CONNECT = "CONNECT",
174     WITH = "WITH",
175     EXTRACT = "EXTRACT",
176     CURSOR = "CURSOR",
177     MODEL = "MODEL",
178     MERGE = "MERGE",
179     MATCHED = "MATCHED",
180     ERRORS = "ERRORS",
181     REJECT = "REJECT",
182     UNLIMITED = "UNLIMITED",
183     BEGIN = "BEGIN",
184     EXCLUSIVE = "EXCLUSIVE",
185     MODE = "MODE",
186     WAIT = "WAIT",
187     ADVISE = "ADVISE",
188     SYSDATE = "SYSDATE",
189     DECLARE = "DECLARE",
190     EXCEPTION = "EXCEPTION",
191     GRANT = "GRANT",
192     REVOKE = "REVOKE",
193     LOOP = "LOOP",
194     GOTO = "GOTO",
195     COMMIT = "COMMIT",
196     SAVEPOINT = "SAVEPOINT",
197     CROSS = "CROSS",
198     
199     PCTFREE = "PCTFREE",
200     INITRANS = "INITRANS",
201     MAXTRANS = "MAXTRANS",
202     INITIALLY = "INITIALLY",
203     ENABLE = "ENABLE",
204     DISABLE = "DISABLE",
205     SEGMENT = "SEGMENT",
206     CREATION = "CREATION",
207     IMMEDIATE = "IMMEDIATE",
208     DEFERRED = "DEFERRED",
209     STORAGE = "STORAGE",
210     MINEXTENTS = "MINEXTENTS",
211     MAXEXTENTS = "MAXEXTENTS",
212     MAXSIZE = "MAXSIZE",
213     PCTINCREASE = "PCTINCREASE",
214     FLASH_CACHE = "FLASH_CACHE",
215     CELL_FLASH_CACHE = "CELL_FLASH_CACHE",
216     NONE = "NONE",
217     LOB = "LOB",
218     STORE = "STORE",
219     CHUNK = "CHUNK",
220     CACHE = "CACHE",
221     NOCACHE = "NOCACHE",
222     LOGGING = "LOGGING",
223     NOCOMPRESS = "NOCOMPRESS",
224     KEEP_DUPLICATES = "KEEP_DUPLICATES",
225     EXCEPTIONS = "EXCEPTIONS",
226     PURGE = "PURGE",
227     
228     COMPUTE = "COMPUTE",
229     ANALYZE = "ANALYZE",
230     OPTIMIZE = "OPTIMIZE",
231     
232     // transact-sql
233     TOP = "TOP",
234     
235     ARRAY = "ARRAY",
236     DISTRIBUTE = "DISTRIBUTE",
237     
238     // hive
239 
240     EOF = "EOF", 
241     ERROR = "ERROR",
242     IDENTIFIER = "IDENTIFIER",
243     HINT = "HINT",
244     VARIANT = "VARIANT",
245     LITERAL_INT = "LITERAL_INT",
246     LITERAL_FLOAT = "LITERAL_FLOAT",
247     LITERAL_HEX = "LITERAL_HEX",
248     LITERAL_CHARS = "LITERAL_CHARS",
249     LITERAL_NCHARS = "LITERAL_NCHARS",
250 
251     LITERAL_ALIAS = "LITERAL_ALIAS",
252     LINE_COMMENT = "LINE_COMMENT",
253     MULTI_LINE_COMMENT = "MULTI_LINE_COMMENT",
254     
255     // Oracle
256     // BINARY_FLOAT,
257     // BINARY_DOUBLE,
258     
259     // odps,hive
260     PARTITION = "PARTITION",
261     PARTITIONED = "PARTITIONED",
262     OVERWRITE = "OVERWRITE",
263     
264     // Teradata
265     SEL = "SEL",
266     LOCKING = "LOCKING",
267     ACCESS = "ACCESS",
268     VOLATILE = "VOLATILE",
269     MULTISET = "MULTISET",
270     POSITION = "POSITION",
271     RANGE_N = "RANGE_N",
272     FORMAT = "FORMAT",
273     QUALIFY = "QUALIFY",
274     MOD = "MOD",
275     
276     CONCAT = "CONCAT", // DB2
277 
278     UPSERT = "UPSERT", // Phoenix
279 
280     LPAREN = " = ", 
281     RPAREN = "", 
282     LBRACE = "{", 
283     RBRACE = "}", 
284     LBRACKET = "[", 
285     RBRACKET = "]", 
286     SEMI = ";", 
287     COMMA = ",", 
288     DOT = ".", 
289     DOTDOT = "..", 
290     DOTDOTDOT = "..,", 
291     EQ = "=", 
292     GT = ">", 
293     LT = "<",
294     LT_SUB_GT = "<->",
295     BANG = "!",
296     BANGBANG = "!!",
297     BANG_TILDE = "!~",
298     BANG_TILDE_STAR = "!~*",
299     TILDE = "~",
300     TILDE_STAR = "~*",
301     TILDE_EQ = "~=",
302     QUES = "?",
303     QUESQUES = "??",
304     QUESBAR = "?|",
305     QUESAMP = "?&",
306     COLON = ":", 
307     COLONCOLON = "::", 
308     COLONEQ = ":=", 
309     EQEQ = "==",
310     EQGT = "=>",
311     LTEQ = "<=", 
312     LTEQGT = "<=>", 
313     LTGT = "<>", 
314     GTEQ = ">=", 
315     BANGEQ = "!=", 
316     BANGGT = "!>", 
317     BANGLT = "!<",
318     AMPAMP = "&&", 
319     BARBAR = "||", 
320     BARBARSLASH = "||/", 
321     BARSLASH = "|/", 
322     PLUS = "+", 
323     SUB = "-", 
324     SUBGT = "->", 
325     SUBGTGT = "->>", 
326     STAR = "*", 
327     SLASH = "/", 
328     AMP = "&", 
329     BAR = "|", 
330     CARET = "^",
331     CARETEQ = "^=",
332     PERCENT = "%", 
333     LTLT = "<<", 
334     GTGT = ">>",
335     MONKEYS_AT = "@",
336     MONKEYS_AT_AT = "@@",
337     POUND = "#",
338     POUNDGT = "#>",
339     POUNDGTGT = "#>>",
340     MONKEYS_AT_GT = "@>",
341     LT_MONKEYS_AT = "<@",
342 
343     // public  string name;
344 
345     // this = {
346     //     this = null;
347     // }
348 
349     // this = string name{
350     //     this.name = name;
351     // }
352 }