3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-06-18 20:03:39 +00:00

verilog: improve string literal matching speed (fixes #5076)

Use a greedy regular expression to match input inside a string
literal, so that flex can accumulate a longer match instead of
invoking a rule for each individual character.
This commit is contained in:
Gary Wong 2025-05-31 22:38:44 -06:00
parent 86282027c0
commit ca7d94af99

View file

@ -336,7 +336,7 @@ TIME_SCALE_SUFFIX [munpf]?s
}
\" { BEGIN(STRING); }
<STRING>\\. { yymore(); real_location = old_location; }
<STRING>([^\"]|\\.)+ { yymore(); real_location = old_location; }
<STRING>\" {
BEGIN(0);
char *yystr = strdup(yytext);
@ -376,7 +376,6 @@ TIME_SCALE_SUFFIX [munpf]?s
free(yystr);
return TOK_STRING;
}
<STRING>. { yymore(); real_location = old_location; }
and|nand|or|nor|xor|xnor|not|buf|bufif0|bufif1|notif0|notif1 {
yylval->string = new std::string(yytext);