Fix missing comment after macro name #29
This commit is contained in:
parent
9b84ee7044
commit
9360cda58f
@ -2,6 +2,8 @@
|
||||
|
||||
## [Unreleased](https://github.com/dalance/sv-parser/compare/v0.10.4...Unreleased) - ReleaseDate
|
||||
|
||||
* [Fixed] missing comment after macro name [#29](https://github.com/dalance/sv-parser/issues/29)
|
||||
|
||||
## [v0.10.4](https://github.com/dalance/sv-parser/compare/v0.10.3...v0.10.4) - 2021-01-08
|
||||
|
||||
* [Fixed] uncleared internal state
|
||||
|
@ -309,14 +309,9 @@ where
|
||||
#[packrat_parser]
|
||||
pub(crate) fn white_space(s: Span) -> IResult<Span, WhiteSpace> {
|
||||
if in_directive() {
|
||||
alt((
|
||||
map(multispace1, |x: Span| {
|
||||
WhiteSpace::Space(Box::new(into_locate(x)))
|
||||
}),
|
||||
map(preceded(peek(char('/')), comment), |x| {
|
||||
WhiteSpace::Comment(Box::new(x))
|
||||
}),
|
||||
))(s)
|
||||
})(s)
|
||||
} else {
|
||||
alt((
|
||||
map(multispace1, |x: Span| {
|
||||
|
@ -1190,6 +1190,27 @@ module test();
|
||||
|
||||
initial begin
|
||||
end endmodule
|
||||
"##
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test18() {
|
||||
let (ret, _) = preprocess(
|
||||
get_testcase("test18.sv"),
|
||||
&HashMap::new(),
|
||||
&[] as &[String],
|
||||
false,
|
||||
false,
|
||||
)
|
||||
.unwrap();
|
||||
assert_eq!(
|
||||
ret.text(),
|
||||
r##"// pragma translate_off
|
||||
module A;
|
||||
endmodule
|
||||
// pragma translate_on
|
||||
|
||||
"##
|
||||
);
|
||||
}
|
||||
|
6
sv-parser-pp/testcases/test18.sv
Normal file
6
sv-parser-pp/testcases/test18.sv
Normal file
@ -0,0 +1,6 @@
|
||||
`ifndef X
|
||||
// pragma translate_off
|
||||
module A;
|
||||
endmodule
|
||||
// pragma translate_on
|
||||
`endif
|
Loading…
x
Reference in New Issue
Block a user