rune/ast/
expr_loop.rs
1use crate::ast::prelude::*;
2
3#[test]
4#[cfg(not(miri))]
5fn ast_parse() {
6 rt::<ast::ExprLoop>("loop {}");
7 rt::<ast::ExprLoop>("loop { 1; }");
8 rt::<ast::ExprLoop>("'label: loop {1;}");
9 rt::<ast::ExprLoop>("#[attr] 'label: loop {x();}");
10}
11
12#[derive(Debug, TryClone, PartialEq, Eq, Parse, ToTokens, Spanned)]
16#[rune(parse = "meta_only")]
17#[non_exhaustive]
18pub struct ExprLoop {
19 #[rune(iter, meta)]
21 pub attributes: Vec<ast::Attribute>,
22 #[rune(iter, meta)]
24 pub label: Option<(ast::Label, T![:])>,
25 pub loop_token: T![loop],
27 pub body: Box<ast::Block>,
29}
30
31expr_parse!(Loop, ExprLoop, "loop expression");