mirror of
https://github.com/YosysHQ/yosys
synced 2025-06-21 05:13:40 +00:00
verilog: fix string literal regular expression (#5187)
* verilog: fix string literal regular expression. A backslash was improperly quoted, causing string literal matching to fail when the final token before a closing quote was an escaped backslash. * verilog: add regression test for string literal regex bug. Test for bug triggered by escaped backslash immediately before closing quote (introduced inca7d94af
and fixed by40aa7eaf
).
This commit is contained in:
parent
cd71f190cd
commit
834a7294b7
2 changed files with 6 additions and 1 deletions
|
@ -336,7 +336,7 @@ TIME_SCALE_SUFFIX [munpf]?s
|
||||||
}
|
}
|
||||||
|
|
||||||
\" { BEGIN(STRING); }
|
\" { BEGIN(STRING); }
|
||||||
<STRING>([^\"]|\\.)+ { yymore(); real_location = old_location; }
|
<STRING>([^\\"]|\\.)+ { yymore(); real_location = old_location; }
|
||||||
<STRING>\" {
|
<STRING>\" {
|
||||||
BEGIN(0);
|
BEGIN(0);
|
||||||
char *yystr = strdup(yytext);
|
char *yystr = strdup(yytext);
|
||||||
|
|
5
tests/verilog/bug5160.v
Normal file
5
tests/verilog/bug5160.v
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
// Regression test for bug mentioned in #5160:
|
||||||
|
// https://github.com/YosysHQ/yosys/pull/5160#issuecomment-2983643084
|
||||||
|
module top;
|
||||||
|
initial $display( "\\" );
|
||||||
|
endmodule
|
Loading…
Add table
Add a link
Reference in a new issue