From ad188d4c3db34f035408afbdd6d2f3c308121f0a Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 29 Jul 2018 14:37:48 +0300 Subject: kill old tree --- src/parser/event.rs | 10 ++-------- src/parser/mod.rs | 14 +------------- 2 files changed, 3 insertions(+), 21 deletions(-) (limited to 'src/parser') diff --git a/src/parser/event.rs b/src/parser/event.rs index 0fbfaeb9f..83039c664 100644 --- a/src/parser/event.rs +++ b/src/parser/event.rs @@ -1,5 +1,5 @@ use { - ErrorMsg, File, FileBuilder, Sink, SyntaxKind, Token, GreenBuilder, + Sink, SyntaxKind, Token, syntax_kinds::TOMBSTONE, }; use super::is_insignificant; @@ -67,12 +67,6 @@ pub(crate) enum Event { }, } -pub(super) fn to_file(text: String, tokens: &[Token], events: Vec) -> File { - let mut builder = FileBuilder::new(text); - process(&mut builder, tokens, events); - builder.finish() -} - pub(super) fn process(builder: &mut Sink, tokens: &[Token], events: Vec) { let mut idx = 0; @@ -147,7 +141,7 @@ pub(super) fn process(builder: &mut Sink, tokens: &[Token], events: Vec) } builder.leaf(kind, len); } - &Event::Error { ref msg } => builder.error(ErrorMsg { msg: msg.clone() }), + &Event::Error { ref msg } => builder.error(msg.clone()), } } } diff --git a/src/parser/mod.rs b/src/parser/mod.rs index 26fbb6e3d..b7d5e5832 100644 --- a/src/parser/mod.rs +++ b/src/parser/mod.rs @@ -7,7 +7,7 @@ mod grammar; use std::sync::Arc; use { - File, SyntaxKind, Token, + Token, yellow::SyntaxNode, syntax_kinds::* }; @@ -15,18 +15,6 @@ use GreenBuilder; use parser::event::process; -/// Parse a sequence of tokens into the representative node tree -pub fn parse(text: String, tokens: &[Token]) -> File { - let events = { - let input = input::ParserInput::new(&text, tokens); - let parser_impl = parser::imp::ParserImpl::new(&input); - let mut parser = parser::Parser(parser_impl); - grammar::file(&mut parser); - parser.0.into_events() - }; - event::to_file(text, tokens, events) -} - /// Parse a sequence of tokens into the representative node tree pub fn parse_green(text: String, tokens: &[Token]) -> SyntaxNode { let events = { -- cgit v1.2.3