aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_parser/src/grammar/patterns.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_parser/src/grammar/patterns.rs')
-rw-r--r--crates/ra_parser/src/grammar/patterns.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/crates/ra_parser/src/grammar/patterns.rs b/crates/ra_parser/src/grammar/patterns.rs
index 9d7da639d..befe6687d 100644
--- a/crates/ra_parser/src/grammar/patterns.rs
+++ b/crates/ra_parser/src/grammar/patterns.rs
@@ -8,6 +8,22 @@ pub(super) fn pattern(p: &mut Parser) {
8 pattern_r(p, PAT_RECOVERY_SET) 8 pattern_r(p, PAT_RECOVERY_SET)
9} 9}
10 10
11/// Parses a pattern list separated by pipes `|`
12pub(super) fn pattern_list(p: &mut Parser) {
13 pattern_list_r(p, PAT_RECOVERY_SET)
14}
15
16/// Parses a pattern list separated by pipes `|`
17/// using the given `recovery_set`
18pub(super) fn pattern_list_r(p: &mut Parser, recovery_set: TokenSet) {
19 p.eat(PIPE);
20 pattern_r(p, recovery_set);
21
22 while p.eat(PIPE) {
23 pattern_r(p, recovery_set);
24 }
25}
26
11pub(super) fn pattern_r(p: &mut Parser, recovery_set: TokenSet) { 27pub(super) fn pattern_r(p: &mut Parser, recovery_set: TokenSet) {
12 if let Some(lhs) = atom_pat(p, recovery_set) { 28 if let Some(lhs) = atom_pat(p, recovery_set) {
13 // test range_pat 29 // test range_pat