Fix comment lexing at end of file
If a line comment ends at the end of the file, ensure the rest of the
file is included.
@@ -905,11 +905,18 @@ impl<'input> Lexer<'input> {
let mut last = start + 3;
if !newline {
- for (i, ch) in &mut self.chars {
- last = i;
- if ch == '\n' || ch == '\r' {
+ loop {
+ match self.chars.next() {
+ None => {
+ last = self.input.len();
+ break;
+ }
+ Some((offset, '\n' | '\r')) => {
+ last = offset;
break;
}
+ Some(_) => (),
+ }
}
}
