| author | David Anderson <dvander@alliedmods.net> |
| Thu Jun 28 00:54:45 2012 -0700 (2012-06-28) | |
| changeset 9 | 73781c5a59d7 |
| parent 8 | 069d207a8f2a |
| child 10 | 0c3bcd50e361 |
| permissions | -rw-r--r-- |
1 /*
2 * Copyright (C) 2012 David Anderson
3 *
4 * This file is part of JITCraft.
5 *
6 * JITCraft is free software: you can redistribute it and/or modify it under
7 * the terms of the GNU General Public License as published by the Free
8 * Software Foundation, either version 3 of the License, or (at your option)
9 * any later version.
10 *
11 * Foobar is distributed in the hope that it will be useful, but WITHOUT ANY
12 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along with
16 * JITCraft. If not, see http://www.gnu.org/licenses/.
17 */
18 #ifndef _include_jitcraft_token_h_
19 #define _include_jitcraft_token_h_
21 namespace jc {
23 #define TOKENMAP(_) \
24 _(ERROR, "<error>") \
25 _(NEW, "'new'") \
26 _(FOR, "'for'") \
27 _(RETURN, "'return'") \
28 _(NAME, "<name>") \
29 _(INTEGER_LITERAL, "<integer>") \
30 _(FLOAT_LITERAL, "<float>") \
31 _(IF, "<if>") \
32 _(ELSE, "<else>") \
33 _(ENUM, "<enum>") \
34 _(LABEL, "<label>") \
35 _(WHILE, "<while>") \
36 _(DO, "<do>") \
37 _(PLUS, "+") \
38 _(MINUS, "-") \
39 _(STAR, "*") \
40 _(SLASH, "/") \
41 _(BITAND, "&") \
42 _(BITOR, "|") \
43 _(BITXOR, "^") \
44 _(SHR, ">>") \
45 _(USHR, ">>>") \
46 _(SHL, "<<") \
47 _(ASSIGN, "=") \
48 _(SEMICOLON, ";") \
49 _(LBRACE, "{") \
50 _(RBRACE, "}") \
51 _(LPAREN, "(") \
52 _(RPAREN, ")") \
53 _(LBRACKET, "[") \
54 _(RBRACKET, "]") \
55 _(ASSIGN_ADD, "+=") \
56 _(ASSIGN_MUL, "*=") \
57 _(ASSIGN_SHL, "<<=") \
58 _(EQUALS, "==") \
59 _(NOTEQUALS, "!=") \
60 _(LT, "<") \
61 _(LE, "<=") \
62 _(GT, ">") \
63 _(GE, ">=") \
64 _(COMMA, ",") \
65 _(EOF, "<end-of-file>")
67 enum TokenKind
68 {
69 # define _(name, str) TOK_##name,
70 TOKENMAP(_)
71 # undef _
72 TOKENS_TOTAL
73 };
75 extern const char *TokenNames[];
77 } // namespace jc
79 #endif //_include_jitcraft_token_h_