strict_cpp.re
来自「Boost provides free peer-reviewed portab」· RE 代码 · 共 438 行 · 第 1/2 页
RE
438 行
"||" { BOOST_WAVE_RET(T_OROR); }
"??!|" { BOOST_WAVE_RET(T_OROR_TRIGRAPH); }
"|??!" { BOOST_WAVE_RET(T_OROR_TRIGRAPH); }
"or" { BOOST_WAVE_RET(s->act_in_c99_mode ? T_IDENTIFIER : T_OROR_ALT); }
"??!??!" { BOOST_WAVE_RET(T_OROR_TRIGRAPH); }
"++" { BOOST_WAVE_RET(T_PLUSPLUS); }
"--" { BOOST_WAVE_RET(T_MINUSMINUS); }
"," { BOOST_WAVE_RET(T_COMMA); }
"->*"
{
if (s->act_in_c99_mode) {
--YYCURSOR;
BOOST_WAVE_RET(T_ARROW);
}
else {
BOOST_WAVE_RET(T_ARROWSTAR);
}
}
"->" { BOOST_WAVE_RET(T_ARROW); }
"??/" { BOOST_WAVE_RET(T_ANY_TRIGRAPH); }
([a-zA-Z_] | UniversalChar) ([a-zA-Z_0-9] | UniversalChar)*
{ BOOST_WAVE_RET(T_IDENTIFIER); }
"L"? (['] (EscapeSequence|any\[\n\r\\']|UniversalChar)+ ['])
{ BOOST_WAVE_RET(T_CHARLIT); }
"L"? (["] (EscapeSequence|any\[\n\r\\"]|UniversalChar)* ["])
{ BOOST_WAVE_RET(T_STRINGLIT); }
Pound PPSpace ( "include" | "include_next") PPSpace "<" (any\[\n\r>])+ ">"
{ BOOST_WAVE_RET(T_PP_HHEADER); }
Pound PPSpace ( "include" | "include_next") PPSpace "\"" (any\[\n\r"])+ "\""
{ BOOST_WAVE_RET(T_PP_QHEADER); }
Pound PPSpace ( "include" | "include_next") PPSpace
{ BOOST_WAVE_RET(T_PP_INCLUDE); }
Pound PPSpace "if" { BOOST_WAVE_RET(T_PP_IF); }
Pound PPSpace "ifdef" { BOOST_WAVE_RET(T_PP_IFDEF); }
Pound PPSpace "ifndef" { BOOST_WAVE_RET(T_PP_IFNDEF); }
Pound PPSpace "else" { BOOST_WAVE_RET(T_PP_ELSE); }
Pound PPSpace "elif" { BOOST_WAVE_RET(T_PP_ELIF); }
Pound PPSpace "endif" { BOOST_WAVE_RET(T_PP_ENDIF); }
Pound PPSpace "define" { BOOST_WAVE_RET(T_PP_DEFINE); }
Pound PPSpace "undef" { BOOST_WAVE_RET(T_PP_UNDEF); }
Pound PPSpace "line" { BOOST_WAVE_RET(T_PP_LINE); }
Pound PPSpace "error" { BOOST_WAVE_RET(T_PP_ERROR); }
Pound PPSpace "pragma" { BOOST_WAVE_RET(T_PP_PRAGMA); }
Pound PPSpace "warning" { BOOST_WAVE_RET(T_PP_WARNING); }
Pound PPSpace "region" { BOOST_WAVE_RET(T_MSEXT_PP_REGION); }
Pound PPSpace "endregion" { BOOST_WAVE_RET(T_MSEXT_PP_ENDREGION); }
[ \t\v\f]+
{ BOOST_WAVE_RET(T_SPACE); }
Newline
{
s->line++;
cursor.column = 1;
BOOST_WAVE_RET(T_NEWLINE);
}
"\000"
{
if (s->eof && cursor != s->eof)
{
BOOST_WAVE_UPDATE_CURSOR(); // adjust the input cursor
(*s->error_proc)(s, lexing_exception::generic_lexing_error,
"invalid character '\\000' in input stream");
}
BOOST_WAVE_RET(T_EOF);
}
any { BOOST_WAVE_RET(TOKEN_FROM_ID(*s->tok, UnknownTokenType)); }
anyctrl
{
// flag the error
BOOST_WAVE_UPDATE_CURSOR(); // adjust the input cursor
(*s->error_proc)(s, lexing_exception::generic_lexing_error,
"invalid character '\\%03o' in input stream", *--YYCURSOR);
}
*/
ccomment:
/*!re2c
"*/" { BOOST_WAVE_RET(T_CCOMMENT); }
Newline
{
/*if(cursor == s->eof) BOOST_WAVE_RET(T_EOF);*/
/*s->tok = cursor; */
s->line += count_backslash_newlines(s, cursor) +1;
cursor.column = 1;
goto ccomment;
}
any { goto ccomment; }
"\000"
{
if(cursor == s->eof)
{
BOOST_WAVE_UPDATE_CURSOR(); // adjust the input cursor
(*s->error_proc)(s, lexing_exception::generic_lexing_warning,
"unterminated 'C' style comment");
}
else
{
--YYCURSOR; // next call returns T_EOF
BOOST_WAVE_UPDATE_CURSOR(); // adjust the input cursor
(*s->error_proc)(s, lexing_exception::generic_lexing_error,
"invalid character: '\\000' in input stream");
}
}
anyctrl
{
// flag the error
BOOST_WAVE_UPDATE_CURSOR(); // adjust the input cursor
(*s->error_proc)(s, lexing_exception::generic_lexing_error,
"invalid character '\\%03o' in input stream", *--YYCURSOR);
}
*/
cppcomment:
/*!re2c
Newline
{
/*if(cursor == s->eof) BOOST_WAVE_RET(T_EOF); */
/*s->tok = cursor; */
s->line++;
cursor.column = 1;
BOOST_WAVE_RET(T_CPPCOMMENT);
}
any { goto cppcomment; }
"\000"
{
if (s->eof && cursor != s->eof)
{
--YYCURSOR; // next call returns T_EOF
BOOST_WAVE_UPDATE_CURSOR(); // adjust the input cursor
(*s->error_proc)(s, lexing_exception::generic_lexing_error,
"invalid character '\\000' in input stream");
}
--YYCURSOR; // next call returns T_EOF
if (!s->single_line_only)
{
BOOST_WAVE_UPDATE_CURSOR(); // adjust the input cursor
(*s->error_proc)(s, lexing_exception::generic_lexing_warning,
"Unterminated 'C++' style comment");
}
BOOST_WAVE_RET(T_CPPCOMMENT);
}
anyctrl
{
// flag the error
BOOST_WAVE_UPDATE_CURSOR(); // adjust the input cursor
(*s->error_proc)(s, lexing_exception::generic_lexing_error,
"invalid character '\\%03o' in input stream", *--YYCURSOR);
}
*/
/* this subscanner is called whenever a pp_number has been started */
pp_number:
{
cursor = uchar_wrapper(s->tok = s->cur, s->column = s->curr_column);
marker = uchar_wrapper(s->ptr);
limit = uchar_wrapper(s->lim);
if (s->detect_pp_numbers) {
/*!re2c
"."? Digit (Digit | NonDigit | ExponentStart | ".")*
{ BOOST_WAVE_RET(T_PP_NUMBER); }
*/
}
else {
/*!re2c
((FractionalConstant ExponentPart?) | (Digit+ ExponentPart)) FloatingSuffix?
{ BOOST_WAVE_RET(T_FLOATLIT); }
Integer { goto integer_suffix; }
*/
}
}
/* this subscanner is called, whenever a Integer was recognized */
integer_suffix:
{
if (s->enable_ms_extensions) {
/*!re2c
LongIntegerSuffix | "i64"
{ BOOST_WAVE_RET(T_LONGINTLIT); }
IntegerSuffix?
{ BOOST_WAVE_RET(T_INTLIT); }
*/
}
else {
/*!re2c
LongIntegerSuffix
{ BOOST_WAVE_RET(T_LONGINTLIT); }
IntegerSuffix?
{ BOOST_WAVE_RET(T_INTLIT); }
*/
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?