alive parser: fix parsing conflict for vector types
MODIFY
tools/alive_lexer.re
tools/alive_lexer.re
@@ -75,6 +75,7 @@ restart:
YYTEXT = YYCURSOR;
/*!re2c
+space = [ \t];
re2c:yyfill:check = 0;
"\r"? "\n" {
@@ -82,7 +83,7 @@ re2c:yyfill:check = 0;
YYRESTART();
}
-[ \t]+ {
+space+ {
YYRESTART();
}
@@ -104,8 +105,8 @@ re2c:yyfill:check = 0;
return INT_TYPE;
}
-"<" [1-9][0-9]* {
- yylval.num = strtoull((char*)YYTEXT+1, nullptr, 10);
+"<" space* @tag1 [1-9][0-9]* space* "x" {
+ yylval.num = strtoull((char*)tag1, nullptr, 10);
return VECTOR_TYPE_PREFIX;
}

MODIFY
tools/alive_parser.cpp
tools/alive_parser.cpp
@@ -330,10 +330,6 @@ static Type& parse_vector_type() {
tokenizer.ensure(VECTOR_TYPE_PREFIX);
unsigned elements = yylval.num;
- auto t = *tokenizer;
- if (t != IDENTIFIER || yylval.str != "x")
- error ("Expect x");
-
Type &elemTy = parse_scalar_type();
tokenizer.ensure(CSGT);

alive parser: fix parsing conflict for vector types