1use crate::ast::prelude::*;
23#[test]
4#[cfg(not(miri))]
5fn ast_parse() {
6 rt::<ast::ExprWhile>("while x {}");
7 rt::<ast::ExprWhile>("'label: while x {}");
8 rt::<ast::ExprWhile>("#[attr] 'label: while x {}");
9}
1011/// A `while` loop.
12///
13/// * `while [expr] { ... }`.
14#[derive(Debug, TryClone, PartialEq, Eq, Parse, ToTokens, Spanned)]
15#[rune(parse = "meta_only")]
16#[non_exhaustive]
17pub struct ExprWhile {
18/// The attributes for the `while` loop
19#[rune(iter, meta)]
20pub attributes: Vec<ast::Attribute>,
21/// A label for the while loop.
22#[rune(iter, meta)]
23pub label: Option<(ast::Label, T![:])>,
24/// The `while` keyword.
25pub while_token: T![while],
26/// The name of the binding.
27pub condition: Box<ast::Condition>,
28/// The body of the while loop.
29pub body: Box<ast::Block>,
30}
3132expr_parse!(While, ExprWhile, "while expression");