skip start of block before looking for its end

This commit is contained in:
Zachary Snow 2023-03-07 23:52:43 -05:00
parent 4ce177c074
commit eca8714de7
4 changed files with 17 additions and 1 deletions

View File

@ -8,6 +8,9 @@
static prefixes, which could cause deep recursion and run out of memory on
some designs
* Fixed unneeded scoping of constant function calls used in type lookups
* `/*/` is no longer interpreted as a self-closing block comment, e.g.,
`$display("a"/*/,"b"/* */);` previously printed "ab", but now prints "a"
### New Features

View File

@ -545,7 +545,10 @@ preprocessInput = do
macroStack <- getMacroStack
case str of
'/' : '/' : _ -> removeThrough "\n"
'/' : '*' : _ -> removeThrough "*/"
'/' : '*' : _ ->
-- prevent treating `/*/` as self-closing
takeChar >> takeChar >>
removeThrough "*/"
'`' : '"' : _ -> handleBacktickString
'"' : _ -> handleString
'/' : '`' : '`' : '*' : _ ->

View File

@ -0,0 +1,7 @@
module top;
/*test*/
/*/test*/
/*test/*/
/*/test/*/
initial $display("foo"/*/,"bar"/*/);
endmodule

3
test/lex/block_comment.v Normal file
View File

@ -0,0 +1,3 @@
module top;
initial $display("foo");
endmodule