1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
use crate::{ast, ast::support, impl_ast_node, language::SyntaxNode, AstNode};
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct Match {
pub syntax: SyntaxNode,
}
impl_ast_node!(Match, MATCH);
impl Match {
pub fn mrules(&self) -> impl Iterator<Item = ast::Mrule> {
support::children(self.syntax())
}
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct Mrule {
pub syntax: SyntaxNode,
}
impl_ast_node!(Mrule, MRULE);
impl Mrule {
pub fn pat(&self) -> Option<ast::Pat> {
support::child(self.syntax())
}
pub fn expr(&self) -> Option<ast::Expr> {
support::child(self.syntax())
}
}