aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src/parser_api.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_syntax/src/parser_api.rs')
-rw-r--r--crates/ra_syntax/src/parser_api.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/crates/ra_syntax/src/parser_api.rs b/crates/ra_syntax/src/parser_api.rs
index 3148371c5..d795cbaf1 100644
--- a/crates/ra_syntax/src/parser_api.rs
+++ b/crates/ra_syntax/src/parser_api.rs
@@ -100,6 +100,14 @@ impl<'t> Parser<'t> {
100 true 100 true
101 } 101 }
102 102
103 /// Consume the next token matching one of the `kinds`
104 pub(crate) fn eat_one<'k, K>(&mut self, kinds: K) -> bool
105 where
106 K: IntoIterator<Item = &'k SyntaxKind> + 'k,
107 {
108 kinds.into_iter().map(|k| self.eat(*k)).any(|eaten| eaten)
109 }
110
103 /// Consume the next token if it is `kind` or emit an error 111 /// Consume the next token if it is `kind` or emit an error
104 /// otherwise. 112 /// otherwise.
105 pub(crate) fn expect(&mut self, kind: SyntaxKind) -> bool { 113 pub(crate) fn expect(&mut self, kind: SyntaxKind) -> bool {