use crate::ast::prelude::*;
#[test]
#[cfg(not(miri))]
fn ast_parse() {
rt::<ast::Condition>("true");
rt::<ast::Condition>("let [a, ..] = v");
}
#[derive(Debug, TryClone, PartialEq, Eq, ToTokens, Spanned)]
#[non_exhaustive]
pub enum Condition {
Expr(ast::Expr),
ExprLet(ast::ExprLet),
}
impl Parse for Condition {
fn parse(p: &mut Parser<'_>) -> Result<Self> {
Ok(match p.nth(0)? {
K![let] => Self::ExprLet(ast::ExprLet::parse_without_eager_brace(p)?),
_ => Self::Expr(ast::Expr::parse_without_eager_brace(p)?),
})
}
}