From c3e5987c433cdd0ea95a6b1057b442f4f0fe1ffc Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 25 Aug 2018 14:45:17 +0300 Subject: incremental reparse --- crates/libsyntax2/src/parser_impl/mod.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'crates/libsyntax2/src/parser_impl') diff --git a/crates/libsyntax2/src/parser_impl/mod.rs b/crates/libsyntax2/src/parser_impl/mod.rs index 14cceced5..f60ef80f0 100644 --- a/crates/libsyntax2/src/parser_impl/mod.rs +++ b/crates/libsyntax2/src/parser_impl/mod.rs @@ -2,7 +2,6 @@ mod event; mod input; use { - grammar, lexer::Token, parser_api::Parser, parser_impl::{ @@ -27,12 +26,16 @@ pub(crate) trait Sink<'a> { } /// Parse a sequence of tokens into the representative node tree -pub(crate) fn parse<'a, S: Sink<'a>>(text: &'a str, tokens: &[Token]) -> S::Tree { +pub(crate) fn parse_with<'a, S: Sink<'a>>( + text: &'a str, + tokens: &[Token], + parser: fn(&mut Parser), +) -> S::Tree { let events = { let input = input::ParserInput::new(text, tokens); let parser_impl = ParserImpl::new(&input); let mut parser_api = Parser(parser_impl); - grammar::file(&mut parser_api); + parser(&mut parser_api); parser_api.0.into_events() }; let mut sink = S::new(text); -- cgit v1.2.3