aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src/parsing
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_syntax/src/parsing')
-rw-r--r--crates/ra_syntax/src/parsing/lexer.rs3
-rw-r--r--crates/ra_syntax/src/parsing/lexer/numbers.rs5
-rw-r--r--crates/ra_syntax/src/parsing/reparsing.rs15
-rw-r--r--crates/ra_syntax/src/parsing/text_token_source.rs7
-rw-r--r--crates/ra_syntax/src/parsing/text_tree_sink.rs7
5 files changed, 16 insertions, 21 deletions
diff --git a/crates/ra_syntax/src/parsing/lexer.rs b/crates/ra_syntax/src/parsing/lexer.rs
index 6eb96f03d..60cf37047 100644
--- a/crates/ra_syntax/src/parsing/lexer.rs
+++ b/crates/ra_syntax/src/parsing/lexer.rs
@@ -6,8 +6,7 @@ mod strings;
6 6
7use crate::{ 7use crate::{
8 SyntaxKind::{self, *}, 8 SyntaxKind::{self, *},
9 TextUnit, 9 TextUnit, T,
10 T,
11}; 10};
12 11
13use self::{ 12use self::{
diff --git a/crates/ra_syntax/src/parsing/lexer/numbers.rs b/crates/ra_syntax/src/parsing/lexer/numbers.rs
index 874fb8b32..e53ae231b 100644
--- a/crates/ra_syntax/src/parsing/lexer/numbers.rs
+++ b/crates/ra_syntax/src/parsing/lexer/numbers.rs
@@ -1,7 +1,4 @@
1use crate::parsing::lexer::{ 1use crate::parsing::lexer::{classes::*, ptr::Ptr};
2 ptr::Ptr,
3 classes::*,
4};
5 2
6use crate::SyntaxKind::{self, *}; 3use crate::SyntaxKind::{self, *};
7 4
diff --git a/crates/ra_syntax/src/parsing/reparsing.rs b/crates/ra_syntax/src/parsing/reparsing.rs
index cf27a3393..eeca94020 100644
--- a/crates/ra_syntax/src/parsing/reparsing.rs
+++ b/crates/ra_syntax/src/parsing/reparsing.rs
@@ -6,19 +6,20 @@
6//! - otherwise, we search for the nearest `{}` block which contains the edit 6//! - otherwise, we search for the nearest `{}` block which contains the edit
7//! and try to parse only this block. 7//! and try to parse only this block.
8 8
9use ra_text_edit::AtomTextEdit;
10use ra_parser::Reparser; 9use ra_parser::Reparser;
10use ra_text_edit::AtomTextEdit;
11 11
12use crate::{ 12use crate::{
13 SyntaxKind::*, TextRange, TextUnit, SyntaxError,
14 algo, 13 algo,
15 syntax_node::{GreenNode, SyntaxNode, GreenToken, SyntaxElement},
16 parsing::{ 14 parsing::{
15 lexer::{tokenize, Token},
17 text_token_source::TextTokenSource, 16 text_token_source::TextTokenSource,
18 text_tree_sink::TextTreeSink, 17 text_tree_sink::TextTreeSink,
19 lexer::{tokenize, Token},
20 }, 18 },
21 T, 19 syntax_node::{GreenNode, GreenToken, SyntaxElement, SyntaxNode},
20 SyntaxError,
21 SyntaxKind::*,
22 TextRange, TextUnit, T,
22}; 23};
23 24
24pub(crate) fn incremental_reparse( 25pub(crate) fn incremental_reparse(
@@ -168,10 +169,10 @@ fn merge_errors(
168mod tests { 169mod tests {
169 use std::sync::Arc; 170 use std::sync::Arc;
170 171
171 use test_utils::{extract_range, assert_eq_text}; 172 use test_utils::{assert_eq_text, extract_range};
172 173
173 use crate::{SourceFile, AstNode, Parse};
174 use super::*; 174 use super::*;
175 use crate::{AstNode, Parse, SourceFile};
175 176
176 fn do_check(before: &str, replace_with: &str, reparsed_len: u32) { 177 fn do_check(before: &str, replace_with: &str, reparsed_len: u32) {
177 let (range, before) = extract_range(before); 178 let (range, before) = extract_range(before);
diff --git a/crates/ra_syntax/src/parsing/text_token_source.rs b/crates/ra_syntax/src/parsing/text_token_source.rs
index 71d2947f7..f592b499f 100644
--- a/crates/ra_syntax/src/parsing/text_token_source.rs
+++ b/crates/ra_syntax/src/parsing/text_token_source.rs
@@ -1,10 +1,7 @@
1use ra_parser::TokenSource;
2use ra_parser::Token as PToken; 1use ra_parser::Token as PToken;
2use ra_parser::TokenSource;
3 3
4use crate::{ 4use crate::{parsing::lexer::Token, SyntaxKind::EOF, TextRange, TextUnit};
5 SyntaxKind::EOF, TextRange, TextUnit,
6 parsing::lexer::Token,
7};
8 5
9pub(crate) struct TextTokenSource<'t> { 6pub(crate) struct TextTokenSource<'t> {
10 text: &'t str, 7 text: &'t str,
diff --git a/crates/ra_syntax/src/parsing/text_tree_sink.rs b/crates/ra_syntax/src/parsing/text_tree_sink.rs
index 71fc515f2..bf1b35c95 100644
--- a/crates/ra_syntax/src/parsing/text_tree_sink.rs
+++ b/crates/ra_syntax/src/parsing/text_tree_sink.rs
@@ -1,12 +1,13 @@
1use std::mem; 1use std::mem;
2 2
3use ra_parser::{TreeSink, ParseError}; 3use ra_parser::{ParseError, TreeSink};
4 4
5use crate::{ 5use crate::{
6 SmolStr, SyntaxError, TextUnit, TextRange, SyntaxTreeBuilder,
7 SyntaxKind::{self, *},
8 parsing::Token, 6 parsing::Token,
9 syntax_node::GreenNode, 7 syntax_node::GreenNode,
8 SmolStr, SyntaxError,
9 SyntaxKind::{self, *},
10 SyntaxTreeBuilder, TextRange, TextUnit,
10}; 11};
11 12
12/// Bridges the parser with our specific syntax tree representation. 13/// Bridges the parser with our specific syntax tree representation.