diff --git a/src/parser/mod.rs b/src/parser/mod.rs index 22ccb49216..f17ffbf3aa 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,