Fix off-by-one position error after comment line.

This commit is contained in:
Stephen Chung
2022-01-24 16:06:41 +08:00
parent 2b2685e387
commit d8a6b93f43
2 changed files with 8 additions and 2 deletions

View File

@@ -1592,11 +1592,11 @@ fn get_next_token_inner(
// `\r - start from next line
Some('\r') => {
eat_next(stream, pos);
pos.new_line();
// `\r\n
if let Some('\n') = stream.peek_next() {
eat_next(stream, pos);
}
pos.new_line();
}
// `\n - start from next line
Some('\n') => {
@@ -1762,11 +1762,11 @@ fn get_next_token_inner(
while let Some(c) = stream.get_next() {
if c == '\r' {
pos.new_line();
// \r\n
if let Some('\n') = stream.peek_next() {
eat_next(stream, pos);
}
pos.new_line();
break;
}
if c == '\n' {