diff options
Diffstat (limited to 'crates')
-rw-r--r-- | crates/ra_syntax/src/lib.rs | 16 | ||||
-rw-r--r-- | crates/ra_syntax/src/parsing.rs | 24 | ||||
-rw-r--r-- | crates/ra_syntax/src/parsing/builder.rs (renamed from crates/ra_syntax/src/syntax_node/builder.rs) | 2 | ||||
-rw-r--r-- | crates/ra_syntax/src/parsing/grammar.rs (renamed from crates/ra_syntax/src/grammar.rs) | 6 | ||||
-rw-r--r-- | crates/ra_syntax/src/parsing/grammar/attributes.rs (renamed from crates/ra_syntax/src/grammar/attributes.rs) | 0 | ||||
-rw-r--r-- | crates/ra_syntax/src/parsing/grammar/expressions.rs (renamed from crates/ra_syntax/src/grammar/expressions.rs) | 0 | ||||
-rw-r--r-- | crates/ra_syntax/src/parsing/grammar/expressions/atom.rs (renamed from crates/ra_syntax/src/grammar/expressions/atom.rs) | 0 | ||||
-rw-r--r-- | crates/ra_syntax/src/parsing/grammar/items.rs (renamed from crates/ra_syntax/src/grammar/items.rs) | 0 | ||||
-rw-r--r-- | crates/ra_syntax/src/parsing/grammar/items/consts.rs (renamed from crates/ra_syntax/src/grammar/items/consts.rs) | 0 | ||||
-rw-r--r-- | crates/ra_syntax/src/parsing/grammar/items/nominal.rs (renamed from crates/ra_syntax/src/grammar/items/nominal.rs) | 0 | ||||
-rw-r--r-- | crates/ra_syntax/src/parsing/grammar/items/traits.rs (renamed from crates/ra_syntax/src/grammar/items/traits.rs) | 0 | ||||
-rw-r--r-- | crates/ra_syntax/src/parsing/grammar/items/use_item.rs (renamed from crates/ra_syntax/src/grammar/items/use_item.rs) | 0 | ||||
-rw-r--r-- | crates/ra_syntax/src/parsing/grammar/params.rs (renamed from crates/ra_syntax/src/grammar/params.rs) | 0 | ||||
-rw-r--r-- | crates/ra_syntax/src/parsing/grammar/paths.rs (renamed from crates/ra_syntax/src/grammar/paths.rs) | 0 | ||||
-rw-r--r-- | crates/ra_syntax/src/parsing/grammar/patterns.rs (renamed from crates/ra_syntax/src/grammar/patterns.rs) | 0 | ||||
-rw-r--r-- | crates/ra_syntax/src/parsing/grammar/type_args.rs (renamed from crates/ra_syntax/src/grammar/type_args.rs) | 0 | ||||
-rw-r--r-- | crates/ra_syntax/src/parsing/grammar/type_params.rs (renamed from crates/ra_syntax/src/grammar/type_params.rs) | 0 | ||||
-rw-r--r-- | crates/ra_syntax/src/parsing/grammar/types.rs (renamed from crates/ra_syntax/src/grammar/types.rs) | 0 | ||||
-rw-r--r-- | crates/ra_syntax/src/parsing/lexer.rs (renamed from crates/ra_syntax/src/lexer.rs) | 0 | ||||
-rw-r--r-- | crates/ra_syntax/src/parsing/lexer/classes.rs (renamed from crates/ra_syntax/src/lexer/classes.rs) | 0 | ||||
-rw-r--r-- | crates/ra_syntax/src/parsing/lexer/comments.rs (renamed from crates/ra_syntax/src/lexer/comments.rs) | 2 | ||||
-rw-r--r-- | crates/ra_syntax/src/parsing/lexer/numbers.rs (renamed from crates/ra_syntax/src/lexer/numbers.rs) | 6 | ||||
-rw-r--r-- | crates/ra_syntax/src/parsing/lexer/ptr.rs (renamed from crates/ra_syntax/src/lexer/ptr.rs) | 0 | ||||
-rw-r--r-- | crates/ra_syntax/src/parsing/lexer/strings.rs (renamed from crates/ra_syntax/src/lexer/strings.rs) | 7 | ||||
-rw-r--r-- | crates/ra_syntax/src/parsing/parser_api.rs (renamed from crates/ra_syntax/src/parser_api.rs) | 6 | ||||
-rw-r--r-- | crates/ra_syntax/src/parsing/parser_impl.rs (renamed from crates/ra_syntax/src/parser_impl.rs) | 10 | ||||
-rw-r--r-- | crates/ra_syntax/src/parsing/parser_impl/event.rs (renamed from crates/ra_syntax/src/parser_impl/event.rs) | 9 | ||||
-rw-r--r-- | crates/ra_syntax/src/parsing/parser_impl/input.rs (renamed from crates/ra_syntax/src/parser_impl/input.rs) | 5 | ||||
-rw-r--r-- | crates/ra_syntax/src/parsing/reparsing.rs (renamed from crates/ra_syntax/src/reparsing.rs) | 22 | ||||
-rw-r--r-- | crates/ra_syntax/src/parsing/token_set.rs (renamed from crates/ra_syntax/src/token_set.rs) | 8 | ||||
-rw-r--r-- | crates/ra_syntax/src/syntax_node.rs | 2 |
31 files changed, 78 insertions, 47 deletions
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 @@ | |||
18 | 18 | ||
19 | pub mod algo; | 19 | pub mod algo; |
20 | pub mod ast; | 20 | pub mod ast; |
21 | mod lexer; | 21 | mod parsing; |
22 | #[macro_use] | ||
23 | mod token_set; | ||
24 | mod grammar; | ||
25 | mod parser_api; | ||
26 | mod parser_impl; | ||
27 | mod reparsing; | ||
28 | mod string_lexing; | 22 | mod string_lexing; |
29 | mod syntax_kinds; | 23 | mod syntax_kinds; |
30 | /// Utilities for simple uses of the parser. | 24 | /// Utilities for simple uses of the parser. |
@@ -36,10 +30,10 @@ mod ptr; | |||
36 | pub use rowan::{SmolStr, TextRange, TextUnit}; | 30 | pub use rowan::{SmolStr, TextRange, TextUnit}; |
37 | pub use crate::{ | 31 | pub use crate::{ |
38 | ast::AstNode, | 32 | ast::AstNode, |
39 | lexer::{tokenize, Token}, | ||
40 | syntax_kinds::SyntaxKind, | 33 | syntax_kinds::SyntaxKind, |
41 | syntax_node::{Direction, SyntaxError, SyntaxNode, WalkEvent, Location, TreeArc}, | 34 | syntax_node::{Direction, SyntaxError, SyntaxNode, WalkEvent, Location, TreeArc}, |
42 | ptr::{SyntaxNodePtr, AstPtr}, | 35 | ptr::{SyntaxNodePtr, AstPtr}, |
36 | parsing::{tokenize, Token}, | ||
43 | }; | 37 | }; |
44 | 38 | ||
45 | use ra_text_edit::AtomTextEdit; | 39 | use ra_text_edit::AtomTextEdit; |
@@ -59,9 +53,7 @@ impl SourceFile { | |||
59 | } | 53 | } |
60 | 54 | ||
61 | pub fn parse(text: &str) -> TreeArc<SourceFile> { | 55 | pub fn parse(text: &str) -> TreeArc<SourceFile> { |
62 | let tokens = tokenize(&text); | 56 | let (green, errors) = parsing::parse_text(text); |
63 | let (green, errors) = | ||
64 | parser_impl::parse_with(syntax_node::GreenBuilder::new(), text, &tokens, grammar::root); | ||
65 | SourceFile::new(green, errors) | 57 | SourceFile::new(green, errors) |
66 | } | 58 | } |
67 | 59 | ||
@@ -70,7 +62,7 @@ impl SourceFile { | |||
70 | } | 62 | } |
71 | 63 | ||
72 | pub fn incremental_reparse(&self, edit: &AtomTextEdit) -> Option<TreeArc<SourceFile>> { | 64 | pub fn incremental_reparse(&self, edit: &AtomTextEdit) -> Option<TreeArc<SourceFile>> { |
73 | reparsing::incremental_reparse(self.syntax(), edit, self.errors()) | 65 | parsing::incremental_reparse(self.syntax(), edit, self.errors()) |
74 | .map(|(green_node, errors)| SourceFile::new(green_node, errors)) | 66 | .map(|(green_node, errors)| SourceFile::new(green_node, errors)) |
75 | } | 67 | } |
76 | 68 | ||
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 @@ | |||
1 | #[macro_use] | ||
2 | mod token_set; | ||
3 | mod builder; | ||
4 | mod lexer; | ||
5 | mod parser_impl; | ||
6 | mod parser_api; | ||
7 | mod reparsing; | ||
8 | mod grammar; | ||
9 | |||
10 | use crate::{ | ||
11 | parsing::builder::GreenBuilder, | ||
12 | syntax_node::{GreenNode, SyntaxError}, | ||
13 | }; | ||
14 | |||
15 | pub use self::lexer::{tokenize, Token}; | ||
16 | |||
17 | pub(crate) use self::reparsing::incremental_reparse; | ||
18 | |||
19 | pub(crate) fn parse_text(text: &str) -> (GreenNode, Vec<SyntaxError>) { | ||
20 | let tokens = tokenize(&text); | ||
21 | let (green, errors) = | ||
22 | parser_impl::parse_with(GreenBuilder::new(), text, &tokens, grammar::root); | ||
23 | (green, errors) | ||
24 | } | ||
diff --git a/crates/ra_syntax/src/syntax_node/builder.rs b/crates/ra_syntax/src/parsing/builder.rs index 8abd0f051..9d7ad06fe 100644 --- a/crates/ra_syntax/src/syntax_node/builder.rs +++ b/crates/ra_syntax/src/parsing/builder.rs | |||
@@ -1,5 +1,5 @@ | |||
1 | use crate::{ | 1 | use crate::{ |
2 | parser_impl::Sink, | 2 | parsing::parser_impl::Sink, |
3 | syntax_node::{GreenNode, RaTypes, SyntaxError}, | 3 | syntax_node::{GreenNode, RaTypes, SyntaxError}, |
4 | SmolStr, SyntaxKind, | 4 | SmolStr, SyntaxKind, |
5 | }; | 5 | }; |
diff --git a/crates/ra_syntax/src/grammar.rs b/crates/ra_syntax/src/parsing/grammar.rs index 060c0ccdf..bf86443de 100644 --- a/crates/ra_syntax/src/grammar.rs +++ b/crates/ra_syntax/src/parsing/grammar.rs | |||
@@ -44,9 +44,11 @@ pub(crate) use self::{ | |||
44 | }, | 44 | }, |
45 | }; | 45 | }; |
46 | use crate::{ | 46 | use crate::{ |
47 | parser_api::{CompletedMarker, Marker, Parser}, | ||
48 | token_set::TokenSet, | ||
49 | SyntaxKind::{self, *}, | 47 | SyntaxKind::{self, *}, |
48 | parsing::{ | ||
49 | token_set::TokenSet, | ||
50 | parser_api::{CompletedMarker, Marker, Parser} | ||
51 | }, | ||
50 | }; | 52 | }; |
51 | 53 | ||
52 | pub(crate) fn root(p: &mut Parser) { | 54 | pub(crate) fn root(p: &mut Parser) { |
diff --git a/crates/ra_syntax/src/grammar/attributes.rs b/crates/ra_syntax/src/parsing/grammar/attributes.rs index cd30e8a45..cd30e8a45 100644 --- a/crates/ra_syntax/src/grammar/attributes.rs +++ b/crates/ra_syntax/src/parsing/grammar/attributes.rs | |||
diff --git a/crates/ra_syntax/src/grammar/expressions.rs b/crates/ra_syntax/src/parsing/grammar/expressions.rs index d5a4f4d7b..d5a4f4d7b 100644 --- a/crates/ra_syntax/src/grammar/expressions.rs +++ b/crates/ra_syntax/src/parsing/grammar/expressions.rs | |||
diff --git a/crates/ra_syntax/src/grammar/expressions/atom.rs b/crates/ra_syntax/src/parsing/grammar/expressions/atom.rs index e74305b6a..e74305b6a 100644 --- a/crates/ra_syntax/src/grammar/expressions/atom.rs +++ b/crates/ra_syntax/src/parsing/grammar/expressions/atom.rs | |||
diff --git a/crates/ra_syntax/src/grammar/items.rs b/crates/ra_syntax/src/parsing/grammar/items.rs index 4b962c1f3..4b962c1f3 100644 --- a/crates/ra_syntax/src/grammar/items.rs +++ b/crates/ra_syntax/src/parsing/grammar/items.rs | |||
diff --git a/crates/ra_syntax/src/grammar/items/consts.rs b/crates/ra_syntax/src/parsing/grammar/items/consts.rs index 5a5852f83..5a5852f83 100644 --- a/crates/ra_syntax/src/grammar/items/consts.rs +++ b/crates/ra_syntax/src/parsing/grammar/items/consts.rs | |||
diff --git a/crates/ra_syntax/src/grammar/items/nominal.rs b/crates/ra_syntax/src/parsing/grammar/items/nominal.rs index ff9b38f9c..ff9b38f9c 100644 --- a/crates/ra_syntax/src/grammar/items/nominal.rs +++ b/crates/ra_syntax/src/parsing/grammar/items/nominal.rs | |||
diff --git a/crates/ra_syntax/src/grammar/items/traits.rs b/crates/ra_syntax/src/parsing/grammar/items/traits.rs index d5a8ccd98..d5a8ccd98 100644 --- a/crates/ra_syntax/src/grammar/items/traits.rs +++ b/crates/ra_syntax/src/parsing/grammar/items/traits.rs | |||
diff --git a/crates/ra_syntax/src/grammar/items/use_item.rs b/crates/ra_syntax/src/parsing/grammar/items/use_item.rs index 5111d37eb..5111d37eb 100644 --- a/crates/ra_syntax/src/grammar/items/use_item.rs +++ b/crates/ra_syntax/src/parsing/grammar/items/use_item.rs | |||
diff --git a/crates/ra_syntax/src/grammar/params.rs b/crates/ra_syntax/src/parsing/grammar/params.rs index 185386569..185386569 100644 --- a/crates/ra_syntax/src/grammar/params.rs +++ b/crates/ra_syntax/src/parsing/grammar/params.rs | |||
diff --git a/crates/ra_syntax/src/grammar/paths.rs b/crates/ra_syntax/src/parsing/grammar/paths.rs index 33a11886c..33a11886c 100644 --- a/crates/ra_syntax/src/grammar/paths.rs +++ b/crates/ra_syntax/src/parsing/grammar/paths.rs | |||
diff --git a/crates/ra_syntax/src/grammar/patterns.rs b/crates/ra_syntax/src/parsing/grammar/patterns.rs index 9d7da639d..9d7da639d 100644 --- a/crates/ra_syntax/src/grammar/patterns.rs +++ b/crates/ra_syntax/src/parsing/grammar/patterns.rs | |||
diff --git a/crates/ra_syntax/src/grammar/type_args.rs b/crates/ra_syntax/src/parsing/grammar/type_args.rs index f889419c5..f889419c5 100644 --- a/crates/ra_syntax/src/grammar/type_args.rs +++ b/crates/ra_syntax/src/parsing/grammar/type_args.rs | |||
diff --git a/crates/ra_syntax/src/grammar/type_params.rs b/crates/ra_syntax/src/parsing/grammar/type_params.rs index 40f998682..40f998682 100644 --- a/crates/ra_syntax/src/grammar/type_params.rs +++ b/crates/ra_syntax/src/parsing/grammar/type_params.rs | |||
diff --git a/crates/ra_syntax/src/grammar/types.rs b/crates/ra_syntax/src/parsing/grammar/types.rs index adc189a29..adc189a29 100644 --- a/crates/ra_syntax/src/grammar/types.rs +++ b/crates/ra_syntax/src/parsing/grammar/types.rs | |||
diff --git a/crates/ra_syntax/src/lexer.rs b/crates/ra_syntax/src/parsing/lexer.rs index f9362120e..f9362120e 100644 --- a/crates/ra_syntax/src/lexer.rs +++ b/crates/ra_syntax/src/parsing/lexer.rs | |||
diff --git a/crates/ra_syntax/src/lexer/classes.rs b/crates/ra_syntax/src/parsing/lexer/classes.rs index 4235d2648..4235d2648 100644 --- a/crates/ra_syntax/src/lexer/classes.rs +++ b/crates/ra_syntax/src/parsing/lexer/classes.rs | |||
diff --git a/crates/ra_syntax/src/lexer/comments.rs b/crates/ra_syntax/src/parsing/lexer/comments.rs index afe6886a1..8bbbe659b 100644 --- a/crates/ra_syntax/src/lexer/comments.rs +++ b/crates/ra_syntax/src/parsing/lexer/comments.rs | |||
@@ -1,4 +1,4 @@ | |||
1 | use crate::lexer::ptr::Ptr; | 1 | use crate::parsing::lexer::ptr::Ptr; |
2 | 2 | ||
3 | use crate::SyntaxKind::{self, *}; | 3 | use crate::SyntaxKind::{self, *}; |
4 | 4 | ||
diff --git a/crates/ra_syntax/src/lexer/numbers.rs b/crates/ra_syntax/src/parsing/lexer/numbers.rs index 46daf5e52..7f6abe1d5 100644 --- a/crates/ra_syntax/src/lexer/numbers.rs +++ b/crates/ra_syntax/src/parsing/lexer/numbers.rs | |||
@@ -1,5 +1,7 @@ | |||
1 | use crate::lexer::classes::*; | 1 | use crate::parsing::lexer::{ |
2 | use crate::lexer::ptr::Ptr; | 2 | ptr::Ptr, |
3 | classes::*, | ||
4 | }; | ||
3 | 5 | ||
4 | use crate::SyntaxKind::{self, *}; | 6 | use crate::SyntaxKind::{self, *}; |
5 | 7 | ||
diff --git a/crates/ra_syntax/src/lexer/ptr.rs b/crates/ra_syntax/src/parsing/lexer/ptr.rs index c341c4176..c341c4176 100644 --- a/crates/ra_syntax/src/lexer/ptr.rs +++ b/crates/ra_syntax/src/parsing/lexer/ptr.rs | |||
diff --git a/crates/ra_syntax/src/lexer/strings.rs b/crates/ra_syntax/src/parsing/lexer/strings.rs index 5c1cf3e9c..f74acff9e 100644 --- a/crates/ra_syntax/src/lexer/strings.rs +++ b/crates/ra_syntax/src/parsing/lexer/strings.rs | |||
@@ -1,6 +1,7 @@ | |||
1 | use crate::SyntaxKind::{self, *}; | 1 | use crate::{ |
2 | 2 | parsing::lexer::ptr::Ptr, | |
3 | use crate::lexer::ptr::Ptr; | 3 | SyntaxKind::{self, *}, |
4 | }; | ||
4 | 5 | ||
5 | pub(crate) fn is_string_literal_start(c: char, c1: Option<char>, c2: Option<char>) -> bool { | 6 | pub(crate) fn is_string_literal_start(c: char, c1: Option<char>, c2: Option<char>) -> bool { |
6 | match (c, c1, c2) { | 7 | match (c, c1, c2) { |
diff --git a/crates/ra_syntax/src/parser_api.rs b/crates/ra_syntax/src/parsing/parser_api.rs index dc556190d..781c407de 100644 --- a/crates/ra_syntax/src/parser_api.rs +++ b/crates/ra_syntax/src/parsing/parser_api.rs | |||
@@ -1,9 +1,11 @@ | |||
1 | use drop_bomb::DropBomb; | 1 | use drop_bomb::DropBomb; |
2 | 2 | ||
3 | use crate::{ | 3 | use crate::{ |
4 | parser_impl::ParserImpl, | ||
5 | token_set::TokenSet, | ||
6 | SyntaxKind::{self, ERROR}, | 4 | SyntaxKind::{self, ERROR}, |
5 | parsing::{ | ||
6 | token_set::TokenSet, | ||
7 | parser_impl::ParserImpl | ||
8 | }, | ||
7 | }; | 9 | }; |
8 | 10 | ||
9 | /// `Parser` struct provides the low-level API for | 11 | /// `Parser` struct provides the low-level API for |
diff --git a/crates/ra_syntax/src/parser_impl.rs b/crates/ra_syntax/src/parsing/parser_impl.rs index 01d156899..c639d83e8 100644 --- a/crates/ra_syntax/src/parser_impl.rs +++ b/crates/ra_syntax/src/parsing/parser_impl.rs | |||
@@ -4,18 +4,16 @@ mod input; | |||
4 | use std::cell::Cell; | 4 | use std::cell::Cell; |
5 | 5 | ||
6 | use crate::{ | 6 | use crate::{ |
7 | SmolStr, | ||
8 | syntax_node::syntax_error::{ParseError, SyntaxError}, | ||
9 | parsing::{ | ||
7 | lexer::Token, | 10 | lexer::Token, |
8 | parser_api::Parser, | 11 | parser_api::Parser, |
9 | parser_impl::{ | 12 | parser_impl::{ |
10 | event::{Event, EventProcessor}, | 13 | event::{Event, EventProcessor}, |
11 | input::{InputPosition, ParserInput}, | 14 | input::{InputPosition, ParserInput}, |
12 | }, | 15 | }, |
13 | SmolStr, | 16 | }}; |
14 | syntax_node::syntax_error::{ | ||
15 | ParseError, | ||
16 | SyntaxError, | ||
17 | }, | ||
18 | }; | ||
19 | 17 | ||
20 | use crate::SyntaxKind::{self, EOF, TOMBSTONE}; | 18 | use crate::SyntaxKind::{self, EOF, TOMBSTONE}; |
21 | 19 | ||
diff --git a/crates/ra_syntax/src/parser_impl/event.rs b/crates/ra_syntax/src/parsing/parser_impl/event.rs index b45830c61..fb43e19cc 100644 --- a/crates/ra_syntax/src/parser_impl/event.rs +++ b/crates/ra_syntax/src/parsing/parser_impl/event.rs | |||
@@ -7,9 +7,9 @@ | |||
7 | //! tree builder: the parser produces a stream of events like | 7 | //! tree builder: the parser produces a stream of events like |
8 | //! `start node`, `finish node`, and `FileBuilder` converts | 8 | //! `start node`, `finish node`, and `FileBuilder` converts |
9 | //! this stream to a real tree. | 9 | //! this stream to a real tree. |
10 | use std::mem; | ||
11 | |||
10 | use crate::{ | 12 | use crate::{ |
11 | lexer::Token, | ||
12 | parser_impl::Sink, | ||
13 | SmolStr, | 13 | SmolStr, |
14 | SyntaxKind::{self, *}, | 14 | SyntaxKind::{self, *}, |
15 | TextRange, TextUnit, | 15 | TextRange, TextUnit, |
@@ -18,8 +18,11 @@ use crate::{ | |||
18 | SyntaxError, | 18 | SyntaxError, |
19 | SyntaxErrorKind, | 19 | SyntaxErrorKind, |
20 | }, | 20 | }, |
21 | parsing::{ | ||
22 | lexer::Token, | ||
23 | parser_impl::Sink, | ||
24 | }, | ||
21 | }; | 25 | }; |
22 | use std::mem; | ||
23 | 26 | ||
24 | /// `Parser` produces a flat list of `Event`s. | 27 | /// `Parser` produces a flat list of `Event`s. |
25 | /// They are converted to a tree-structure in | 28 | /// They are converted to a tree-structure in |
diff --git a/crates/ra_syntax/src/parser_impl/input.rs b/crates/ra_syntax/src/parsing/parser_impl/input.rs index 616a26fdc..275d94918 100644 --- a/crates/ra_syntax/src/parser_impl/input.rs +++ b/crates/ra_syntax/src/parsing/parser_impl/input.rs | |||
@@ -1,4 +1,7 @@ | |||
1 | use crate::{lexer::Token, SyntaxKind, SyntaxKind::EOF, TextRange, TextUnit}; | 1 | use crate::{ |
2 | SyntaxKind, SyntaxKind::EOF, TextRange, TextUnit, | ||
3 | parsing::lexer::Token, | ||
4 | }; | ||
2 | 5 | ||
3 | use std::ops::{Add, AddAssign}; | 6 | use std::ops::{Add, AddAssign}; |
4 | 7 | ||
diff --git a/crates/ra_syntax/src/reparsing.rs b/crates/ra_syntax/src/parsing/reparsing.rs index dd751465c..994e7e212 100644 --- a/crates/ra_syntax/src/reparsing.rs +++ b/crates/ra_syntax/src/parsing/reparsing.rs | |||
@@ -1,10 +1,16 @@ | |||
1 | use crate::algo; | 1 | use crate::{ |
2 | use crate::grammar; | 2 | SyntaxKind::*, TextRange, TextUnit, |
3 | use crate::lexer::{tokenize, Token}; | 3 | algo, |
4 | use crate::parser_api::Parser; | 4 | syntax_node::{GreenNode, SyntaxError, SyntaxNode}, |
5 | use crate::parser_impl; | 5 | parsing::{ |
6 | use crate::syntax_node::{self, GreenNode, SyntaxError, SyntaxNode}; | 6 | grammar, |
7 | use crate::{SyntaxKind::*, TextRange, TextUnit}; | 7 | parser_impl, |
8 | builder::GreenBuilder, | ||
9 | parser_api::Parser, | ||
10 | lexer::{tokenize, Token}, | ||
11 | } | ||
12 | }; | ||
13 | |||
8 | use ra_text_edit::AtomTextEdit; | 14 | use ra_text_edit::AtomTextEdit; |
9 | 15 | ||
10 | pub(crate) fn incremental_reparse( | 16 | pub(crate) fn incremental_reparse( |
@@ -56,7 +62,7 @@ fn reparse_block<'node>( | |||
56 | return None; | 62 | return None; |
57 | } | 63 | } |
58 | let (green, new_errors) = | 64 | let (green, new_errors) = |
59 | parser_impl::parse_with(syntax_node::GreenBuilder::new(), &text, &tokens, reparser); | 65 | parser_impl::parse_with(GreenBuilder::new(), &text, &tokens, reparser); |
60 | Some((node, green, new_errors)) | 66 | Some((node, green, new_errors)) |
61 | } | 67 | } |
62 | 68 | ||
diff --git a/crates/ra_syntax/src/token_set.rs b/crates/ra_syntax/src/parsing/token_set.rs index b3fe633e0..5719fe5a2 100644 --- a/crates/ra_syntax/src/token_set.rs +++ b/crates/ra_syntax/src/parsing/token_set.rs | |||
@@ -4,19 +4,19 @@ use crate::SyntaxKind; | |||
4 | pub(crate) struct TokenSet(u128); | 4 | pub(crate) struct TokenSet(u128); |
5 | 5 | ||
6 | impl TokenSet { | 6 | impl TokenSet { |
7 | pub const fn empty() -> TokenSet { | 7 | pub(crate) const fn empty() -> TokenSet { |
8 | TokenSet(0) | 8 | TokenSet(0) |
9 | } | 9 | } |
10 | 10 | ||
11 | pub const fn singleton(kind: SyntaxKind) -> TokenSet { | 11 | pub(crate) const fn singleton(kind: SyntaxKind) -> TokenSet { |
12 | TokenSet(mask(kind)) | 12 | TokenSet(mask(kind)) |
13 | } | 13 | } |
14 | 14 | ||
15 | pub const fn union(self, other: TokenSet) -> TokenSet { | 15 | pub(crate) const fn union(self, other: TokenSet) -> TokenSet { |
16 | TokenSet(self.0 | other.0) | 16 | TokenSet(self.0 | other.0) |
17 | } | 17 | } |
18 | 18 | ||
19 | pub fn contains(&self, kind: SyntaxKind) -> bool { | 19 | pub(crate) fn contains(&self, kind: SyntaxKind) -> bool { |
20 | self.0 & mask(kind) != 0 | 20 | self.0 & mask(kind) != 0 |
21 | } | 21 | } |
22 | } | 22 | } |
diff --git a/crates/ra_syntax/src/syntax_node.rs b/crates/ra_syntax/src/syntax_node.rs index ed48739f8..a0d7c32ec 100644 --- a/crates/ra_syntax/src/syntax_node.rs +++ b/crates/ra_syntax/src/syntax_node.rs | |||
@@ -1,4 +1,3 @@ | |||
1 | mod builder; | ||
2 | pub mod syntax_error; | 1 | pub mod syntax_error; |
3 | mod syntax_text; | 2 | mod syntax_text; |
4 | 3 | ||
@@ -8,7 +7,6 @@ use self::syntax_text::SyntaxText; | |||
8 | use crate::{SmolStr, SyntaxKind, TextRange}; | 7 | use crate::{SmolStr, SyntaxKind, TextRange}; |
9 | use rowan::{Types, TransparentNewType}; | 8 | use rowan::{Types, TransparentNewType}; |
10 | 9 | ||
11 | pub(crate) use self::builder::GreenBuilder; | ||
12 | pub use self::syntax_error::{SyntaxError, SyntaxErrorKind, Location}; | 10 | pub use self::syntax_error::{SyntaxError, SyntaxErrorKind, Location}; |
13 | pub use rowan::WalkEvent; | 11 | pub use rowan::WalkEvent; |
14 | 12 | ||