feat: Implement try-except error handling

This commit is contained in:
Alvin
2025-07-22 19:59:37 +02:00
parent d5d3b9f421
commit c5c77ef775
4 changed files with 71 additions and 12 deletions

View File

@@ -164,6 +164,24 @@ class Lexer:
if re.match(r'\bContinue\b', self.text[self.pos:]):
self.pos += len('Continue')
return Token('CONTINUE', 'Continue')
if re.match(r'\bTwink\b', self.text[self.pos:]):
self.pos += len('Twink')
return Token('TRY', 'Twink')
if re.match(r'\bBimboy\b', self.text[self.pos:]):
self.pos += len('Bimboy')
return Token('EXCEPT', 'Bimboy')
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'\bTwink\b', self.text[self.pos:]):
self.pos += len('Twink')
return Token('TRY', 'Twink')
if re.match(r'\bBimboy\b', self.text[self.pos:]):
self.pos += len('Bimboy')
return Token('EXCEPT', 'Bimboy')
if re.match(r'\band\b', self.text[self.pos:]):
self.pos += len('and')
return Token('AND', 'and')