X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=tokens.inc;h=39c5a6a2baca4da617b5e22535c84ceac879e7bb;hb=2beaa4f65961fe297663e1cec9e5632b7f3e1cba;hp=1889df9b2496bb8627ffc9486b8653b66c464eba;hpb=2058211f61e90b3acfcce898516274e84c314c8b;p=cparser diff --git a/tokens.inc b/tokens.inc index 1889df9..39c5a6a 100644 --- a/tokens.inc +++ b/tokens.inc @@ -2,17 +2,22 @@ #define TS(x,str,val) #endif -TS(IDENTIFIER, "identifier", = 256) -TS(INTEGER, "integer number",) -TS(CHARACTER_CONSTANT, "character constant",) -TS(WIDE_CHARACTER_CONSTANT, "wide character constant",) -TS(FLOATINGPOINT, "floatingpoint number",) -TS(STRING_LITERAL, "string literal",) -TS(WIDE_STRING_LITERAL, "wide string literal",) +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 PUNCTUATOR(name,string,val) T(_ALL,name,string,val) +#define ALTERNATE(name, val) T(_CXX, name, #name, val) +#define PUNCTUATOR(name, string, val) T(_ALL, name, string, val) #include "tokens_punctuator.inc" #undef PUNCTUATOR +#undef ALTERNATE #define S(mode,x) T(mode,x,#x,) S(_ALL, auto) @@ -45,120 +50,213 @@ S(_ALL, unsigned) 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) +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) +S(_CXX, new) +S(_CXX, operator) +S(_CXX, private) +S(_CXX, protected) +S(_CXX, public) +S(_CXX, reinterpret_cast) +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) +S(_CXX, using) +S(_CXX, virtual) +S(_CXX, wchar_t) + S(_C99|_GNUC, _Bool) S(_ALL, __thread) S(_ALL, __extension__) S(_ALL, __builtin_classify_type) S(_ALL, __builtin_va_list) -S(_ALL, __builtin_expect) -S(_ALL, __builtin_offsetof) S(_ALL, __builtin_va_arg) -S(_ALL, __builtin_va_end) -S(_ALL, __builtin_alloca) -S(_ALL, __builtin_nanf) -S(_ALL, __builtin_nan) -S(_ALL, __builtin_nand) +S(_ALL, __builtin_va_copy) +S(_ALL, __builtin_offsetof) +S(_ALL, __builtin_constant_p) +S(_ALL, __builtin_types_compatible_p) S(_ALL, __builtin_isgreater) S(_ALL, __builtin_isgreaterequal) S(_ALL, __builtin_isless) S(_ALL, __builtin_islessequal) S(_ALL, __builtin_islessgreater) S(_ALL, __builtin_isunordered) -S(_ALL, __builtin_constant_p) -S(_ALL, __builtin_prefetch) S(_ALL, __PRETTY_FUNCTION__) S(_ALL, __FUNCTION__) +S(_ALL, __label__) S(_C99, __func__) S(_MS, __FUNCSIG__) S(_MS, __FUNCDNAME__) #undef S -T(_ANSI|_C99, signed, "signed",) -T(_ALL, __signed, "__signed", = T_signed) -T(_ALL, __signed__, "__signed__", = T_signed) -T(_C99|_GNUC, _Complex, "_Complex",) -T(_GNUC, __complex__, "__complex__", = T__Complex) -T(_GNUC, __complex, "__complex", = T__Complex) -T(_C99|_GNUC, _Imaginary, "_Imaginary",) -T(_GNUC, __real__, "__real__",) -T(_GNUC, __real, "__real", = T___real__) -T(_GNUC, __imag__, "__imag__",) -T(_GNUC, __imag, "__imag", = T___imag__) -T(_GNUC|_MS, __alignof__, "__alignof__",) -T(_GNUC|_MS, __alignof, "__alignof", = T___alignof__) -T(_MS, _alignof, "_alignof", = T___alignof__) -T(_ANSI|_C99, const, "const",) -T(_GNUC, __const, "__const", = T_const) -T(_GNUC, __const__, "__const__", = T_const) -T(_C99, restrict, "restrict",) -T(_GNUC, __restrict__, "__restrict__", = T_restrict) -T(_GNUC, __restrict, "__restrict", = T_restrict) -T(_MS, _restrict, "_restrict", = T_restrict) -T(_ALL, asm, "asm",) -T(_GNUC, __asm__, "__asm__", = T_asm) -T(_MS, _asm, "_asm", = T_asm) -T(_GNUC|_MS, __asm, "__asm", = T_asm) -T(_ANSI|_C99, volatile, "volatile",) -T(_GNUC, __volatile, "__volatile", = T_volatile) -T(_GNUC, __volatile__, "__volatile__", = T_volatile) -T(_C99, inline, "inline",) -T(_GNUC|_MS, __inline, "__inline", = T_inline) -T(_GNUC, __inline__, "__inline__", = T_inline) -T(_GNUC, typeof, "typeof",) -T(_GNUC, __typeof, "__typeof", = T_typeof) -T(_GNUC, __typeof__, "__typeof__", = T_typeof) -T(_GNUC, __attribute__, "__attribute__",) +/* needed on Windows */ +#ifdef __w64 +#undef __w64 +#endif +#ifdef __ptr32 +#undef __ptr32 +#endif +#ifdef __ptr64 +#undef __ptr64 +#endif -T(_GNUC, __builtin_va_start, "__builtin_va_start",) -T(_GNUC, __builtin_stdarg_start, "__builtin_stdarg_start", = T___builtin_va_start) +/* needed on MinGW */ +#ifdef __MINGW32__ +#ifdef __int8 +#undef __int8 +#endif +#ifdef __int16 +#undef __int16 +#endif +#ifdef __int32 +#undef __int32 +#endif +#ifdef __int64 +#undef __int64 +#endif +#endif -T(_MS, _near, "_near",) -T(_MS, __near, "__near", = T__near) -T(_MS, _far, "_far",) -T(_MS, __far, "__far", = T__far) -T(_MS, cdecl, "cdecl",) -T(_MS, _cdecl, "_cdecl", = T_cdecl) -T(_MS, __cdecl, "__cdecl", = T_cdecl) -T(_MS, _stdcall, "_stdcall",) -T(_MS, __stdcall, "__stdcall", = T__stdcall) -T(_MS, _fastcall, "_fastcall",) -T(_MS, __fastcall, "__fastcall", = T__fastcall) -T(_MS, __thiscall, "__thiscall",) -T(_MS, _forceinline, "_forceinline",) -T(_MS, __forceinline, "__forceinline", = T__forceinline) -T(_MS, __unaligned, "__unaligned",) -T(_MS, _assume, "_assume",) -T(_MS, __assume, "__assume", = T__assume) -T(_MS, _try, "_try",) -T(_MS, __try, "__try", = T__try) -T(_MS, _finally, "_finally",) -T(_MS, __finally, "__finally", = T__finally) -T(_MS, _leave, "_leave",) -T(_MS, __leave, "__leave", = T__leave) -T(_MS, _except, "_except",) -T(_MS, __except, "__except", = T__except) -T(_MS, _declspec, "_declspec",) -T(_MS, __declspec, "__declspec", = T__declspec) -T(_MS, _based, "_based",) -T(_MS, __based, "__based", = T__based) -T(_MS, __noop, "__noop",) +#if defined(__MINGW32__) || defined(__CYGWIN__) +#ifdef __cdecl +#undef __cdecl +#endif +#ifdef __stdcall +#undef __stdcall +#endif +#ifdef __fastcall +#undef __fastcall +#endif +#endif -T(_MS, __ptr32, "__ptr32",) -T(_MS, __ptr64, "__ptr64",) -T(_MS, __sptr, "__sptr",) -T(_MS, __uptr, "__uptr",) -T(_MS, _w64, "_w64",) -T(_MS, __w64, "__w64", = T__w64) +/* needed on darwin... */ +#ifdef __signed +#undef __signed +#endif +#ifdef __volatile +#undef __volatile +#endif +#ifdef __const +#undef __const +#endif +#ifdef __restrict +#undef __restrict +#endif -T(_MS, _int8, "_int8",) -T(_MS, __int8, "__int8", = T__int8) -T(_MS, _int16, "_int16",) -T(_MS, __int16, "__int16", = T__int16) -T(_MS, _int32, "_int32",) -T(_MS, __int32, "__int32", = T__int32) -T(_MS, _int64, "_int64",) -T(_MS, __int64, "__int64", = T__int64) -T(_MS, _int128, "_int128",) -T(_MS, __int128, "__int128", = T__int128) +#define S(mode, x, val) T(mode, x, #x, val) +S(_ANSI|_C99|_CXX, signed, ) +S(_ALL, __signed, = T_signed) +S(_ALL, __signed__, = T_signed) +S(_C99|_GNUC, _Complex, ) +S(_ALL, __complex__, = T__Complex) +S(_ALL, __complex, = T__Complex) +S(_C99|_GNUC, _Imaginary, ) +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(_ALL, __const, = T_const) +S(_ALL, __const__, = T_const) +S(_C99, restrict, ) +S(_ALL, __restrict__, = T_restrict) +S(_ALL, __restrict, = T_restrict) +S(_MS, _restrict, = T_restrict) +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, = T_volatile) +S(_ALL, __volatile__, = T_volatile) +S(_C99|_CXX, inline, ) +S(_ALL, __inline, = T_inline) +S(_ALL, __inline__, = T_inline) +S(_GNUC, typeof, ) +S(_ALL, __typeof, = T_typeof) +S(_ALL, __typeof__, = T_typeof) +S(_ALL, __attribute__, ) -#undef _T +S(_ALL, __builtin_va_start, ) +S(_ALL, __builtin_stdarg_start, = T___builtin_va_start) + +S(_MS, _near, ) +S(_MS, __near, = T__near) +S(_MS, _far, ) +S(_MS, __far, = T__far) +S(_MS, cdecl, ) +S(_MS, _cdecl, = T_cdecl) +S(_MS, __cdecl, = T_cdecl) +S(_MS, _stdcall, ) +S(_MS, __stdcall, = T__stdcall) +S(_MS, _fastcall, ) +S(_MS, __fastcall, = T__fastcall) +S(_MS, __thiscall, ) +S(_MS, _forceinline, ) +S(_MS, __forceinline, = T__forceinline) +S(_MS, __unaligned, ) +S(_MS, _assume, ) +S(_MS, __assume, = T__assume) +S(_MS, _try, ) +S(_MS, __try, = T__try) +S(_MS, _finally, ) +S(_MS, __finally, = T__finally) +S(_MS, _leave, ) +S(_MS, __leave, = T__leave) +S(_MS, _except, ) +S(_MS, __except, = T__except) +S(_MS, _declspec, ) +S(_MS, __declspec, = T__declspec) +S(_MS, _based, ) +S(_MS, __based, = T__based) +S(_MS, __noop, ) + +S(_MS, __ptr32, ) +S(_MS, __ptr64, ) +S(_MS, __sptr, ) +S(_MS, __uptr, ) +S(_MS, _w64, ) +S(_MS, __w64, = T__w64) + +S(_MS, _int8, ) +S(_MS, __int8, = T__int8) +S(_MS, _int16, ) +S(_MS, __int16, = T__int16) +S(_MS, _int32, ) +S(_MS, __int32, = T__int32) +S(_MS, _int64, ) +S(_MS, __int64, = T__int64) +S(_MS, _int128, ) +S(_MS, __int128, = T__int128) +#undef S + +/* Redefine required macros for MinGW headers */ +#if defined(__MINGW32__) || defined(__CYGWIN__) +#define __stdcall __attribute__((__stdcall__)) +#define __fastcall __attribute__((__fastcall__)) +#define __cdecl __attribute__((__cdecl__)) +#endif