diff --git a/src/Language/SystemVerilog/Parser/Preprocess.hs b/src/Language/SystemVerilog/Parser/Preprocess.hs index 66c7236..0dc8276 100644 --- a/src/Language/SystemVerilog/Parser/Preprocess.hs +++ b/src/Language/SystemVerilog/Parser/Preprocess.hs @@ -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 diff --git a/test/lex/macro_string.sv b/test/lex/macro_string.sv new file mode 100644 index 0000000..ff44567 --- /dev/null +++ b/test/lex/macro_string.sv @@ -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 diff --git a/test/lex/macro_string.v b/test/lex/macro_string.v new file mode 100644 index 0000000..74d56f0 --- /dev/null +++ b/test/lex/macro_string.v @@ -0,0 +1 @@ +`include "macro_string.sv"