mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 22:34:45 +00:00
fix comment newline chomping issue
This commit is contained in:
parent
5e4db62c46
commit
c938a93dea
1 changed files with 12 additions and 4 deletions
|
@ -193,11 +193,18 @@ pub fn spaces_till_end_of_line<'a, E: 'a>(
|
|||
b'#' => match chomp_line_comment(bytes) {
|
||||
Ok(comment) => {
|
||||
state.line += 1;
|
||||
state.column = 0;
|
||||
|
||||
state.column += col + comment.len() as u16;
|
||||
state.bytes = &bytes[comment.len()..];
|
||||
let width = 1 + comment.len();
|
||||
if let Some(b'\n') = bytes.get(width) {
|
||||
state.bytes = &bytes[width + 1..];
|
||||
} else {
|
||||
state.bytes = &bytes[width..];
|
||||
}
|
||||
state.is_indenting = true;
|
||||
|
||||
dbg!(comment, &state);
|
||||
|
||||
return Ok((MadeProgress, Some(comment), state));
|
||||
}
|
||||
Err(_) => unreachable!("we check the first character is a #"),
|
||||
|
@ -214,6 +221,7 @@ pub fn spaces_till_end_of_line<'a, E: 'a>(
|
|||
None,
|
||||
State {
|
||||
column: col,
|
||||
bytes,
|
||||
..state
|
||||
},
|
||||
))
|
||||
|
@ -275,8 +283,8 @@ where
|
|||
debug_assert!(u16::MAX - state.indent_col >= spaces as u16);
|
||||
debug_assert!(spaces <= u16::MAX as usize);
|
||||
|
||||
// state.indent_col + spaces as u16
|
||||
state.indent_col
|
||||
state.indent_col + spaces as u16
|
||||
// state.indent_col
|
||||
} else {
|
||||
state.indent_col
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue