aboutsummaryrefslogtreecommitdiff
path: root/crates/libsyntax2/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/libsyntax2/src')
-rw-r--r--crates/libsyntax2/src/ast/generated.rs26
-rw-r--r--crates/libsyntax2/src/grammar.ron16
2 files changed, 36 insertions, 6 deletions
diff --git a/crates/libsyntax2/src/ast/generated.rs b/crates/libsyntax2/src/ast/generated.rs
index f21e49437..bdee635ae 100644
--- a/crates/libsyntax2/src/ast/generated.rs
+++ b/crates/libsyntax2/src/ast/generated.rs
@@ -842,7 +842,17 @@ impl<'a> AstNode<'a> for MatchArm<'a> {
842 fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } 842 fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax }
843} 843}
844 844
845impl<'a> MatchArm<'a> {} 845impl<'a> MatchArm<'a> {
846 pub fn pats(self) -> impl Iterator<Item = Pat<'a>> + 'a {
847 super::children(self)
848 }
849pub fn guard(self) -> Option<MatchGuard<'a>> {
850 super::child_opt(self)
851 }
852pub fn expr(self) -> Option<Expr<'a>> {
853 super::child_opt(self)
854 }
855}
846 856
847// MatchArmList 857// MatchArmList
848#[derive(Debug, Clone, Copy)] 858#[derive(Debug, Clone, Copy)]
@@ -860,7 +870,11 @@ impl<'a> AstNode<'a> for MatchArmList<'a> {
860 fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } 870 fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax }
861} 871}
862 872
863impl<'a> MatchArmList<'a> {} 873impl<'a> MatchArmList<'a> {
874 pub fn arms(self) -> impl Iterator<Item = MatchArm<'a>> + 'a {
875 super::children(self)
876 }
877}
864 878
865// MatchExpr 879// MatchExpr
866#[derive(Debug, Clone, Copy)] 880#[derive(Debug, Clone, Copy)]
@@ -878,7 +892,13 @@ impl<'a> AstNode<'a> for MatchExpr<'a> {
878 fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } 892 fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax }
879} 893}
880 894
881impl<'a> MatchExpr<'a> {} 895impl<'a> MatchExpr<'a> {pub fn expr(self) -> Option<Expr<'a>> {
896 super::child_opt(self)
897 }
898pub fn match_arm_list(self) -> Option<MatchArmList<'a>> {
899 super::child_opt(self)
900 }
901}
882 902
883// MatchGuard 903// MatchGuard
884#[derive(Debug, Clone, Copy)] 904#[derive(Debug, Clone, Copy)]
diff --git a/crates/libsyntax2/src/grammar.ron b/crates/libsyntax2/src/grammar.ron
index fbe8397d8..798725f7e 100644
--- a/crates/libsyntax2/src/grammar.ron
+++ b/crates/libsyntax2/src/grammar.ron
@@ -370,9 +370,19 @@ Grammar(
370 options: [ "Block" ] 370 options: [ "Block" ]
371 ), 371 ),
372 "ReturnExpr": (), 372 "ReturnExpr": (),
373 "MatchExpr": (), 373 "MatchExpr": (
374 "MatchArmList": (), 374 options: [ "Expr", "MatchArmList" ],
375 "MatchArm": (), 375 ),
376 "MatchArmList": (
377 collections: [ ["arms", "MatchArm"] ],
378 ),
379 "MatchArm": (
380 options: [
381 [ "guard", "MatchGuard" ],
382 "Expr",
383 ],
384 collections: [ [ "pats", "Pat" ] ]
385 ),
376 "MatchGuard": (), 386 "MatchGuard": (),
377 "StructLit": (), 387 "StructLit": (),
378 "NamedFieldList": (), 388 "NamedFieldList": (),