fix double backtick handling in backtick string

This commit is contained in:
Zachary Snow 2020-12-04 13:22:38 -07:00
parent bf6ba338df
commit 1fd72d878f
3 changed files with 20 additions and 0 deletions

View File

@ -630,6 +630,10 @@ handleBacktickString = do
if null macroStack
then lexicalError "`\\`\" is not allowed outside of macros"
else loop
'`' : '`' : _ -> do
'`' <- takeChar
'`' <- takeChar
loop
'`' : _ -> do
handleDirective True
loop

15
test/lex/macro_string.sv Normal file
View File

@ -0,0 +1,15 @@
`define PRINT(str, num) $display(`"StrIs``str NumIs``num`");
module top;
initial begin
`PRINT(FOO, 0)
`PRINT(BAR, 1)
`PRINT(BAZ, 2)
`PRINT(A, 1)
`PRINT(B, 2)
`PRINT(C, 3)
end
endmodule

1
test/lex/macro_string.v Normal file
View File

@ -0,0 +1 @@
`include "macro_string.sv"