diff --git a/src/parser/comment.rs b/src/parser/comment.rs index f304ac8..34c2ee0 100644 --- a/src/parser/comment.rs +++ b/src/parser/comment.rs @@ -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)) }