Fix single line comment
This commit is contained in:
parent
47a0d4f579
commit
74d637f511
@ -12,8 +12,12 @@ pub(crate) fn comment(s: Span) -> IResult<Span, Comment> {
|
||||
#[packrat_parser]
|
||||
pub(crate) fn one_line_comment(s: Span) -> IResult<Span, Comment> {
|
||||
let (s, a) = tag("//")(s)?;
|
||||
let (s, b) = is_not("\n")(s)?;
|
||||
let a = concat(a, b).unwrap();
|
||||
let (s, b) = opt(is_not("\n"))(s)?;
|
||||
let a = if let Some(b) = b {
|
||||
concat(a, b).unwrap()
|
||||
} else {
|
||||
a
|
||||
};
|
||||
Ok((
|
||||
s,
|
||||
Comment {
|
||||
|
@ -283,6 +283,7 @@ mod unit {
|
||||
#[test]
|
||||
fn test_comment() {
|
||||
test!(comment, "// comment", Ok((_, _)));
|
||||
test!(comment, "//", Ok((_, _)));
|
||||
test!(comment, "/* comment\n\n */", Ok((_, _)));
|
||||
}
|
||||
|
||||
@ -15705,12 +15706,8 @@ mod spec {
|
||||
fn debug() {
|
||||
test!(
|
||||
source_text,
|
||||
r##"`pragma protect encoding=(enctype="raw")
|
||||
`pragma protect data_method="x-caesar", data_keyname="rot13", begin
|
||||
`pragma protect
|
||||
runtime_license=(library="lic.so",feature="runSecret",entry="chk", match=42)
|
||||
`pragma protect end
|
||||
"##,
|
||||
r##"//aaa
|
||||
//bbb"##,
|
||||
Ok((_, _))
|
||||
);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user