From 1b1fbb834edfea901b31d56a17f94da41f489229 Mon Sep 17 00:00:00 2001 From: LordBaryhobal Date: Mon, 18 May 2026 13:22:11 +0200 Subject: [PATCH] fix(parser): fix bang equal consume equal token when matching bang-equal --- lexer/annotations.py | 2 +- lexer/midas.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lexer/annotations.py b/lexer/annotations.py index 3ee18af..ae9faae 100644 --- a/lexer/annotations.py +++ b/lexer/annotations.py @@ -28,7 +28,7 @@ class AnnotationLexer(Lexer): TokenType.EQUAL_EQUAL if self.match("=") else TokenType.EQUAL ) case "!": - if self.peek() == "=": + if self.match("="): self.add_token(TokenType.BANG_EQUAL) else: self.error("Unexpected single bang. Did you mean '!=' ?") diff --git a/lexer/midas.py b/lexer/midas.py index 42d8e6b..ad29a68 100644 --- a/lexer/midas.py +++ b/lexer/midas.py @@ -32,7 +32,7 @@ class MidasLexer(Lexer): TokenType.EQUAL_EQUAL if self.match("=") else TokenType.EQUAL ) case "!": - if self.peek() == "=": + if self.match("="): self.add_token(TokenType.BANG_EQUAL) else: self.error("Unexpected single bang. Did you mean '!=' ?")