From 3630aeb1ea646b0151da4cdf12a6b025a0d031c5 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 28 Jan 2018 01:13:27 +0300 Subject: Drop high-order stuff for good --- src/parser/event_parser/grammar/mod.rs | 33 --------------------------------- src/parser/event_parser/parser.rs | 7 ------- 2 files changed, 40 deletions(-) diff --git a/src/parser/event_parser/grammar/mod.rs b/src/parser/event_parser/grammar/mod.rs index 67773453b..6e4f72096 100644 --- a/src/parser/event_parser/grammar/mod.rs +++ b/src/parser/event_parser/grammar/mod.rs @@ -46,39 +46,6 @@ fn alias(p: &mut Parser) -> bool { true //FIXME: return false if three are errors } -fn repeat bool>(p: &mut Parser, mut f: F) { - loop { - let pos = p.pos(); - if !f(p) { - return - } - if pos == p.pos() { - panic!("Infinite loop in parser") - } - } -} - -fn comma_list bool>(p: &mut Parser, end: SyntaxKind, f: F) { - repeat(p, |p| { - if p.current() == end { - return false - } - let pos = p.pos(); - f(p); - if p.pos() == pos { - return false - } - - if p.current() == end { - p.eat(COMMA); - } else { - p.expect(COMMA); - } - true - }) -} - - impl<'p> Parser<'p> { fn at(&self, l: L) -> bool { l.is_ahead(self) diff --git a/src/parser/event_parser/parser.rs b/src/parser/event_parser/parser.rs index 2cbe370be..18231e493 100644 --- a/src/parser/event_parser/parser.rs +++ b/src/parser/event_parser/parser.rs @@ -105,9 +105,6 @@ pub(crate) struct Parser<'t> { curly_limit: Option, } -#[derive(Debug, Clone, Copy, PartialEq, Eq)] -pub(crate) struct Pos(u32); - impl<'t> Parser<'t> { pub(crate) fn new(text: &'t str, raw_tokens: &'t [Token]) -> Parser<'t> { let mut tokens = Vec::new(); @@ -133,10 +130,6 @@ impl<'t> Parser<'t> { } } - pub(crate) fn pos(&self) -> Pos { - Pos(self.pos as u32) - } - pub(crate) fn into_events(self) -> Vec { assert!(self.curly_limit.is_none()); assert_eq!(self.current(), EOF); -- cgit v1.2.3