fix(parser): fix bang equal
consume equal token when matching bang-equal
This commit is contained in:
@@ -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 '!=' ?")
|
||||
|
||||
@@ -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 '!=' ?")
|
||||
|
||||
Reference in New Issue
Block a user