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