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