Require space after hash in comment if comment line is not empty.
This commit is contained in:
parent
6e4aa38fce
commit
50d05b99be
@ -3,6 +3,7 @@ use nom::bytes::complete::is_not;
|
||||
use nom::bytes::complete::tag;
|
||||
use nom::character::complete::line_ending;
|
||||
use nom::character::complete::space0;
|
||||
use nom::character::complete::space1;
|
||||
use nom::combinator::eof;
|
||||
use nom::combinator::not;
|
||||
use nom::combinator::opt;
|
||||
@ -38,8 +39,8 @@ pub fn comment<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<&'s str,
|
||||
fn comment_line<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<&'s str, &'s str> {
|
||||
start_of_line(context, input)?;
|
||||
let (remaining, _indent) = space0(input)?;
|
||||
let (remaining, (_hash, _leading_whitespace, _content, _line_ending)) =
|
||||
tuple((tag("#"), space0, opt(is_not("\r\n")), alt((line_ending, eof))))(remaining)?;
|
||||
let (remaining, (_hash, _leading_whitespace_and_content, _line_ending)) =
|
||||
tuple((tag("#"), opt(tuple((space1, is_not("\r\n")))), alt((line_ending, eof))))(remaining)?;
|
||||
let source = get_consumed(input, remaining);
|
||||
Ok((remaining, source))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user