-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtokens.inc
92 lines (85 loc) · 1.61 KB
/
tokens.inc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#ifndef TS
#define TS(x,str,val)
#endif
TS(NEWLINE, "newline", = 256)
TS(INDENT, "indent",)
TS(DEDENT, "dedent",)
TS(IDENTIFIER, "identifier",)
TS(INTEGER, "integer number",)
TS(STRING_LITERAL, "string literal",)
/* hack... */
#undef bool
#undef true
#undef false
#define Keyword(x) T(x,#x,)
Keyword(bool)
Keyword(byte)
Keyword(cast)
Keyword(class)
Keyword(const)
Keyword(double)
Keyword(else)
Keyword(import)
Keyword(export)
Keyword(extern)
Keyword(false)
Keyword(float)
Keyword(func)
Keyword(goto)
Keyword(if)
Keyword(instance)
Keyword(int)
Keyword(long)
Keyword(module)
Keyword(null)
Keyword(return)
Keyword(short)
Keyword(signed)
Keyword(static)
Keyword(struct)
Keyword(true)
Keyword(typealias)
Keyword(concept)
Keyword(union)
Keyword(unsigned)
Keyword(var)
Keyword(void)
Keyword(sizeof)
Keyword(typeof)
#undef S
#define bool _Bool
#define true 1
#define false 0
T(DOTDOT, "..",)
T(DOTDOTDOT, "...",)
T(EQUALEQUAL, "==",)
T(TYPESTART, "<$",)
T(SLASHEQUAL, "/=",)
T(LESSEQUAL, "<=",)
T(LESSLESS, "<<",)
T(GREATEREQUAL, ">=",)
T(GREATERGREATER, ">>",)
T(PIPEPIPE, "||",)
T(ANDAND, "&&",)
T(PLUSPLUS, "++",)
T(MINUSMINUS, "--",)
T(MULTILINE_COMMENT_BEGIN, "/*",)
T(MULTILINE_COMMENT_END, "*/",)
T(SINGLELINE_COMMENT, "//",)
#define T_LAST_TOKEN (T_SINGLELINE_COMMENT+1)
T(PLUS, "+", = '+')
T(MINUS, "-", = '-')
T(MULT, "*", = '*')
T(DIV, "/", = '/')
T(MOD, "%", = '%')
T(EQUAL, "=", = '=')
T(LESS, "<", = '<')
T(GREATER, ">", = '>')
T(DOT, ".", = '.')
T(CARET, "^", = '^')
T(EXCLAMATION, "!", = '!')
T(QUESTION, "?", = '?')
T(AND, "&", = '&')
T(TILDE, "~", = '~')
T(PIPE, "|", = '|')
T(DOLLAR, "$", = '$')