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