Repair the order of tokens.
[cparser] / tokens.inc
1 #ifndef TS
2 #define TS(x,str,val)
3 #endif
4
5 TS(IDENTIFIER,          "identifier", = 256)
6 TS(INTEGER,             "integer number",)
7 TS(FLOATINGPOINT,       "floatingpoint number",)
8 TS(STRING_LITERAL,      "string literal",)
9 TS(WIDE_STRING_LITERAL, "wide string literal",)
10
11 #define S(mode,x)   T(mode,x,#x,)
12 S(_ALL, auto)
13 S(_ALL, break)
14 S(_ALL, case)
15 S(_ALL, char)
16 S(_ALL, continue)
17 S(_ALL, default)
18 S(_ALL, do)
19 S(_ALL, double)
20 S(_ALL, else)
21 S(_ALL, enum)
22 S(_ALL, extern)
23 S(_ALL, float)
24 S(_ALL, for)
25 S(_ALL, goto)
26 S(_ALL, if)
27 S(_ALL, int)
28 S(_ALL, long)
29 S(_ALL, register)
30 S(_ALL, return)
31 S(_ALL, short)
32 S(_ANSI|_C99, signed)
33 S(_ALL, sizeof)
34 S(_ALL, static)
35 S(_ALL, struct)
36 S(_ALL, switch)
37 S(_ALL, typedef)
38 S(_ALL, union)
39 S(_ALL, unsigned)
40 S(_ALL, void)
41 S(_ALL, while)
42
43 S(_C99|_GNUC, _Bool)
44 S(_C99|_GNUC, _Complex)
45 S(_C99|_GNUC, _Imaginary)
46 S(_GNUC, __thread)
47 S(_GNUC, __extension__)
48 S(_GNUC, __builtin_classify_type)
49 S(_GNUC, __builtin_va_list)
50 S(_GNUC, __builtin_expect)
51 S(_GNUC, __builtin_offsetof)
52 S(_GNUC, __builtin_va_arg)
53 S(_GNUC, __builtin_va_end)
54 S(_GNUC, __builtin_alloca)
55 S(_GNUC, __builtin_nanf)
56 S(_GNUC, __builtin_nan)
57 S(_GNUC, __builtin_nand)
58 S(_GNUC, __builtin_isgreater)
59 S(_GNUC, __builtin_isgreaterequal)
60 S(_GNUC, __builtin_isless)
61 S(_GNUC, __builtin_islessequal)
62 S(_GNUC, __builtin_islessgreater)
63 S(_GNUC, __builtin_isunordered)
64 S(_GNUC, __builtin_constant_p)
65 S(_GNUC, __builtin_prefetch)
66 S(_C99, __PRETTY_FUNCTION__)
67 S(_ALL, __FUNCTION__)
68 S(_C99, __func__)
69 #undef S
70
71 T(_GNUC,      real,           "__real__",)
72 T(_GNUC,      _real,          "__real",                 = T_real)
73 T(_GNUC,      imag,           "__imag__",)
74 T(_GNUC,      _imag,          "__imag",                 = T_imag)
75 T(_GNUC|_MS,  __alignof__,    "__alignof__",)
76 T(_GNUC|_MS,  __alignof,      "__alignof",              = T___alignof__)
77 T(_MS,        _alignof,       "_alignof",               = T___alignof__)
78 T(_ANSI|_C99, const,          "const",)
79 T(_GNUC,      _const,         "__const",                = T_const)
80 T(_GNUC|_MS,  restrict,       "__restrict",)
81 T(_GNUC,      _restrict_,     "__restrict__",           = T_restrict)
82 T(_C99,       _restrict,      "restrict",               = T_restrict)
83 T(_ALL,       asm,            "asm",)
84 T(_GNUC,      __asm__,        "__asm__",                = T_asm)
85 T(_MS,        _asm,           "_asm",                   = T_asm)
86 T(_MS,        __asm,          "__asm",                  = T_asm)
87 T(_ANSI|_C99, volatile,       "volatile",)
88 T(_GNUC,      __volatile__,   "__volatile__",           = T_volatile)
89 T(_C99,       inline,         "inline",)
90 T(_GNUC|_MS,  __inline,       "__inline",               = T_inline)
91 T(_GNUC,      __inline__,     "__inline__",             = T_inline)
92 T(_GNUC,      typeof,         "typeof",)
93 T(_GNUC,      __typeof,       "__typeof",               = T_typeof)
94 T(_GNUC,      __typeof__,     "__typeof__",             = T_typeof)
95 T(_GNUC,      attribute,      "__attribute",)
96 T(_GNUC,      __attribute__,  "__attribute__",          = T_attribute)
97
98 T(_GNUC,     __builtin_va_start,     "__builtin_va_start",)
99 T(_GNUC,     __builtin_stdarg_start, "__builtin_stdarg_start", = T___builtin_va_start)
100
101 T(_MS,       near,            "_near",)
102 T(_MS,       _near,           "__near",                  = T_near)
103 T(_MS,       far,             "_far",)
104 T(_MS,       _far,            "__far",                   = T_far)
105 T(_MS,      cdecl,            "cdecl",)
106 T(_MS,      _cdecl,           "_cdecl",                  = T_cdecl)
107 T(_MS,      __cdecl,          "__cdecl",                 = T_cdecl)
108 T(_MS,      stdcall,          "_stdcall",)
109 T(_MS,      __stdcall,        "__stdcall",               = T_stdcall)
110 T(_MS,      fastcall,         "_fastcall",)
111 T(_MS,      __fastcall,       "__fastcall",              = T_fastcall)
112 T(_MS,      thiscall,         "_thiscall",)
113 T(_MS,      __thiscall,       "__thiscall",              = T_thiscall)
114 T(_MS,      forceinline,      "_forceinline",)
115 T(_MS,      __forceinline,    "__forceinline",           = T_forceinline)
116 T(_MS,      unaligned,        "_unaligned",)
117 T(_MS,      __unaligned,      "__unaligned",             = T_unaligned)
118 T(_MS,      assume,           "_assume",)
119 T(_MS,      __assume,         "__assume",                = T_assume)
120 T(_MS,      try,              "_try",)
121 T(_MS,      __try,            "__try",                   = T_try)
122 T(_MS,      finally,          "_finally",)
123 T(_MS,      __finally,        "__finally",               = T_finally)
124 T(_MS,      leave,            "_leave",)
125 T(_MS,      __leave,          "__leave",                 = T_leave)
126 T(_MS,      except,           "_except",)
127 T(_MS,      __except,         "__except",                = T_except)
128 T(_MS,      declspec,         "_declspec",)
129 T(_MS,      __declspec,       "__declspec",              = T_declspec)
130 T(_MS,      based,            "_based",)
131 T(_MS,      __based,          "__based",                 = T_based)
132
133 T(_MS,      int8,             "_int8",)
134 T(_MS,      __int8,           "__int8",                  = T_int8)
135 T(_MS,      int16,            "_int16",)
136 T(_MS,      __int16,          "__int16",                 = T_int16)
137 T(_MS,      int32,            "_int32",)
138 T(_MS,      __int32,          "__int32",                 = T_int32)
139 T(_MS,      int64,            "_int64",)
140 T(_MS,      __int64,          "__int64",                 = T_int64)
141
142 #define _T(x,str,val) T(_ALL,x,str,val)
143
144 _T(MINUSGREATER,             "->",)
145 _T(PLUSPLUS,                 "++",)
146 _T(MINUSMINUS,               "--",)
147 _T(LESSLESS,                 "<<",)
148 _T(GREATERGREATER,           ">>",)
149 _T(LESSEQUAL,                "<=",)
150 _T(GREATEREQUAL,             ">=",)
151 _T(EQUALEQUAL,               "==",)
152 _T(EXCLAMATIONMARKEQUAL,     "!=",)
153 _T(ANDAND,                   "&&",)
154 _T(PIPEPIPE,                 "||",)
155 _T(DOTDOTDOT,                "...",)
156 _T(ASTERISKEQUAL,            "*=",)
157 _T(SLASHEQUAL,               "/=",)
158 _T(PERCENTEQUAL,             "%=",)
159 _T(PLUSEQUAL,                "+=",)
160 _T(MINUSEQUAL,               "-=",)
161 _T(LESSLESSEQUAL,            "<<=",)
162 _T(GREATERGREATEREQUAL,      ">>=",)
163 _T(ANDEQUAL,                 "&=",)
164 _T(CARETEQUAL,               "^=",)
165 _T(PIPEEQUAL,                "|=",)
166 _T(HASHHASH,                 "##",)
167
168 #define T_LAST_TOKEN  (T_HASHHASH+1)
169
170 _T(LESSCOLON,                "<:",   = '[')
171 _T(COLONGREATER,             ":>",   = ']')
172 _T(LESSPERCENT,              "<%",   = '{')
173 _T(PERCENTGREATER,           "%>",   = '}')
174 _T(PERCENTCOLON,             "%:",   = '#')
175 _T(PERCENTCOLONPERCENTCOLON, "%:%:", = T_HASHHASH)
176
177 _T(RBRACK,          "[", = '[')
178 _T(LBRACK,          "]", = ']')
179 _T(LBRACE,          "(", = '(')
180 _T(RBRACE,          ")", = ')')
181 _T(RCURLY,          "{", = '{')
182 _T(LCURLY,          "}", = '}')
183 _T(DOT,             ".", = '.')
184 _T(AND,             "&", = '&')
185 _T(ASTERISK,        "*", = '*')
186 _T(PLUS,            "+", = '+')
187 _T(MINUS,           "-", = '-')
188 _T(TILDE,           "~", = '~')
189 _T(EXCLAMATIONMARK, "!", = '!')
190 _T(SLASH,           "/", = '/')
191 _T(PERCENT,         "%", = '%')
192 _T(LESS,            "<", = '<')
193 _T(GREATER,         ">", = '>')
194 _T(CARET,           "^", = '^')
195 _T(PIPE,            "|", = '|')
196 _T(QUESTIONMARK,    "?", = '?')
197 _T(COLON,           ":", = ':')
198 _T(SEMICOLON,       ";", = ';')
199 _T(EQUAL,           "=", = '=')
200 _T(COMMA,           ",", = ',')
201 _T(HASH,            "#", = '#')
202
203 #undef _T
204
205 TS(NEWLINE,        "newline", = '\n')