From c74eaf1fdfbe027379ab4a4df715a917bcbffef1 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 4 Feb 2018 13:56:51 +0300 Subject: Simplify --- src/parser/mod.rs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'src/parser') diff --git a/src/parser/mod.rs b/src/parser/mod.rs index 22ccb4921..f17ffbf3a 100644 --- a/src/parser/mod.rs +++ b/src/parser/mod.rs @@ -10,16 +10,14 @@ use self::event::Event; /// Parse a sequence of tokens into the representative node tree pub fn parse(text: String, tokens: &[Token]) -> File { - let events = parse_into_events(&text, tokens); + let events = { + let mut parser = parser::Parser::new(&text, tokens); + grammar::file(&mut parser); + parser.into_events() + }; event::to_file(text, tokens, events) } -pub(crate) fn parse_into_events<'t>(text: &'t str, raw_tokens: &'t [Token]) -> Vec { - let mut parser = parser::Parser::new(text, raw_tokens); - grammar::file(&mut parser); - parser.into_events() -} - fn is_insignificant(kind: SyntaxKind) -> bool { match kind { WHITESPACE | COMMENT => true, -- cgit v1.2.3