FOR STATEMENTS WORK!!!!!

This commit is contained in:
SpookyDervish
2025-10-16 17:35:00 +11:00
parent 600bebb9b2
commit 1d6c3db5e4
4 changed files with 25 additions and 42 deletions

View File

@@ -202,6 +202,7 @@ class Parser:
assign_stmt.ident = stmt.name
assign_stmt.right_value = self.__parse_expression(PrecedenceType.P_LOWEST)
while not self.__current_token_is(TokenType.SEMICOLON) and not self.__current_token_is(TokenType.EOF):
self.__next_token()
@@ -355,7 +356,7 @@ class Parser:
stmt.action = self.__parse_assignment_statement()
print(stmt.action.json())
self.__next_token()
@@ -376,6 +377,7 @@ class Parser:
left_expr: Expression = prefix_func()
while not self.__peek_token_is(TokenType.SEMICOLON) and precedence.value < self.__peek_precedence().value:
infix_func: Callable | None = self.infix_parse_functions.get(self.peek_token.type)
if infix_func is None:
return left_expr