mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-02 08:11:12 +00:00
Fix doc parsing bug
This commit is contained in:
parent
715b13263c
commit
1d6d9ec994
1 changed files with 18 additions and 14 deletions
|
@ -285,22 +285,26 @@ fn spaces<'a>(
|
||||||
// If we're in a line comment, this won't affect indentation anyway.
|
// If we're in a line comment, this won't affect indentation anyway.
|
||||||
state = state.advance_without_indenting(1)?;
|
state = state.advance_without_indenting(1)?;
|
||||||
|
|
||||||
match comment_line_buf.chars().next() {
|
if comment_line_buf.len() == 1 {
|
||||||
Some('#') => {
|
match comment_line_buf.chars().next() {
|
||||||
// This is a comment begining with `## ` - that is,
|
Some('#') => {
|
||||||
// a doc comment.
|
// This is a comment begining with `## ` - that is,
|
||||||
//
|
// a doc comment.
|
||||||
// (The space is important; otherwise, this is not
|
//
|
||||||
// a doc comment, but rather something like a
|
// (The space is important; otherwise, this is not
|
||||||
// big separator block, e.g. ############)
|
// a doc comment, but rather something like a
|
||||||
line_state = LineState::DocComment;
|
// big separator block, e.g. ############)
|
||||||
|
line_state = LineState::DocComment;
|
||||||
|
|
||||||
// This is now the beginning of the doc comment.
|
// This is now the beginning of the doc comment.
|
||||||
comment_line_buf.clear();
|
comment_line_buf.clear();
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
comment_line_buf.push(ch);
|
comment_line_buf.push(ch);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
comment_line_buf.push(ch);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
'\n' => {
|
'\n' => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue