Turn T_EOF into a properly registered token.
[cparser] / tokens.inc
1 #ifndef TS
2 #define TS(x,str,val)
3 #endif
4
5 /* These must go first. Some set explicit values. */
6 #define ALTERNATE(name, val)          T(_CXX, name, #name,  val)
7 #define PUNCTUATOR(name, string, val) T(_ALL, name, string, val)
8 #include "tokens_punctuator.inc"
9 #undef PUNCTUATOR
10 #undef ALTERNATE
11
12 TS(EOF,                "end of input",)
13 TS(IDENTIFIER,         "identifier",)
14 TS(NUMBER,             "number constant",)
15 TS(CHARACTER_CONSTANT, "character constant",)
16 TS(STRING_LITERAL,     "string literal",)
17 TS(HEADERNAME,         "headername",)
18 TS(UNKNOWN_CHAR,       "unknown character",)
19
20 #define S(mode,x)   T(mode,x,#x,)
21 S(_ALL, auto)
22 S(_ALL, break)
23 S(_ALL, case)
24 S(_ALL, char)
25 S(_ALL, continue)
26 S(_ALL, default)
27 S(_ALL, do)
28 S(_ALL, double)
29 S(_ALL, else)
30 S(_ALL, enum)
31 S(_ALL, extern)
32 S(_ALL, float)
33 S(_ALL, for)
34 S(_ALL, goto)
35 S(_ALL, if)
36 S(_ALL, int)
37 S(_ALL, long)
38 S(_ALL, register)
39 S(_ALL, return)
40 S(_ALL, short)
41 S(_ALL, sizeof)
42 S(_ALL, static)
43 S(_ALL, struct)
44 S(_ALL, switch)
45 S(_ALL, typedef)
46 S(_ALL, union)
47 S(_ALL, unsigned)
48 S(_ALL, void)
49 S(_ALL, while)
50
51 /* C++ keywords */
52 #undef bool
53 S(_CXX, bool)
54 #define bool _Bool
55 S(_CXX, catch)
56 S(_CXX, class)
57 S(_CXX, const_cast)
58 S(_CXX, delete)
59 S(_CXX, dynamic_cast)
60 S(_CXX, explicit)
61 S(_CXX, export)
62 #undef false
63 S(_CXX, false)
64 #define false 0
65 S(_CXX, friend)
66 S(_CXX, mutable)
67 S(_CXX, namespace)
68 S(_CXX, new)
69 S(_CXX, operator)
70 S(_CXX, private)
71 S(_CXX, protected)
72 S(_CXX, public)
73 S(_CXX, reinterpret_cast)
74 S(_CXX, static_cast)
75 S(_CXX, template)
76 S(_CXX, this)
77 S(_CXX, throw)
78 #undef true
79 S(_CXX, true)
80 #define true 1
81 S(_CXX, try)
82 S(_CXX, typeid)
83 S(_CXX, typename)
84 S(_CXX, using)
85 S(_CXX, virtual)
86 S(_CXX, wchar_t)
87
88 S(_C99|_GNUC, _Bool)
89 S(_ALL, __thread)
90 S(_ALL, __extension__)
91 S(_ALL, __builtin_classify_type)
92 S(_ALL, __builtin_va_list)
93 S(_ALL, __builtin_va_arg)
94 S(_ALL, __builtin_va_copy)
95 S(_ALL, __builtin_offsetof)
96 S(_ALL, __builtin_constant_p)
97 S(_ALL, __builtin_types_compatible_p)
98 S(_ALL, __builtin_isgreater)
99 S(_ALL, __builtin_isgreaterequal)
100 S(_ALL, __builtin_isless)
101 S(_ALL, __builtin_islessequal)
102 S(_ALL, __builtin_islessgreater)
103 S(_ALL, __builtin_isunordered)
104 S(_ALL, __PRETTY_FUNCTION__)
105 S(_ALL, __label__)
106 S(_MS, __FUNCSIG__)
107 S(_MS, __FUNCDNAME__)
108 #undef S
109
110 /* needed on Windows */
111 #undef __w64
112 #undef __ptr32
113 #undef __ptr64
114
115 /* needed on MinGW */
116 #undef __int8
117 #undef __int16
118 #undef __int32
119 #undef __int64
120
121 /* needed on MinGW and Cygwin */
122 #undef __cdecl
123 #undef __stdcall
124 #undef __fastcall
125
126 /* needed on Darwin... */
127 #undef __signed
128 #undef __volatile
129 #undef __const
130 #undef __restrict
131
132 #define S(mode, x, val) T(mode, x, #x, val)
133 S(_C99,            __func__,)
134 S(_ALL,            __FUNCTION__,           = T___func__)
135 S(_ANSI|_C99|_CXX,   signed,               )
136 S(_ALL,            __signed,               = T_signed)
137 S(_ALL,            __signed__,             = T_signed)
138 S(_C99|_GNUC,       _Complex,              )
139 S(_ALL,            __complex__,            = T__Complex)
140 S(_ALL,            __complex,              = T__Complex)
141 S(_C99|_GNUC,       _Imaginary,            )
142 S(_ALL,            __real__,               )
143 S(_ALL,            __real,                 = T___real__)
144 S(_ALL,            __imag__,               )
145 S(_ALL,            __imag,                 = T___imag__)
146 S(_ALL,            __alignof__,            )
147 S(_ALL,            __alignof,              = T___alignof__)
148 S(_MS,              _alignof,              = T___alignof__)
149 S(_ANSI|_C99|_CXX,   const,                )
150 S(_ALL,            __const,                = T_const)
151 S(_ALL,            __const__,              = T_const)
152 S(_C99,              restrict,             )
153 S(_ALL,            __restrict__,           = T_restrict)
154 S(_ALL,            __restrict,             = T_restrict)
155 S(_MS,              _restrict,             = T_restrict)
156 S(_ALL,              asm,                  )
157 S(_ALL,            __asm__,                = T_asm)
158 S(_MS,              _asm,                  = T_asm)
159 S(_ALL,            __asm,                  = T_asm)
160 S(_ANSI|_C99|_CXX,   volatile,             )
161 S(_ALL,            __volatile,             = T_volatile)
162 S(_ALL,            __volatile__,           = T_volatile)
163 S(_C99|_CXX|_GNUC,   inline,               )
164 S(_ALL,            __inline,               = T_inline)
165 S(_ALL,            __inline__,             = T_inline)
166 S(_GNUC,             typeof,               )
167 S(_ALL,            __typeof,               = T_typeof)
168 S(_ALL,            __typeof__,             = T_typeof)
169 S(_ALL,            __attribute__,          )
170
171 S(_ALL,            __builtin_va_start,     )
172 S(_ALL,            __builtin_stdarg_start, = T___builtin_va_start)
173
174 S(_MS,              _near,                 )
175 S(_MS,             __near,                 = T__near)
176 S(_MS,              _far,                  )
177 S(_MS,             __far,                  = T__far)
178 S(_MS,               cdecl,                )
179 S(_MS,              _cdecl,                = T_cdecl)
180 S(_MS,             __cdecl,                = T_cdecl)
181 S(_MS,              _stdcall,              )
182 S(_MS,             __stdcall,              = T__stdcall)
183 S(_MS,              _fastcall,             )
184 S(_MS,             __fastcall,             = T__fastcall)
185 S(_MS,             __thiscall,             )
186 S(_MS,              _forceinline,          )
187 S(_MS,             __forceinline,          = T__forceinline)
188 S(_MS,             __unaligned,            )
189 S(_MS,              _assume,               )
190 S(_MS,             __assume,               = T__assume)
191 S(_MS,              _try,                  )
192 S(_MS,             __try,                  = T__try)
193 S(_MS,              _finally,              )
194 S(_MS,             __finally,              = T__finally)
195 S(_MS,              _leave,                )
196 S(_MS,             __leave,                = T__leave)
197 S(_MS,              _except,               )
198 S(_MS,             __except,               = T__except)
199 S(_MS,              _declspec,             )
200 S(_MS,             __declspec,             = T__declspec)
201 S(_MS,              _based,                )
202 S(_MS,             __based,                = T__based)
203 S(_MS,             __noop,                 )
204
205 S(_MS,             __ptr32,                )
206 S(_MS,             __ptr64,                )
207 S(_MS,             __sptr,                 )
208 S(_MS,             __uptr,                 )
209 S(_MS,              _w64,                  )
210 S(_MS,             __w64,                  = T__w64)
211
212 S(_MS,              _int8,                 )
213 S(_MS,             __int8,                 = T__int8)
214 S(_MS,              _int16,                )
215 S(_MS,             __int16,                = T__int16)
216 S(_MS,              _int32,                )
217 S(_MS,             __int32,                = T__int32)
218 S(_MS,              _int64,                )
219 S(_MS,             __int64,                = T__int64)
220 S(_MS,              _int128,               )
221 S(_MS,             __int128,               = T__int128)
222 #undef S
223
224 /* Redefine required macros for MinGW headers */
225 #if defined(__MINGW32__) || defined(__CYGWIN__)
226 #define __stdcall __attribute__((__stdcall__))
227 #define __fastcall __attribute__((__fastcall__))
228 #define __cdecl __attribute__((__cdecl__))
229 #endif