Add while loop support and token pretty printing

The commit adds while loop statements and improves token display
formatting:

- Implements while loop syntax and evaluation - Adds a new token pretty
printing module with configurable formatting - Improves token display
with colors and different output modes
This commit is contained in:
Giulio Agostini
2025-10-03 19:40:25 +02:00
parent a7df45dc72
commit 113a683beb
8 changed files with 463 additions and 8 deletions
+11
View File
@@ -320,6 +320,17 @@ impl<'a> EvaluateInterpreter<Stmt> for Interpreter<'a> {
}),
}
}
Stmt::While { condition, body } => {
while self.interpret(*condition.clone())?.is_truthy() {
self.interpret(*body.clone())?;
}
Ok(LiteralValue::Nil)
}
Stmt::For {
variable,
iterable,
body,
} => todo!(),
}
}
}