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