X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=tokens.inc;h=6c6c856e756fa91d3df9eb0542050bdeab1cc30c;hb=6275ceca70721ec10e92124fb5bfa368e9db539b;hp=dff544f1f2f5bed9b1307a07f8a2a4469aff70a8;hpb=dec35629585521aa77904a2c6f3074dc56413535;p=cparser diff --git a/tokens.inc b/tokens.inc index dff544f..6c6c856 100644 --- a/tokens.inc +++ b/tokens.inc @@ -1,25 +1,21 @@ -#ifndef TS -#define TS(x,str,val) -#endif - -TS(IDENTIFIER, "identifier", = 256) -TS(INTEGER, "integer number",) -TS(INTEGER_OCTAL, "octal integer number",) -TS(INTEGER_HEXADECIMAL, "hexadecimal integer number",) -TS(FLOATINGPOINT, "floatingpoint number",) -TS(FLOATINGPOINT_HEXADECIMAL, "hexadecimal floatingpoint number",) -TS(CHARACTER_CONSTANT, "character constant",) -TS(WIDE_CHARACTER_CONSTANT, "wide character constant",) -TS(STRING_LITERAL, "string literal",) -TS(WIDE_STRING_LITERAL, "wide string literal",) - -#define ALTERNATE(name, val) T(_CXX, name, #name, val) -#define PUNCTUATOR(name, string, val) T(_ALL, name, string, val) +/* These must go first. Some set explicit values. */ +#define ALTERNATE(name, val) T(_CXX, T_##name, #name, val) +#define PUNCTUATOR(name, string, val) T(_ALL, T_##name, string, val) #include "tokens_punctuator.inc" #undef PUNCTUATOR #undef ALTERNATE -#define S(mode,x) T(mode,x,#x,) +#define S(name, description) T(_ALL, T_##name, description,) +S(EOF, "end of input") +S(IDENTIFIER, "identifier") +S(NUMBER, "number constant") +S(CHARACTER_CONSTANT, "character constant") +S(STRING_LITERAL, "string literal") +S(MACRO_PARAMETER, "macro parameter") +S(UNKNOWN_CHAR, "unknown character") +#undef S + +#define S(mode,x) T(mode,T_##x,#x,) S(_ALL, auto) S(_ALL, break) S(_ALL, case) @@ -51,9 +47,7 @@ S(_ALL, void) S(_ALL, while) /* C++ keywords */ -#undef bool S(_CXX, bool) -#define bool _Bool S(_CXX, catch) S(_CXX, class) S(_CXX, const_cast) @@ -61,9 +55,7 @@ S(_CXX, delete) S(_CXX, dynamic_cast) S(_CXX, explicit) S(_CXX, export) -#undef false S(_CXX, false) -#define false 0 S(_CXX, friend) S(_CXX, mutable) S(_CXX, namespace) @@ -77,9 +69,7 @@ S(_CXX, static_cast) S(_CXX, template) S(_CXX, this) S(_CXX, throw) -#undef true S(_CXX, true) -#define true 1 S(_CXX, try) S(_CXX, typeid) S(_CXX, typename) @@ -88,7 +78,13 @@ S(_CXX, virtual) S(_CXX, wchar_t) S(_C99|_GNUC, _Bool) -S(_ALL, __thread) + +S(_C11, _Alignas) +S(_C11, _Atomic) +S(_C11, _Generic) +S(_C11, _Noreturn) +S(_C11, _Static_assert) + S(_ALL, __extension__) S(_ALL, __builtin_classify_type) S(_ALL, __builtin_va_list) @@ -104,37 +100,17 @@ S(_ALL, __builtin_islessequal) S(_ALL, __builtin_islessgreater) S(_ALL, __builtin_isunordered) S(_ALL, __PRETTY_FUNCTION__) -S(_ALL, __FUNCTION__) S(_ALL, __label__) -S(_C99, __func__) S(_MS, __FUNCSIG__) S(_MS, __FUNCDNAME__) #undef S -/* needed on Windows */ -#undef __w64 -#undef __ptr32 -#undef __ptr64 - -/* needed on MinGW */ -#undef __int8 -#undef __int16 -#undef __int32 -#undef __int64 - -/* needed on MinGW and Cygwin */ -#undef __cdecl -#undef __stdcall -#undef __fastcall - -/* needed on Darwin... */ -#undef __signed -#undef __volatile -#undef __const -#undef __restrict - -#define S(mode, x, val) T(mode, x, #x, val) -S(_ANSI|_C99|_CXX, signed, ) +#define S(mode, x, val) T(mode, T_##x, #x, val) +S(_C99, __func__,) +S(_ALL, __FUNCTION__, = T___func__) +S(_C11, _Thread_local, ) +S(_ALL, __thread, = T__Thread_local) +S(_ALL, signed, ) S(_ALL, __signed, = T_signed) S(_ALL, __signed__, = T_signed) S(_C99|_GNUC, _Complex, ) @@ -145,10 +121,11 @@ S(_ALL, __real__, ) S(_ALL, __real, = T___real__) S(_ALL, __imag__, ) S(_ALL, __imag, = T___imag__) -S(_ALL, __alignof__, ) -S(_ALL, __alignof, = T___alignof__) -S(_MS, _alignof, = T___alignof__) -S(_ANSI|_C99|_CXX, const, ) +S(_C11, _Alignof, ) +S(_ALL, __alignof__, = T__Alignof) +S(_ALL, __alignof, = T__Alignof) +S(_MS, _alignof, = T__Alignof) +S(_ALL, const, ) S(_ALL, __const, = T_const) S(_ALL, __const__, = T_const) S(_C99, restrict, ) @@ -159,10 +136,10 @@ S(_ALL, asm, ) S(_ALL, __asm__, = T_asm) S(_MS, _asm, = T_asm) S(_ALL, __asm, = T_asm) -S(_ANSI|_C99|_CXX, volatile, ) +S(_ALL, volatile, ) S(_ALL, __volatile, = T_volatile) S(_ALL, __volatile__, = T_volatile) -S(_C99|_CXX, inline, ) +S(_C99|_CXX|_GNUC, inline, ) S(_ALL, __inline, = T_inline) S(_ALL, __inline__, = T_inline) S(_GNUC, typeof, )