feat: Implement logical operators (AND, OR, NOT)

This commit is contained in:
Alvin
2025-07-22 17:00:48 +02:00
parent 3461ed8863
commit 452088e947
4 changed files with 70 additions and 5 deletions

View File

@@ -131,6 +131,15 @@ class Lexer:
if re.match(r'\bCringe\b', self.text[self.pos:]):
self.pos += len('Cringe')
return Token('CRINGE', False)
if re.match(r'\band\b', self.text[self.pos:]):
self.pos += len('and')
return Token('AND', 'and')
if re.match(r'\bor\b', self.text[self.pos:]):
self.pos += len('or')
return Token('OR', 'or')
if re.match(r'\bnot\b', self.text[self.pos:]):
self.pos += len('not')
return Token('NOT', 'not')
# Match identifiers
match = re.match(r'\b[a-zA-Z_][a-zA-Z0-9_]*\b', self.text[self.pos:])