Skip to content

Commit

Permalink
Fixed crasher in scanner for single line comments at the end of the f…
Browse files Browse the repository at this point in the history
…ile.
  • Loading branch information
cogiton committed May 11, 2024
1 parent a9b3dad commit c88e8d6
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions framec/src/frame_c/scanner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -509,12 +509,10 @@ impl Scanner {

// TODO: handle EOF w/ error
fn single_line_comment(&mut self) {
if !self.is_at_end() {
while self.peek() != '\n' {
self.advance();
}
self.add_token(TokenType::SingleLineComment);
while !self.is_at_end() && self.peek() != '\n' {
self.advance();
}
self.add_token(TokenType::SingleLineComment);
}

// TODO: handle EOF w/ error
Expand Down

0 comments on commit c88e8d6

Please sign in to comment.