]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/wave/cpplexer/re2clex/cpp.re
import quincy beta 17.1.0
[ceph.git] / ceph / src / boost / boost / wave / cpplexer / re2clex / cpp.re
1 /*=============================================================================
2 Boost.Wave: A Standard compliant C++ preprocessor library
3
4 Copyright (c) 2001 Daniel C. Nuffer
5 Copyright (c) 2001-2013 Hartmut Kaiser.
6 Distributed under the Boost Software License, Version 1.0. (See accompanying
7 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
8
9 This is a lexer conforming to the Standard with a few exceptions.
10 So it does allow the '$' to be part of identifiers. If you need strict
11 Standards conforming behaviour, please include the lexer definition
12 provided in the file strict_cpp.re.
13
14 TODO:
15 handle errors better.
16 =============================================================================*/
17
18 /*!re2c
19 re2c:indent:string = " ";
20 any = [\t\v\f\r\n\040-\377];
21 anyctrl = [\001-\037];
22 OctalDigit = [0-7];
23 Digit = [0-9];
24 HexDigit = [a-fA-F0-9];
25 Integer = (("0" [xX] HexDigit+) | ("0" OctalDigit*) | ([1-9] Digit*));
26 ExponentStart = [Ee] [+-];
27 ExponentPart = [Ee] [+-]? Digit+;
28 FractionalConstant = (Digit* "." Digit+) | (Digit+ ".");
29 FloatingSuffix = [fF] [lL]? | [lL] [fF]?;
30 IntegerSuffix = [uU] [lL]? | [lL] [uU]?;
31 LongIntegerSuffix = [uU] ("ll" | "LL") | ("ll" | "LL") [uU]?;
32 MSLongIntegerSuffix = "u"? "i64";
33 Backslash = [\\] | "??/";
34 EscapeSequence = Backslash ([abfnrtv?'"] | Backslash | "x" HexDigit+ | OctalDigit OctalDigit? OctalDigit?);
35 HexQuad = HexDigit HexDigit HexDigit HexDigit;
36 UniversalChar = Backslash ("u" HexQuad | "U" HexQuad HexQuad);
37 Newline = "\r\n" | "\n" | "\r";
38 PPSpace = ([ \t\f\v]|("/*"(any\[*]|Newline|("*"+(any\[*/]|Newline)))*"*"+"/"))*;
39 Pound = "#" | "??=" | "%:";
40 NonDigit = [a-zA-Z_$] | UniversalChar;
41 */
42
43 /*!re2c
44 "/*" { goto ccomment; }
45 "//" { goto cppcomment; }
46 "."? Digit { goto pp_number; }
47
48 "alignas" { BOOST_WAVE_RET(s->act_in_cpp0x_mode ? T_ALIGNAS : T_IDENTIFIER); }
49 "alignof" { BOOST_WAVE_RET(s->act_in_cpp0x_mode ? T_ALIGNOF : T_IDENTIFIER); }
50 "asm" { BOOST_WAVE_RET(T_ASM); }
51 "auto" { BOOST_WAVE_RET(T_AUTO); }
52 "bool" { BOOST_WAVE_RET(T_BOOL); }
53 "break" { BOOST_WAVE_RET(T_BREAK); }
54 "case" { BOOST_WAVE_RET(T_CASE); }
55 "catch" { BOOST_WAVE_RET(T_CATCH); }
56 "char" { BOOST_WAVE_RET(T_CHAR); }
57 "char8_t" { BOOST_WAVE_RET(s->act_in_cpp2a_mode ? T_CHAR8_T : T_IDENTIFIER); }
58 "char16_t" { BOOST_WAVE_RET(s->act_in_cpp0x_mode ? T_CHAR16_T : T_IDENTIFIER); }
59 "char32_t" { BOOST_WAVE_RET(s->act_in_cpp0x_mode ? T_CHAR32_T : T_IDENTIFIER); }
60 "class" { BOOST_WAVE_RET(T_CLASS); }
61 "concept" { BOOST_WAVE_RET(s->act_in_cpp2a_mode ? T_CONCEPT : T_IDENTIFIER); }
62 "const" { BOOST_WAVE_RET(T_CONST); }
63 "consteval" { BOOST_WAVE_RET(s->act_in_cpp2a_mode ? T_CONSTEVAL : T_IDENTIFIER); }
64 "constexpr" { BOOST_WAVE_RET(s->act_in_cpp0x_mode ? T_CONSTEXPR : T_IDENTIFIER); }
65 "constinit" { BOOST_WAVE_RET(s->act_in_cpp2a_mode ? T_CONSTINIT : T_IDENTIFIER); }
66 "const_cast" { BOOST_WAVE_RET(T_CONSTCAST); }
67 "continue" { BOOST_WAVE_RET(T_CONTINUE); }
68 "co_await" { BOOST_WAVE_RET(s->act_in_cpp2a_mode ? T_CO_AWAIT : T_IDENTIFIER); }
69 "co_return" { BOOST_WAVE_RET(s->act_in_cpp2a_mode ? T_CO_RETURN : T_IDENTIFIER); }
70 "co_yield" { BOOST_WAVE_RET(s->act_in_cpp2a_mode ? T_CO_YIELD : T_IDENTIFIER); }
71 "decltype" { BOOST_WAVE_RET(s->act_in_cpp0x_mode ? T_DECLTYPE : T_IDENTIFIER); }
72 "default" { BOOST_WAVE_RET(T_DEFAULT); }
73 "delete" { BOOST_WAVE_RET(T_DELETE); }
74 "do" { BOOST_WAVE_RET(T_DO); }
75 "double" { BOOST_WAVE_RET(T_DOUBLE); }
76 "dynamic_cast" { BOOST_WAVE_RET(T_DYNAMICCAST); }
77 "else" { BOOST_WAVE_RET(T_ELSE); }
78 "enum" { BOOST_WAVE_RET(T_ENUM); }
79 "explicit" { BOOST_WAVE_RET(T_EXPLICIT); }
80 "export" { BOOST_WAVE_RET(T_EXPORT); }
81 "extern" { BOOST_WAVE_RET(T_EXTERN); }
82 "false" { BOOST_WAVE_RET(T_FALSE); }
83 "float" { BOOST_WAVE_RET(T_FLOAT); }
84 "for" { BOOST_WAVE_RET(T_FOR); }
85 "friend" { BOOST_WAVE_RET(T_FRIEND); }
86 "goto" { BOOST_WAVE_RET(T_GOTO); }
87 "if" { BOOST_WAVE_RET(T_IF); }
88 "import" { BOOST_WAVE_RET(s->enable_import_keyword ? T_IMPORT : T_IDENTIFIER); }
89 "inline" { BOOST_WAVE_RET(T_INLINE); }
90 "int" { BOOST_WAVE_RET(T_INT); }
91 "long" { BOOST_WAVE_RET(T_LONG); }
92 "mutable" { BOOST_WAVE_RET(T_MUTABLE); }
93 "namespace" { BOOST_WAVE_RET(T_NAMESPACE); }
94 "new" { BOOST_WAVE_RET(T_NEW); }
95 "noexcept" { BOOST_WAVE_RET(s->act_in_cpp0x_mode ? T_NOEXCEPT : T_IDENTIFIER); }
96 "nullptr" { BOOST_WAVE_RET(s->act_in_cpp0x_mode ? T_NULLPTR : T_IDENTIFIER); }
97 "operator" { BOOST_WAVE_RET(T_OPERATOR); }
98 "private" { BOOST_WAVE_RET(T_PRIVATE); }
99 "protected" { BOOST_WAVE_RET(T_PROTECTED); }
100 "public" { BOOST_WAVE_RET(T_PUBLIC); }
101 "register" { BOOST_WAVE_RET(T_REGISTER); }
102 "reinterpret_cast" { BOOST_WAVE_RET(T_REINTERPRETCAST); }
103 "requires" { BOOST_WAVE_RET(s->act_in_cpp2a_mode ? T_REQUIRES : T_IDENTIFIER); }
104 "return" { BOOST_WAVE_RET(T_RETURN); }
105 "short" { BOOST_WAVE_RET(T_SHORT); }
106 "signed" { BOOST_WAVE_RET(T_SIGNED); }
107 "sizeof" { BOOST_WAVE_RET(T_SIZEOF); }
108 "static" { BOOST_WAVE_RET(T_STATIC); }
109 "static_cast" { BOOST_WAVE_RET(T_STATICCAST); }
110 "static_assert" { BOOST_WAVE_RET(s->act_in_cpp0x_mode ? T_STATICASSERT : T_IDENTIFIER); }
111 "struct" { BOOST_WAVE_RET(T_STRUCT); }
112 "switch" { BOOST_WAVE_RET(T_SWITCH); }
113 "template" { BOOST_WAVE_RET(T_TEMPLATE); }
114 "this" { BOOST_WAVE_RET(T_THIS); }
115 "thread_local" { BOOST_WAVE_RET(s->act_in_cpp0x_mode ? T_THREADLOCAL : T_IDENTIFIER); }
116 "throw" { BOOST_WAVE_RET(T_THROW); }
117 "true" { BOOST_WAVE_RET(T_TRUE); }
118 "try" { BOOST_WAVE_RET(T_TRY); }
119 "typedef" { BOOST_WAVE_RET(T_TYPEDEF); }
120 "typeid" { BOOST_WAVE_RET(T_TYPEID); }
121 "typename" { BOOST_WAVE_RET(T_TYPENAME); }
122 "union" { BOOST_WAVE_RET(T_UNION); }
123 "unsigned" { BOOST_WAVE_RET(T_UNSIGNED); }
124 "using" { BOOST_WAVE_RET(T_USING); }
125 "virtual" { BOOST_WAVE_RET(T_VIRTUAL); }
126 "void" { BOOST_WAVE_RET(T_VOID); }
127 "volatile" { BOOST_WAVE_RET(T_VOLATILE); }
128 "wchar_t" { BOOST_WAVE_RET(T_WCHART); }
129 "while" { BOOST_WAVE_RET(T_WHILE); }
130
131 "__int8" { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_INT8 : T_IDENTIFIER); }
132 "__int16" { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_INT16 : T_IDENTIFIER); }
133 "__int32" { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_INT32 : T_IDENTIFIER); }
134 "__int64" { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_INT64 : T_IDENTIFIER); }
135 "_"? "_based" { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_BASED : T_IDENTIFIER); }
136 "_"? "_declspec" { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_DECLSPEC : T_IDENTIFIER); }
137 "_"? "_cdecl" { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_CDECL : T_IDENTIFIER); }
138 "_"? "_fastcall" { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_FASTCALL : T_IDENTIFIER); }
139 "_"? "_stdcall" { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_STDCALL : T_IDENTIFIER); }
140 "__try" { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_TRY : T_IDENTIFIER); }
141 "__except" { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_EXCEPT : T_IDENTIFIER); }
142 "__finally" { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_FINALLY : T_IDENTIFIER); }
143 "__leave" { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_LEAVE : T_IDENTIFIER); }
144 "_"? "_inline" { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_INLINE : T_IDENTIFIER); }
145 "_"? "_asm" { BOOST_WAVE_RET(s->enable_ms_extensions ? T_MSEXT_ASM : T_IDENTIFIER); }
146
147 "{" { BOOST_WAVE_RET(T_LEFTBRACE); }
148 "??<" { BOOST_WAVE_RET(T_LEFTBRACE_TRIGRAPH); }
149 "<%" { BOOST_WAVE_RET(T_LEFTBRACE_ALT); }
150 "}" { BOOST_WAVE_RET(T_RIGHTBRACE); }
151 "??>" { BOOST_WAVE_RET(T_RIGHTBRACE_TRIGRAPH); }
152 "%>" { BOOST_WAVE_RET(T_RIGHTBRACE_ALT); }
153 "[" { BOOST_WAVE_RET(T_LEFTBRACKET); }
154 "??(" { BOOST_WAVE_RET(T_LEFTBRACKET_TRIGRAPH); }
155 "<:" { BOOST_WAVE_RET(T_LEFTBRACKET_ALT); }
156 "]" { BOOST_WAVE_RET(T_RIGHTBRACKET); }
157 "??)" { BOOST_WAVE_RET(T_RIGHTBRACKET_TRIGRAPH); }
158 ":>" { BOOST_WAVE_RET(T_RIGHTBRACKET_ALT); }
159 "#" { BOOST_WAVE_RET(T_POUND); }
160 "%:" { BOOST_WAVE_RET(T_POUND_ALT); }
161 "??=" { BOOST_WAVE_RET(T_POUND_TRIGRAPH); }
162 "##" { BOOST_WAVE_RET(T_POUND_POUND); }
163 "#??=" { BOOST_WAVE_RET(T_POUND_POUND_TRIGRAPH); }
164 "??=#" { BOOST_WAVE_RET(T_POUND_POUND_TRIGRAPH); }
165 "??=??=" { BOOST_WAVE_RET(T_POUND_POUND_TRIGRAPH); }
166 "%:%:" { BOOST_WAVE_RET(T_POUND_POUND_ALT); }
167 "(" { BOOST_WAVE_RET(T_LEFTPAREN); }
168 ")" { BOOST_WAVE_RET(T_RIGHTPAREN); }
169 ";" { BOOST_WAVE_RET(T_SEMICOLON); }
170 ":" { BOOST_WAVE_RET(T_COLON); }
171 "..." { BOOST_WAVE_RET(T_ELLIPSIS); }
172 "?" { BOOST_WAVE_RET(T_QUESTION_MARK); }
173 "::"
174 {
175 if (s->act_in_c99_mode) {
176 --YYCURSOR;
177 BOOST_WAVE_RET(T_COLON);
178 }
179 else {
180 BOOST_WAVE_RET(T_COLON_COLON);
181 }
182 }
183 "." { BOOST_WAVE_RET(T_DOT); }
184 ".*"
185 {
186 if (s->act_in_c99_mode) {
187 --YYCURSOR;
188 BOOST_WAVE_RET(T_DOT);
189 }
190 else {
191 BOOST_WAVE_RET(T_DOTSTAR);
192 }
193 }
194 "+" { BOOST_WAVE_RET(T_PLUS); }
195 "-" { BOOST_WAVE_RET(T_MINUS); }
196 "*" { BOOST_WAVE_RET(T_STAR); }
197 "/" { BOOST_WAVE_RET(T_DIVIDE); }
198 "%" { BOOST_WAVE_RET(T_PERCENT); }
199 "^" { BOOST_WAVE_RET(T_XOR); }
200 "??'" { BOOST_WAVE_RET(T_XOR_TRIGRAPH); }
201 "xor" { BOOST_WAVE_RET(s->act_in_c99_mode ? T_IDENTIFIER : T_XOR_ALT); }
202 "&" { BOOST_WAVE_RET(T_AND); }
203 "bitand" { BOOST_WAVE_RET(s->act_in_c99_mode ? T_IDENTIFIER : T_AND_ALT); }
204 "|" { BOOST_WAVE_RET(T_OR); }
205 "bitor" { BOOST_WAVE_RET(s->act_in_c99_mode ? T_IDENTIFIER : T_OR_ALT); }
206 "??!" { BOOST_WAVE_RET(T_OR_TRIGRAPH); }
207 "~" { BOOST_WAVE_RET(T_COMPL); }
208 "??-" { BOOST_WAVE_RET(T_COMPL_TRIGRAPH); }
209 "compl" { BOOST_WAVE_RET(s->act_in_c99_mode ? T_IDENTIFIER : T_COMPL_ALT); }
210 "!" { BOOST_WAVE_RET(T_NOT); }
211 "not" { BOOST_WAVE_RET(s->act_in_c99_mode ? T_IDENTIFIER : T_NOT_ALT); }
212 "=" { BOOST_WAVE_RET(T_ASSIGN); }
213 "<" { BOOST_WAVE_RET(T_LESS); }
214 ">" { BOOST_WAVE_RET(T_GREATER); }
215 "+=" { BOOST_WAVE_RET(T_PLUSASSIGN); }
216 "-=" { BOOST_WAVE_RET(T_MINUSASSIGN); }
217 "*=" { BOOST_WAVE_RET(T_STARASSIGN); }
218 "/=" { BOOST_WAVE_RET(T_DIVIDEASSIGN); }
219 "%=" { BOOST_WAVE_RET(T_PERCENTASSIGN); }
220 "^=" { BOOST_WAVE_RET(T_XORASSIGN); }
221 "xor_eq" { BOOST_WAVE_RET(s->act_in_c99_mode ? T_IDENTIFIER : T_XORASSIGN_ALT); }
222 "??'=" { BOOST_WAVE_RET(T_XORASSIGN_TRIGRAPH); }
223 "&=" { BOOST_WAVE_RET(T_ANDASSIGN); }
224 "and_eq" { BOOST_WAVE_RET(s->act_in_c99_mode ? T_IDENTIFIER : T_ANDASSIGN_ALT); }
225 "|=" { BOOST_WAVE_RET(T_ORASSIGN); }
226 "or_eq" { BOOST_WAVE_RET(s->act_in_c99_mode ? T_IDENTIFIER : T_ORASSIGN_ALT); }
227 "??!=" { BOOST_WAVE_RET(T_ORASSIGN_TRIGRAPH); }
228 "<<" { BOOST_WAVE_RET(T_SHIFTLEFT); }
229 ">>" { BOOST_WAVE_RET(T_SHIFTRIGHT); }
230 ">>=" { BOOST_WAVE_RET(T_SHIFTRIGHTASSIGN); }
231 "<<=" { BOOST_WAVE_RET(T_SHIFTLEFTASSIGN); }
232 "==" { BOOST_WAVE_RET(T_EQUAL); }
233 "!=" { BOOST_WAVE_RET(T_NOTEQUAL); }
234 "not_eq" { BOOST_WAVE_RET(s->act_in_c99_mode ? T_IDENTIFIER : T_NOTEQUAL_ALT); }
235 "<=>"
236 {
237 if (s->act_in_cpp2a_mode) {
238 BOOST_WAVE_RET(T_SPACESHIP);
239 }
240 else {
241 --YYCURSOR;
242 BOOST_WAVE_RET(T_LESSEQUAL);
243 }
244 }
245 "<=" { BOOST_WAVE_RET(T_LESSEQUAL); }
246 ">=" { BOOST_WAVE_RET(T_GREATEREQUAL); }
247 "&&" { BOOST_WAVE_RET(T_ANDAND); }
248 "and" { BOOST_WAVE_RET(s->act_in_c99_mode ? T_IDENTIFIER : T_ANDAND_ALT); }
249 "||" { BOOST_WAVE_RET(T_OROR); }
250 "??!|" { BOOST_WAVE_RET(T_OROR_TRIGRAPH); }
251 "|??!" { BOOST_WAVE_RET(T_OROR_TRIGRAPH); }
252 "or" { BOOST_WAVE_RET(s->act_in_c99_mode ? T_IDENTIFIER : T_OROR_ALT); }
253 "??!??!" { BOOST_WAVE_RET(T_OROR_TRIGRAPH); }
254 "++" { BOOST_WAVE_RET(T_PLUSPLUS); }
255 "--" { BOOST_WAVE_RET(T_MINUSMINUS); }
256 "," { BOOST_WAVE_RET(T_COMMA); }
257 "->*"
258 {
259 if (s->act_in_c99_mode) {
260 --YYCURSOR;
261 BOOST_WAVE_RET(T_ARROW);
262 }
263 else {
264 BOOST_WAVE_RET(T_ARROWSTAR);
265 }
266 }
267 "->" { BOOST_WAVE_RET(T_ARROW); }
268 "??/" { BOOST_WAVE_RET(T_ANY_TRIGRAPH); }
269
270 "L"? (['] (EscapeSequence | UniversalChar | any\[\n\r\\'])+ ['])
271 { BOOST_WAVE_RET(T_CHARLIT); }
272
273 "L"? (["] (EscapeSequence | UniversalChar | any\[\n\r\\"])* ["])
274 { BOOST_WAVE_RET(T_STRINGLIT); }
275
276 "L"? "R" ["]
277 {
278 if (s->act_in_cpp0x_mode)
279 {
280 rawstringdelim = "";
281 goto extrawstringlit;
282 }
283 --YYCURSOR;
284 BOOST_WAVE_RET(T_IDENTIFIER);
285 }
286
287 [uU] [']
288 {
289 if (s->act_in_cpp0x_mode)
290 goto extcharlit;
291 --YYCURSOR;
292 BOOST_WAVE_RET(T_IDENTIFIER);
293 }
294
295 ([uU] | "u8") ["]
296 {
297 if (s->act_in_cpp0x_mode)
298 goto extstringlit;
299 --YYCURSOR;
300 BOOST_WAVE_RET(T_IDENTIFIER);
301 }
302
303 ([uU] | "u8") "R" ["]
304 {
305 if (s->act_in_cpp0x_mode)
306 {
307 rawstringdelim = "";
308 goto extrawstringlit;
309 }
310 --YYCURSOR;
311 BOOST_WAVE_RET(T_IDENTIFIER);
312 }
313
314 ([a-zA-Z_$] | UniversalChar) ([a-zA-Z_0-9$] | UniversalChar)*
315 { BOOST_WAVE_RET(T_IDENTIFIER); }
316
317 Pound PPSpace ( "include" | "include_next") PPSpace "<" (any\[\n\r>])+ ">"
318 { BOOST_WAVE_RET(T_PP_HHEADER); }
319
320 Pound PPSpace ( "include" | "include_next") PPSpace "\"" (any\[\n\r"])+ "\""
321 { BOOST_WAVE_RET(T_PP_QHEADER); }
322
323 Pound PPSpace ( "include" | "include_next") PPSpace
324 { BOOST_WAVE_RET(T_PP_INCLUDE); }
325
326 Pound PPSpace "if" { BOOST_WAVE_RET(T_PP_IF); }
327 Pound PPSpace "ifdef" { BOOST_WAVE_RET(T_PP_IFDEF); }
328 Pound PPSpace "ifndef" { BOOST_WAVE_RET(T_PP_IFNDEF); }
329 Pound PPSpace "else" { BOOST_WAVE_RET(T_PP_ELSE); }
330 Pound PPSpace "elif" { BOOST_WAVE_RET(T_PP_ELIF); }
331 Pound PPSpace "endif" { BOOST_WAVE_RET(T_PP_ENDIF); }
332 Pound PPSpace "define" { BOOST_WAVE_RET(T_PP_DEFINE); }
333 Pound PPSpace "undef" { BOOST_WAVE_RET(T_PP_UNDEF); }
334 Pound PPSpace "line" { BOOST_WAVE_RET(T_PP_LINE); }
335 Pound PPSpace "error" { BOOST_WAVE_RET(T_PP_ERROR); }
336 Pound PPSpace "pragma" { BOOST_WAVE_RET(T_PP_PRAGMA); }
337
338 Pound PPSpace "warning" { BOOST_WAVE_RET(T_PP_WARNING); }
339
340 Pound PPSpace "region" { BOOST_WAVE_RET(T_MSEXT_PP_REGION); }
341 Pound PPSpace "endregion" { BOOST_WAVE_RET(T_MSEXT_PP_ENDREGION); }
342
343 [ \t\v\f]+
344 { BOOST_WAVE_RET(T_SPACE); }
345
346 Newline
347 {
348 s->line++;
349 cursor.column = 1;
350 BOOST_WAVE_RET(T_NEWLINE);
351 }
352
353 "\000"
354 {
355 if (s->eof && cursor != s->eof)
356 {
357 BOOST_WAVE_UPDATE_CURSOR(); // adjust the input cursor
358 (*s->error_proc)(s, lexing_exception::generic_lexing_error,
359 "invalid character '\\000' in input stream");
360 }
361 BOOST_WAVE_RET(T_EOF);
362 }
363
364 any { BOOST_WAVE_RET(TOKEN_FROM_ID(*s->tok, UnknownTokenType)); }
365
366 anyctrl
367 {
368 // flag the error
369 BOOST_WAVE_UPDATE_CURSOR(); // adjust the input cursor
370 (*s->error_proc)(s, lexing_exception::generic_lexing_error,
371 "invalid character '\\%03o' in input stream", *--YYCURSOR);
372 }
373 */
374
375 ccomment:
376 /*!re2c
377 "*/" { BOOST_WAVE_RET(T_CCOMMENT); }
378
379 Newline
380 {
381 /*if(cursor == s->eof) BOOST_WAVE_RET(T_EOF);*/
382 /*s->tok = cursor; */
383 s->line += count_backslash_newlines(s, cursor) +1;
384 cursor.column = 1;
385 goto ccomment;
386 }
387
388 any { goto ccomment; }
389
390 "\000"
391 {
392 if(cursor == s->eof)
393 {
394 BOOST_WAVE_UPDATE_CURSOR(); // adjust the input cursor
395 (*s->error_proc)(s, lexing_exception::generic_lexing_warning,
396 "Unterminated 'C' style comment");
397 }
398 else
399 {
400 --YYCURSOR; // next call returns T_EOF
401 BOOST_WAVE_UPDATE_CURSOR(); // adjust the input cursor
402 (*s->error_proc)(s, lexing_exception::generic_lexing_error,
403 "invalid character: '\\000' in input stream");
404 }
405 }
406
407 anyctrl
408 {
409 // flag the error
410 BOOST_WAVE_UPDATE_CURSOR(); // adjust the input cursor
411 (*s->error_proc)(s, lexing_exception::generic_lexing_error,
412 "invalid character '\\%03o' in input stream", *--YYCURSOR);
413 }
414 */
415
416 cppcomment:
417 /*!re2c
418 Newline
419 {
420 /*if(cursor == s->eof) BOOST_WAVE_RET(T_EOF); */
421 /*s->tok = cursor; */
422 s->line++;
423 cursor.column = 1;
424 BOOST_WAVE_RET(T_CPPCOMMENT);
425 }
426
427 any { goto cppcomment; }
428
429 "\000"
430 {
431 if (s->eof && cursor != s->eof)
432 {
433 --YYCURSOR; // next call returns T_EOF
434 BOOST_WAVE_UPDATE_CURSOR(); // adjust the input cursor
435 (*s->error_proc)(s, lexing_exception::generic_lexing_error,
436 "invalid character '\\000' in input stream");
437 }
438
439 --YYCURSOR; // next call returns T_EOF
440 if (!s->single_line_only)
441 {
442 BOOST_WAVE_UPDATE_CURSOR(); // adjust the input cursor
443 (*s->error_proc)(s, lexing_exception::generic_lexing_warning,
444 "Unterminated 'C++' style comment");
445 }
446 BOOST_WAVE_RET(T_CPPCOMMENT);
447 }
448
449 anyctrl
450 {
451 // flag the error
452 BOOST_WAVE_UPDATE_CURSOR(); // adjust the input cursor
453 (*s->error_proc)(s, lexing_exception::generic_lexing_error,
454 "invalid character '\\%03o' in input stream", *--YYCURSOR);
455 }
456 */
457
458 /* this subscanner is called whenever a pp_number has been started */
459 pp_number:
460 {
461 cursor = uchar_wrapper(s->tok = s->cur, s->column = s->curr_column);
462 marker = uchar_wrapper(s->ptr);
463 limit = uchar_wrapper(s->lim);
464
465 if (s->detect_pp_numbers) {
466 /*!re2c
467 "."? Digit (Digit | NonDigit | ExponentStart | ".")*
468 { BOOST_WAVE_RET(T_PP_NUMBER); }
469
470 // because we reached this point, then reset the cursor,
471 // the pattern above should always match
472 * { BOOST_ASSERT(false); }
473 */
474 }
475 else {
476 /*!re2c
477 ((FractionalConstant ExponentPart?) | (Digit+ ExponentPart)) FloatingSuffix?
478 { BOOST_WAVE_RET(T_FLOATLIT); }
479
480 Integer { goto integer_suffix; }
481
482 // one of the above patterns should always match
483 * { BOOST_ASSERT(false); }
484 */
485 }
486 }
487
488 /* this subscanner is called, whenever an Integer was recognized */
489 integer_suffix:
490 {
491 if (s->enable_ms_extensions) {
492 /*!re2c
493 LongIntegerSuffix | MSLongIntegerSuffix
494 { BOOST_WAVE_RET(T_LONGINTLIT); }
495
496 IntegerSuffix?
497 { BOOST_WAVE_RET(T_INTLIT); }
498 */
499 }
500 else {
501 /*!re2c
502 LongIntegerSuffix
503 { BOOST_WAVE_RET(T_LONGINTLIT); }
504
505 IntegerSuffix?
506 { BOOST_WAVE_RET(T_INTLIT); }
507 */
508 }
509
510 // re2c will complain about -Wmatch-empty-string above
511 // it's OK because we've already matched an integer
512 // and will return T_INTLIT
513 }
514
515 /* this subscanner is invoked for C++0x extended character literals */
516 extcharlit:
517 {
518 /*!re2c
519 * {
520 (*s->error_proc)(s, lexing_exception::generic_lexing_error,
521 "Invalid character in raw string delimiter ('%c')", yych);
522 }
523
524 ((EscapeSequence | UniversalChar | any\[\n\r\\']) ['])
525 { BOOST_WAVE_RET(T_CHARLIT); }
526
527 any
528 { BOOST_WAVE_RET(TOKEN_FROM_ID(*s->tok, UnknownTokenType)); }
529 */
530 }
531
532 /* this subscanner is invoked for C++0x extended character string literals */
533 extstringlit:
534 {
535 /*!re2c
536 * {
537 (*s->error_proc)(s, lexing_exception::generic_lexing_error,
538 "Invalid character in raw string delimiter ('%c')", yych);
539 }
540
541 ((EscapeSequence | UniversalChar | any\[\n\r\\"])* ["])
542 { BOOST_WAVE_RET(T_STRINGLIT); }
543
544 any
545 { BOOST_WAVE_RET(TOKEN_FROM_ID(*s->tok, UnknownTokenType)); }
546 */
547 }
548
549 extrawstringlit:
550 {
551 // we have consumed the double quote but not the lparen
552 // at this point we may see a delimiter
553
554 /*!re2c
555 * {
556 (*s->error_proc)(s, lexing_exception::generic_lexing_error,
557 "Invalid character in raw string delimiter ('%c')", yych);
558 }
559
560 // delimiters are any character but parentheses, backslash, and whitespace
561 any\[()\\\t\v\f\r\n]
562 {
563 rawstringdelim += yych;
564 if (rawstringdelim.size() > 16)
565 {
566 (*s->error_proc)(s, lexing_exception::generic_lexing_error,
567 "Raw string delimiter of excessive length (\"%s\") in input stream",
568 rawstringdelim.c_str());
569 }
570 goto extrawstringlit;
571 }
572
573 "("
574 {
575 rawstringdelim = ")" + rawstringdelim;
576 goto extrawstringbody;
577 }
578
579 */
580 }
581
582 extrawstringbody:
583 {
584 /*!re2c
585
586 * {
587 (*s->error_proc)(s, lexing_exception::generic_lexing_error,
588 "Invalid character in raw string body ('%c')", yych);
589 }
590
591 Newline
592 {
593 s->line += count_backslash_newlines(s, cursor) +1;
594 cursor.column = 1;
595 goto extrawstringbody;
596 }
597
598 (EscapeSequence | UniversalChar | any\["])
599 {
600 goto extrawstringbody;
601 }
602
603 ["]
604 {
605 // check to see if we have completed a delimiter
606 if (string_type((char *)(YYCURSOR - rawstringdelim.size() - 1),
607 (char *)(YYCURSOR - 1)) == rawstringdelim)
608 {
609 BOOST_WAVE_RET(T_RAWSTRINGLIT);
610 } else {
611 goto extrawstringbody;
612 }
613 }
614 */
615 }