From 60725def49834bb7dfd46c1a7b84d86f810e1d03 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 28 Jan 2018 14:30:59 +0300 Subject: Simplify --- src/parser/event_parser/grammar/mod.rs | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) (limited to 'src/parser/event_parser/grammar/mod.rs') diff --git a/src/parser/event_parser/grammar/mod.rs b/src/parser/event_parser/grammar/mod.rs index b87f3ca8a..79a4c10d3 100644 --- a/src/parser/event_parser/grammar/mod.rs +++ b/src/parser/event_parser/grammar/mod.rs @@ -57,7 +57,7 @@ impl<'p> Parser<'p> { err.complete(self, ERROR); } - pub(crate) fn expect(&mut self, kind: SyntaxKind) -> bool { + fn expect(&mut self, kind: SyntaxKind) -> bool { if self.at(kind) { self.bump(); true @@ -77,40 +77,24 @@ impl<'p> Parser<'p> { trait Lookahead: Copy { fn is_ahead(self, p: &Parser) -> bool; - fn consume(p: &mut Parser); } impl Lookahead for SyntaxKind { fn is_ahead(self, p: &Parser) -> bool { p.current() == self } - - fn consume(p: &mut Parser) { - p.bump(); - } } impl Lookahead for [SyntaxKind; 2] { fn is_ahead(self, p: &Parser) -> bool { p.current() == self[0] && p.raw_lookahead(1) == self[1] } - - fn consume(p: &mut Parser) { - p.bump(); - p.bump(); - } } impl Lookahead for [SyntaxKind; 3] { fn is_ahead(self, p: &Parser) -> bool { p.current() == self[0] && p.raw_lookahead(1) == self[1] && p.raw_lookahead(2) == self[2] } - - fn consume(p: &mut Parser) { - p.bump(); - p.bump(); - p.bump(); - } } #[derive(Clone, Copy)] @@ -121,8 +105,4 @@ impl<'a> Lookahead for AnyOf<'a> { let curr = p.current(); self.0.iter().any(|&k| k == curr) } - - fn consume(p: &mut Parser) { - p.bump(); - } } -- cgit v1.2.3