Commit 104f9801 by Zachary Snow

support for string literals with macros

- adds support for using macros and macro arguments within the argument
  list to other macros
- fixes an issue where macros with arguments would have extraneous
  whitespace
- fixes handling of multiline string literals
parent 8f4e783f
`define FOO BAR
`define BAR(e) prefix``e
`define BAZ `"FOO`\`"`FOO`"
module top;
initial begin
$display("FOO");
$display("`FOO");
$display(`"`FOO`");
$display(`"\`FOO`");
$display(`"\\`FOO`");
$display(`"\\\`FOO`");
$display(`"\"FOO`");
$display(`"\"`FOO`");
$display(`"\"FOO\"`");
$display(`"\"`FOO\"`");
$display(`"FOO`");
$display(`"FOO`FOO`");
$display(`"`BAR(LOL)`");
$display(`"\`BAR(LOL)`");
$display(`"\\`BAR(LOL)`");
$display(`"\\\`BAR(LOL)`");
$display(`"`BAR(`FOO)`");
$display(`"\`BAR(`FOO)`");
$display(`"\\`BAR(`FOO)`");
$display(`"\\\`BAR(`FOO)`");
$display(`"`BAR(s`FOO)`");
$display(`"\`BAR(s`FOO)`");
$display(`"\\`BAR(s`FOO)`");
$display(`"\\\`BAR(s`FOO)`");
$display(`BAZ);
`ifdef DNE
$display(`DNE);
$display(`"`DNE`");
`define
`line
`foo
`endif
$display("TEST END");
$display("TEST\
END");
$display(`"TEST\
END`");
$display(`"TEST\`FOO\
END`");
$display(`"TEST\"`FOO\
END`");
$display(`"TEST\"`FOO\
END`FOO`");
end
endmodule
module top;
initial begin
$display("FOO");
$display("`FOO");
$display("BAR");
$display("`FOO");
$display("\\BAR");
$display("\\`FOO");
$display("\"FOO");
$display("\"BAR");
$display("\"FOO\"");
$display("\"BAR\"");
$display("FOO");
$display("FOOBAR");
$display("prefixLOL");
$display("`BAR(LOL)");
$display("\\prefixLOL");
$display("\\`BAR(LOL)");
$display("prefixBAR");
$display("`BAR(BAR)");
$display("\\prefixBAR");
$display("\\`BAR(BAR)");
$display("prefixsBAR");
$display("`BAR(sBAR)");
$display("\\prefixsBAR");
$display("\\`BAR(sBAR)");
$display("FOO\"BAR");
$display("TEST END");
$display("TEST END");
$display("TEST END");
$display("TEST`FOO END");
$display("TEST\"BAR END");
$display("TEST\"BAR ENDBAR");
end
endmodule
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment