From afaa26636e4391ebacfc09e9c994c11bab58b834 Mon Sep 17 00:00:00 2001 From: Marcus Klaas de Vries Date: Tue, 15 Jan 2019 15:24:04 +0100 Subject: Add additional pattern variants --- crates/ra_syntax/src/ast/generated.rs | 12 ++++++++++-- crates/ra_syntax/src/grammar.ron | 4 ++-- 2 files changed, 12 insertions(+), 4 deletions(-) (limited to 'crates/ra_syntax/src') diff --git a/crates/ra_syntax/src/ast/generated.rs b/crates/ra_syntax/src/ast/generated.rs index 2d9603d90..2fd146bf1 100644 --- a/crates/ra_syntax/src/ast/generated.rs +++ b/crates/ra_syntax/src/ast/generated.rs @@ -2285,7 +2285,11 @@ impl AstNode for PathPat { } -impl PathPat {} +impl PathPat { + pub fn path(&self) -> Option<&Path> { + super::child_opt(self) + } +} // PathSegment #[derive(Debug, PartialEq, Eq, Hash)] @@ -3219,7 +3223,11 @@ impl AstNode for TuplePat { } -impl TuplePat {} +impl TuplePat { + pub fn args(&self) -> impl Iterator { + super::children(self) + } +} // TupleStructPat #[derive(Debug, PartialEq, Eq, Hash)] diff --git a/crates/ra_syntax/src/grammar.ron b/crates/ra_syntax/src/grammar.ron index 2aaad46b1..b524c8aaf 100644 --- a/crates/ra_syntax/src/grammar.ron +++ b/crates/ra_syntax/src/grammar.ron @@ -490,14 +490,14 @@ Grammar( "RefPat": ( options: [ "Pat" ]), "BindPat": ( traits: ["NameOwner"] ), "PlaceholderPat": (), - "PathPat": (), + "PathPat": ( options: ["Path"] ), "StructPat": (), "FieldPatList": (), "TupleStructPat": ( options: ["Path"], collections: [["args", "Pat"]], ), - "TuplePat": (), + "TuplePat": ( collections: [["args", "Pat"]] ), "SlicePat": (), "RangePat": (), -- cgit v1.2.3