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:
@@ -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!(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user