diff options
author | Aleksey Kladov <[email protected]> | 2019-02-20 12:47:32 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-02-20 12:47:32 +0000 |
commit | 5222b8aba3b1c2c68706aacf6869423a8e4fe6d5 (patch) | |
tree | c8a6e999b8ac5f1f29bde86a2e0b3a53466bb369 /crates/ra_syntax/src/lib.rs | |
parent | 9d0cda4bc84350961f3884e75a1c20e62c449ede (diff) |
move all parsing related bits to a separate module
Diffstat (limited to 'crates/ra_syntax/src/lib.rs')
-rw-r--r-- | crates/ra_syntax/src/lib.rs | 16 |
1 files changed, 4 insertions, 12 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 | ||