From 6646d49f238bb92d55fcb4900830f19faa2994a5 Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Sat, 13 Apr 2019 18:38:31 +0800 Subject: Fix bug and add expr , pat , ty matcher --- crates/ra_mbe/src/tt_cursor.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'crates/ra_mbe/src/tt_cursor.rs') diff --git a/crates/ra_mbe/src/tt_cursor.rs b/crates/ra_mbe/src/tt_cursor.rs index d29faa77c..f6cefe087 100644 --- a/crates/ra_mbe/src/tt_cursor.rs +++ b/crates/ra_mbe/src/tt_cursor.rs @@ -84,6 +84,21 @@ impl<'a> TtCursor<'a> { parser.parse_path() } + pub(crate) fn eat_expr(&mut self) -> Option { + let parser = Parser::new(&mut self.pos, self.subtree); + parser.parse_expr() + } + + pub(crate) fn eat_ty(&mut self) -> Option { + let parser = Parser::new(&mut self.pos, self.subtree); + parser.parse_ty() + } + + pub(crate) fn eat_pat(&mut self) -> Option { + let parser = Parser::new(&mut self.pos, self.subtree); + parser.parse_pat() + } + pub(crate) fn expect_char(&mut self, char: char) -> Result<(), ParseError> { if self.at_char(char) { self.bump(); -- cgit v1.2.3