Macro rnix::match_ast

source ·
macro_rules! match_ast {
    (match $node:ident { $($tt:tt)* }) => { ... };
    (match ($node:expr) {
        $( ast::$ast:ident($it:pat) => $res:expr, )*
        _ => $catch_all:expr $(,)?
    }) => { ... };
}
Expand description

Matches a SyntaxNode against an ast type.

§Example:

match_ast! {
    match node {
        ast::Apply(it) => { ... },
        ast::Assert(it) => { ... },
        ast::IfElse(it) => { ... },
        _ => None,
    }
}