From 1df513e1c74499be05b0492f91922a7999384a61 Mon Sep 17 00:00:00 2001 From: Haven Selph Date: Sun, 4 Aug 2024 13:27:28 -0500 Subject: [PATCH] fix: the age old comment bug is squashed --- src/lexer.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lexer.rs b/src/lexer.rs index 8477339..95a5e3a 100644 --- a/src/lexer.rs +++ b/src/lexer.rs @@ -93,7 +93,9 @@ impl<'source> Lexer<'source> { while Some('\n') == self.current { self.advance(); } - self.push_token(TokenKind::NewLine, span_to!(start_index), ""); + if self.tokens.last().is_some_and(|token| token.kind != TokenKind::NewLine) { + self.push_token(TokenKind::NewLine, span_to!(start_index), ""); + } continue; }, char if char.is_whitespace() => {