mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-29 23:04:49 +00:00
Track line start separately
This commit is contained in:
parent
5ac3394a73
commit
422cdea112
2 changed files with 17 additions and 3 deletions
|
@ -265,13 +265,13 @@ fn eat_spaces<'a>(
|
|||
xyzlcol.column += 1;
|
||||
}
|
||||
b'\n' => {
|
||||
state = state.advance(1);
|
||||
state = state.advance_newline();
|
||||
multiline = true;
|
||||
xyzlcol.column = 0;
|
||||
comments_and_newlines.push(CommentOrNewline::Newline);
|
||||
}
|
||||
b'\r' => {
|
||||
state = state.advance(1);
|
||||
state = state.advance_newline();
|
||||
}
|
||||
b'\t' => {
|
||||
return HasTab(xyzlcol, state);
|
||||
|
@ -353,11 +353,15 @@ fn eat_line_comment<'a>(
|
|||
} else {
|
||||
comments_and_newlines.push(CommentOrNewline::LineComment(comment));
|
||||
}
|
||||
state = state.advance(1);
|
||||
state = state.advance_newline();
|
||||
multiline = true;
|
||||
xyzlcol.column = 0;
|
||||
return eat_spaces(state, multiline, xyzlcol, comments_and_newlines);
|
||||
}
|
||||
b'\r' => {
|
||||
state = state.advance_newline();
|
||||
xyzlcol.column += 1;
|
||||
}
|
||||
_ => {
|
||||
state = state.advance(1);
|
||||
xyzlcol.column += 1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue