rune/ast/expr_group.rs
1use crate::ast::prelude::*;
2
3#[test]
4#[cfg(not(miri))]
5fn ast_parse() {
6 rt::<ast::ExprGroup>("(for i in x {})");
7 rt::<ast::ExprGroup>("(1 + 2)");
8}
9
10/// A prioritized expression group.
11///
12/// * `(<expr>)`.
13#[derive(Debug, TryClone, PartialEq, Eq, ToTokens, Spanned)]
14#[non_exhaustive]
15pub struct ExprGroup {
16 /// Attributes associated with expression.
17 #[rune(iter)]
18 pub attributes: Vec<ast::Attribute>,
19 /// The open parenthesis.
20 pub open: ast::OpenParen,
21 /// The grouped expression.
22 pub expr: Box<ast::Expr>,
23 /// The close parenthesis.
24 pub close: ast::CloseParen,
25}
26
27expr_parse!(Group, ExprGroup, "group expression");