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/parsing.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 crates/ra_syntax/src/parsing.rs (limited to 'crates/ra_syntax/src/parsing.rs') diff --git a/crates/ra_syntax/src/parsing.rs b/crates/ra_syntax/src/parsing.rs new file mode 100644 index 000000000..2c92d554e --- /dev/null +++ b/crates/ra_syntax/src/parsing.rs @@ -0,0 +1,24 @@ +#[macro_use] +mod token_set; +mod builder; +mod lexer; +mod parser_impl; +mod parser_api; +mod reparsing; +mod grammar; + +use crate::{ + parsing::builder::GreenBuilder, + syntax_node::{GreenNode, SyntaxError}, +}; + +pub use self::lexer::{tokenize, Token}; + +pub(crate) use self::reparsing::incremental_reparse; + +pub(crate) fn parse_text(text: &str) -> (GreenNode, Vec) { + let tokens = tokenize(&text); + let (green, errors) = + parser_impl::parse_with(GreenBuilder::new(), text, &tokens, grammar::root); + (green, errors) +} -- cgit v1.2.3 From a4a1e08ab81193112a2e14413d084916241c3fca Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 20 Feb 2019 16:16:14 +0300 Subject: flatten modules --- crates/ra_syntax/src/parsing.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'crates/ra_syntax/src/parsing.rs') diff --git a/crates/ra_syntax/src/parsing.rs b/crates/ra_syntax/src/parsing.rs index 2c92d554e..023e1031c 100644 --- a/crates/ra_syntax/src/parsing.rs +++ b/crates/ra_syntax/src/parsing.rs @@ -8,8 +8,9 @@ mod reparsing; mod grammar; use crate::{ + SyntaxError, parsing::builder::GreenBuilder, - syntax_node::{GreenNode, SyntaxError}, + syntax_node::GreenNode, }; pub use self::lexer::{tokenize, Token}; -- cgit v1.2.3 From 45fc91cc470fa91d5b8905fea2cab4d42bbe72b3 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 20 Feb 2019 16:24:39 +0300 Subject: rearrange modules in a suggestd reading order --- crates/ra_syntax/src/parsing.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'crates/ra_syntax/src/parsing.rs') diff --git a/crates/ra_syntax/src/parsing.rs b/crates/ra_syntax/src/parsing.rs index 023e1031c..761accd7b 100644 --- a/crates/ra_syntax/src/parsing.rs +++ b/crates/ra_syntax/src/parsing.rs @@ -4,8 +4,8 @@ mod builder; mod lexer; mod parser_impl; mod parser_api; -mod reparsing; mod grammar; +mod reparsing; use crate::{ SyntaxError, -- cgit v1.2.3