lex: allow more/zero spaces in 'Name:'
MODIFY
CMakeLists.txt
CMakeLists.txt
@@ -38,7 +38,7 @@ find_program(RE2C re2c)
message(STATUS "RE2C: ${RE2C}")
add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/tools/alive_lexer.cpp"
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_BINARY_DIR}/tools"
- COMMAND ${RE2C} ARGS "-d" "-b" "--no-generation-date"
+ COMMAND ${RE2C} ARGS "-d" "-b" "-T" "--no-generation-date"
"-o" "${CMAKE_BINARY_DIR}/tools/alive_lexer.cpp"
"${PROJECT_SOURCE_DIR}/tools/alive_lexer.re"
DEPENDS "tools/alive_lexer.re")

MODIFY
tools/alive_lexer.re
tools/alive_lexer.re
@@ -22,6 +22,7 @@ static const YYCTYPE *YYCURSOR;
static const YYCTYPE *YYLIMIT;
static const YYCTYPE *YYTEXT;
static const YYCTYPE *YYMARKER;
+static const YYCTYPE *tag1, *yyt1;
#if 0
# define YYRESTART() cout << "restart line: " << yylineno << '\n'; goto restart
@@ -83,8 +84,8 @@ re2c:yyfill:check = 0;
YYRESTART();
}
-"Name: " [^\r\n]+ {
- COPY_STR(sizeof("Name: ")-1);
+"Name:" [ \t]* @tag1 [^\r\n]+ {
+ COPY_STR(tag1 - YYTEXT);
return NAME;
}

lex: allow more/zero spaces in 'Name:'