Fix multiline comment
This commit is contained in:
parent
5bc22d62a8
commit
cd7e668d13
@ -30,9 +30,12 @@ pub(crate) fn one_line_comment(s: Span) -> IResult<Span, Comment> {
|
|||||||
#[packrat_parser]
|
#[packrat_parser]
|
||||||
pub(crate) fn block_comment(s: Span) -> IResult<Span, Comment> {
|
pub(crate) fn block_comment(s: Span) -> IResult<Span, Comment> {
|
||||||
let (s, a) = tag("/*")(s)?;
|
let (s, a) = tag("/*")(s)?;
|
||||||
let (s, b) = is_not("*/")(s)?;
|
let (s, b) = many0(alt((is_not("*"), terminated(tag("*"), is_not("/")))))(s)?;
|
||||||
let (s, c) = tag("*/")(s)?;
|
let (s, c) = tag("*/")(s)?;
|
||||||
let a = concat(a, b).unwrap();
|
let mut a = a;
|
||||||
|
for b in b {
|
||||||
|
a = concat(a, b).unwrap();
|
||||||
|
}
|
||||||
let a = concat(a, c).unwrap();
|
let a = concat(a, c).unwrap();
|
||||||
Ok((
|
Ok((
|
||||||
s,
|
s,
|
||||||
|
@ -285,6 +285,7 @@ mod unit {
|
|||||||
test!(comment, "// comment", Ok((_, _)));
|
test!(comment, "// comment", Ok((_, _)));
|
||||||
test!(comment, "//", Ok((_, _)));
|
test!(comment, "//", Ok((_, _)));
|
||||||
test!(comment, "/* comment\n\n */", Ok((_, _)));
|
test!(comment, "/* comment\n\n */", Ok((_, _)));
|
||||||
|
test!(comment, "/* comment\n//aaa\n */", Ok((_, _)));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -15786,10 +15787,6 @@ mod spec {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn debug() {
|
fn debug() {
|
||||||
test!(
|
test!(source_text, r##"/* comment\n//aaa\n */"##, Ok((_, _)));
|
||||||
source_text,
|
|
||||||
r##"module secret (a, b); `pragma protect encoding=(enctype="raw") `pragma protect data_method="x-caesar", data_keyname="rot13", begin endmodule"##,
|
|
||||||
Ok((_, _))
|
|
||||||
);
|
|
||||||
nom_tracable::cumulative_histogram();
|
nom_tracable::cumulative_histogram();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user