feat: runtime block value

This commit is contained in:
Dan Chen
2024-03-21 17:55:02 +08:00
parent 0c34fd260f
commit 1a3e6537a4
4 changed files with 45 additions and 15 deletions

View File

@ -55,7 +55,15 @@ class Parser:
"body": body,
}
def if_statement(self):
self.eat('if')
return {
"type": 'IfStatement',
}
def expression_statement(self):
if self.token_type() == "if":
return self.if_statement()
if self.token_type() == "return":
return self.return_statement()
if self._is_literal():