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