From 5222b8aba3b1c2c68706aacf6869423a8e4fe6d5 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 20 Feb 2019 15:47:32 +0300 Subject: move all parsing related bits to a separate module --- crates/ra_syntax/src/lib.rs | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'crates/ra_syntax/src/lib.rs') diff --git a/crates/ra_syntax/src/lib.rs b/crates/ra_syntax/src/lib.rs index cbba1d4ae..755ccd8e0 100644 --- a/crates/ra_syntax/src/lib.rs +++ b/crates/ra_syntax/src/lib.rs @@ -18,13 +18,7 @@ pub mod algo; pub mod ast; -mod lexer; -#[macro_use] -mod token_set; -mod grammar; -mod parser_api; -mod parser_impl; -mod reparsing; +mod parsing; mod string_lexing; mod syntax_kinds; /// Utilities for simple uses of the parser. @@ -36,10 +30,10 @@ mod ptr; pub use rowan::{SmolStr, TextRange, TextUnit}; pub use crate::{ ast::AstNode, - lexer::{tokenize, Token}, syntax_kinds::SyntaxKind, syntax_node::{Direction, SyntaxError, SyntaxNode, WalkEvent, Location, TreeArc}, ptr::{SyntaxNodePtr, AstPtr}, + parsing::{tokenize, Token}, }; use ra_text_edit::AtomTextEdit; @@ -59,9 +53,7 @@ impl SourceFile { } pub fn parse(text: &str) -> TreeArc { - let tokens = tokenize(&text); - let (green, errors) = - parser_impl::parse_with(syntax_node::GreenBuilder::new(), text, &tokens, grammar::root); + let (green, errors) = parsing::parse_text(text); SourceFile::new(green, errors) } @@ -70,7 +62,7 @@ impl SourceFile { } pub fn incremental_reparse(&self, edit: &AtomTextEdit) -> Option> { - reparsing::incremental_reparse(self.syntax(), edit, self.errors()) + parsing::incremental_reparse(self.syntax(), edit, self.errors()) .map(|(green_node, errors)| SourceFile::new(green_node, errors)) } -- cgit v1.2.3