Comments can also be //
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
parent
4fdc467cf2
commit
692cb204ac
1 changed files with 4 additions and 1 deletions
|
@ -51,7 +51,7 @@ fn allspaces(i: &str) -> IResult<&str, &str> {
|
|||
}
|
||||
|
||||
fn comment(i: &str) -> IResult<&str, &str> {
|
||||
let (i, _) = delimited(tag("#"), take_until("\n"), tag("\n"))(i)?;
|
||||
let (i, _) = delimited(alt((tag("#"), tag("//"))), take_until("\n"), tag("\n"))(i)?;
|
||||
Ok((i, ""))
|
||||
}
|
||||
|
||||
|
@ -226,6 +226,9 @@ mod tests {
|
|||
Err(_) => (),
|
||||
err => panic!("Unexpected result: {:?}", err),
|
||||
}
|
||||
|
||||
let buf4 = "// Foo\n";
|
||||
assert_eq!(comment(buf4), Ok(("", "")));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
Loading…
Reference in a new issue