aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/parser/Cargo.toml (renamed from crates/ra_parser/Cargo.toml)9
-rw-r--r--crates/parser/src/event.rs (renamed from crates/ra_parser/src/event.rs)0
-rw-r--r--crates/parser/src/grammar.rs (renamed from crates/ra_parser/src/grammar.rs)0
-rw-r--r--crates/parser/src/grammar/attributes.rs (renamed from crates/ra_parser/src/grammar/attributes.rs)0
-rw-r--r--crates/parser/src/grammar/expressions.rs (renamed from crates/ra_parser/src/grammar/expressions.rs)0
-rw-r--r--crates/parser/src/grammar/expressions/atom.rs (renamed from crates/ra_parser/src/grammar/expressions/atom.rs)0
-rw-r--r--crates/parser/src/grammar/items.rs (renamed from crates/ra_parser/src/grammar/items.rs)0
-rw-r--r--crates/parser/src/grammar/items/adt.rs (renamed from crates/ra_parser/src/grammar/items/adt.rs)0
-rw-r--r--crates/parser/src/grammar/items/consts.rs (renamed from crates/ra_parser/src/grammar/items/consts.rs)0
-rw-r--r--crates/parser/src/grammar/items/traits.rs (renamed from crates/ra_parser/src/grammar/items/traits.rs)0
-rw-r--r--crates/parser/src/grammar/items/use_item.rs (renamed from crates/ra_parser/src/grammar/items/use_item.rs)0
-rw-r--r--crates/parser/src/grammar/params.rs (renamed from crates/ra_parser/src/grammar/params.rs)0
-rw-r--r--crates/parser/src/grammar/paths.rs (renamed from crates/ra_parser/src/grammar/paths.rs)0
-rw-r--r--crates/parser/src/grammar/patterns.rs (renamed from crates/ra_parser/src/grammar/patterns.rs)0
-rw-r--r--crates/parser/src/grammar/type_args.rs (renamed from crates/ra_parser/src/grammar/type_args.rs)0
-rw-r--r--crates/parser/src/grammar/type_params.rs (renamed from crates/ra_parser/src/grammar/type_params.rs)0
-rw-r--r--crates/parser/src/grammar/types.rs (renamed from crates/ra_parser/src/grammar/types.rs)0
-rw-r--r--crates/parser/src/lib.rs (renamed from crates/ra_parser/src/lib.rs)0
-rw-r--r--crates/parser/src/parser.rs (renamed from crates/ra_parser/src/parser.rs)0
-rw-r--r--crates/parser/src/syntax_kind.rs (renamed from crates/ra_parser/src/syntax_kind.rs)0
-rw-r--r--crates/parser/src/syntax_kind/generated.rs (renamed from crates/ra_parser/src/syntax_kind/generated.rs)0
-rw-r--r--crates/parser/src/token_set.rs (renamed from crates/ra_parser/src/token_set.rs)0
-rw-r--r--crates/ra_hir_expand/Cargo.toml2
-rw-r--r--crates/ra_hir_expand/src/builtin_derive.rs2
-rw-r--r--crates/ra_hir_expand/src/builtin_macro.rs2
-rw-r--r--crates/ra_hir_expand/src/db.rs2
-rw-r--r--crates/ra_hir_expand/src/eager.rs2
-rw-r--r--crates/ra_hir_expand/src/lib.rs2
-rw-r--r--crates/ra_mbe/Cargo.toml2
-rw-r--r--crates/ra_mbe/src/mbe_expander/matcher.rs8
-rw-r--r--crates/ra_mbe/src/subtree_source.rs2
-rw-r--r--crates/ra_mbe/src/syntax_bridge.rs6
-rw-r--r--crates/ra_mbe/src/tests.rs5
-rw-r--r--crates/ra_syntax/Cargo.toml2
-rw-r--r--crates/ra_syntax/src/ast/node_ext.rs2
-rw-r--r--crates/ra_syntax/src/lib.rs14
-rw-r--r--crates/ra_syntax/src/parsing.rs14
-rw-r--r--crates/ra_syntax/src/parsing/reparsing.rs2
-rw-r--r--crates/ra_syntax/src/parsing/text_token_source.rs14
-rw-r--r--crates/ra_syntax/src/parsing/text_tree_sink.rs2
-rw-r--r--crates/ra_syntax/src/syntax_node.rs2
41 files changed, 48 insertions, 48 deletions
diff --git a/crates/ra_parser/Cargo.toml b/crates/parser/Cargo.toml
index 72ec3e4d9..358be92d1 100644
--- a/crates/ra_parser/Cargo.toml
+++ b/crates/parser/Cargo.toml
@@ -1,10 +1,9 @@
1[package] 1[package]
2edition = "2018" 2name = "parser"
3name = "ra_parser" 3version = "0.0.0"
4version = "0.1.0"
5authors = ["rust-analyzer developers"]
6publish = false
7license = "MIT OR Apache-2.0" 4license = "MIT OR Apache-2.0"
5authors = ["rust-analyzer developers"]
6edition = "2018"
8 7
9[lib] 8[lib]
10doctest = false 9doctest = false
diff --git a/crates/ra_parser/src/event.rs b/crates/parser/src/event.rs
index a7d06a815..a7d06a815 100644
--- a/crates/ra_parser/src/event.rs
+++ b/crates/parser/src/event.rs
diff --git a/crates/ra_parser/src/grammar.rs b/crates/parser/src/grammar.rs
index 88468bc97..88468bc97 100644
--- a/crates/ra_parser/src/grammar.rs
+++ b/crates/parser/src/grammar.rs
diff --git a/crates/ra_parser/src/grammar/attributes.rs b/crates/parser/src/grammar/attributes.rs
index f3158ade3..f3158ade3 100644
--- a/crates/ra_parser/src/grammar/attributes.rs
+++ b/crates/parser/src/grammar/attributes.rs
diff --git a/crates/ra_parser/src/grammar/expressions.rs b/crates/parser/src/grammar/expressions.rs
index 3291e3f14..3291e3f14 100644
--- a/crates/ra_parser/src/grammar/expressions.rs
+++ b/crates/parser/src/grammar/expressions.rs
diff --git a/crates/ra_parser/src/grammar/expressions/atom.rs b/crates/parser/src/grammar/expressions/atom.rs
index 0b01d3bc6..0b01d3bc6 100644
--- a/crates/ra_parser/src/grammar/expressions/atom.rs
+++ b/crates/parser/src/grammar/expressions/atom.rs
diff --git a/crates/ra_parser/src/grammar/items.rs b/crates/parser/src/grammar/items.rs
index d091b0fbb..d091b0fbb 100644
--- a/crates/ra_parser/src/grammar/items.rs
+++ b/crates/parser/src/grammar/items.rs
diff --git a/crates/ra_parser/src/grammar/items/adt.rs b/crates/parser/src/grammar/items/adt.rs
index addfb59d4..addfb59d4 100644
--- a/crates/ra_parser/src/grammar/items/adt.rs
+++ b/crates/parser/src/grammar/items/adt.rs
diff --git a/crates/ra_parser/src/grammar/items/consts.rs b/crates/parser/src/grammar/items/consts.rs
index 35ad766dc..35ad766dc 100644
--- a/crates/ra_parser/src/grammar/items/consts.rs
+++ b/crates/parser/src/grammar/items/consts.rs
diff --git a/crates/ra_parser/src/grammar/items/traits.rs b/crates/parser/src/grammar/items/traits.rs
index 751ce65f2..751ce65f2 100644
--- a/crates/ra_parser/src/grammar/items/traits.rs
+++ b/crates/parser/src/grammar/items/traits.rs
diff --git a/crates/ra_parser/src/grammar/items/use_item.rs b/crates/parser/src/grammar/items/use_item.rs
index 8e836a77e..8e836a77e 100644
--- a/crates/ra_parser/src/grammar/items/use_item.rs
+++ b/crates/parser/src/grammar/items/use_item.rs
diff --git a/crates/ra_parser/src/grammar/params.rs b/crates/parser/src/grammar/params.rs
index f0da173cc..f0da173cc 100644
--- a/crates/ra_parser/src/grammar/params.rs
+++ b/crates/parser/src/grammar/params.rs
diff --git a/crates/ra_parser/src/grammar/paths.rs b/crates/parser/src/grammar/paths.rs
index b503af1dc..b503af1dc 100644
--- a/crates/ra_parser/src/grammar/paths.rs
+++ b/crates/parser/src/grammar/paths.rs
diff --git a/crates/ra_parser/src/grammar/patterns.rs b/crates/parser/src/grammar/patterns.rs
index 716bdc978..716bdc978 100644
--- a/crates/ra_parser/src/grammar/patterns.rs
+++ b/crates/parser/src/grammar/patterns.rs
diff --git a/crates/ra_parser/src/grammar/type_args.rs b/crates/parser/src/grammar/type_args.rs
index aef7cd6fb..aef7cd6fb 100644
--- a/crates/ra_parser/src/grammar/type_args.rs
+++ b/crates/parser/src/grammar/type_args.rs
diff --git a/crates/ra_parser/src/grammar/type_params.rs b/crates/parser/src/grammar/type_params.rs
index 90dabb4c0..90dabb4c0 100644
--- a/crates/ra_parser/src/grammar/type_params.rs
+++ b/crates/parser/src/grammar/type_params.rs
diff --git a/crates/ra_parser/src/grammar/types.rs b/crates/parser/src/grammar/types.rs
index 0aa173a52..0aa173a52 100644
--- a/crates/ra_parser/src/grammar/types.rs
+++ b/crates/parser/src/grammar/types.rs
diff --git a/crates/ra_parser/src/lib.rs b/crates/parser/src/lib.rs
index eeb8ad66b..eeb8ad66b 100644
--- a/crates/ra_parser/src/lib.rs
+++ b/crates/parser/src/lib.rs
diff --git a/crates/ra_parser/src/parser.rs b/crates/parser/src/parser.rs
index d2487acc3..d2487acc3 100644
--- a/crates/ra_parser/src/parser.rs
+++ b/crates/parser/src/parser.rs
diff --git a/crates/ra_parser/src/syntax_kind.rs b/crates/parser/src/syntax_kind.rs
index 63204436c..63204436c 100644
--- a/crates/ra_parser/src/syntax_kind.rs
+++ b/crates/parser/src/syntax_kind.rs
diff --git a/crates/ra_parser/src/syntax_kind/generated.rs b/crates/parser/src/syntax_kind/generated.rs
index 192ecd864..192ecd864 100644
--- a/crates/ra_parser/src/syntax_kind/generated.rs
+++ b/crates/parser/src/syntax_kind/generated.rs
diff --git a/crates/ra_parser/src/token_set.rs b/crates/parser/src/token_set.rs
index 994017acf..994017acf 100644
--- a/crates/ra_parser/src/token_set.rs
+++ b/crates/parser/src/token_set.rs
diff --git a/crates/ra_hir_expand/Cargo.toml b/crates/ra_hir_expand/Cargo.toml
index 7d8ccd56f..052330fde 100644
--- a/crates/ra_hir_expand/Cargo.toml
+++ b/crates/ra_hir_expand/Cargo.toml
@@ -16,7 +16,7 @@ rustc-hash = "1.0.0"
16arena = { path = "../arena" } 16arena = { path = "../arena" }
17ra_db = { path = "../ra_db" } 17ra_db = { path = "../ra_db" }
18ra_syntax = { path = "../ra_syntax" } 18ra_syntax = { path = "../ra_syntax" }
19ra_parser = { path = "../ra_parser" } 19parser = { path = "../parser" }
20profile = { path = "../profile" } 20profile = { path = "../profile" }
21tt = { path = "../tt" } 21tt = { path = "../tt" }
22mbe = { path = "../ra_mbe", package = "ra_mbe" } 22mbe = { path = "../ra_mbe", package = "ra_mbe" }
diff --git a/crates/ra_hir_expand/src/builtin_derive.rs b/crates/ra_hir_expand/src/builtin_derive.rs
index 69fa907cb..95e6977f2 100644
--- a/crates/ra_hir_expand/src/builtin_derive.rs
+++ b/crates/ra_hir_expand/src/builtin_derive.rs
@@ -2,7 +2,7 @@
2 2
3use log::debug; 3use log::debug;
4 4
5use ra_parser::FragmentKind; 5use parser::FragmentKind;
6use ra_syntax::{ 6use ra_syntax::{
7 ast::{self, AstNode, GenericParamsOwner, ModuleItemOwner, NameOwner}, 7 ast::{self, AstNode, GenericParamsOwner, ModuleItemOwner, NameOwner},
8 match_ast, 8 match_ast,
diff --git a/crates/ra_hir_expand/src/builtin_macro.rs b/crates/ra_hir_expand/src/builtin_macro.rs
index 9f50569dc..24dc0b4e7 100644
--- a/crates/ra_hir_expand/src/builtin_macro.rs
+++ b/crates/ra_hir_expand/src/builtin_macro.rs
@@ -6,8 +6,8 @@ use crate::{
6 6
7use either::Either; 7use either::Either;
8use mbe::parse_to_token_tree; 8use mbe::parse_to_token_tree;
9use parser::FragmentKind;
9use ra_db::FileId; 10use ra_db::FileId;
10use ra_parser::FragmentKind;
11use ra_syntax::ast::{self, AstToken, HasStringValue}; 11use ra_syntax::ast::{self, AstToken, HasStringValue};
12 12
13macro_rules! register_builtin { 13macro_rules! register_builtin {
diff --git a/crates/ra_hir_expand/src/db.rs b/crates/ra_hir_expand/src/db.rs
index f30528b3e..d83c391a9 100644
--- a/crates/ra_hir_expand/src/db.rs
+++ b/crates/ra_hir_expand/src/db.rs
@@ -3,8 +3,8 @@
3use std::sync::Arc; 3use std::sync::Arc;
4 4
5use mbe::{ExpandResult, MacroRules}; 5use mbe::{ExpandResult, MacroRules};
6use parser::FragmentKind;
6use ra_db::{salsa, SourceDatabase}; 7use ra_db::{salsa, SourceDatabase};
7use ra_parser::FragmentKind;
8use ra_syntax::{algo::diff, AstNode, GreenNode, Parse, SyntaxKind::*, SyntaxNode}; 8use ra_syntax::{algo::diff, AstNode, GreenNode, Parse, SyntaxKind::*, SyntaxNode};
9 9
10use crate::{ 10use crate::{
diff --git a/crates/ra_hir_expand/src/eager.rs b/crates/ra_hir_expand/src/eager.rs
index 302d2b3e0..dc83044ea 100644
--- a/crates/ra_hir_expand/src/eager.rs
+++ b/crates/ra_hir_expand/src/eager.rs
@@ -25,8 +25,8 @@ use crate::{
25 EagerCallLoc, EagerMacroId, InFile, MacroCallId, MacroCallKind, MacroDefId, MacroDefKind, 25 EagerCallLoc, EagerMacroId, InFile, MacroCallId, MacroCallKind, MacroDefId, MacroDefKind,
26}; 26};
27 27
28use parser::FragmentKind;
28use ra_db::CrateId; 29use ra_db::CrateId;
29use ra_parser::FragmentKind;
30use ra_syntax::{algo::SyntaxRewriter, SyntaxNode}; 30use ra_syntax::{algo::SyntaxRewriter, SyntaxNode};
31use std::sync::Arc; 31use std::sync::Arc;
32 32
diff --git a/crates/ra_hir_expand/src/lib.rs b/crates/ra_hir_expand/src/lib.rs
index 8bb735fc6..38f0ffff8 100644
--- a/crates/ra_hir_expand/src/lib.rs
+++ b/crates/ra_hir_expand/src/lib.rs
@@ -317,7 +317,7 @@ pub struct ExpansionInfo {
317} 317}
318 318
319pub use mbe::Origin; 319pub use mbe::Origin;
320use ra_parser::FragmentKind; 320use parser::FragmentKind;
321 321
322impl ExpansionInfo { 322impl ExpansionInfo {
323 pub fn call_node(&self) -> Option<InFile<SyntaxNode>> { 323 pub fn call_node(&self) -> Option<InFile<SyntaxNode>> {
diff --git a/crates/ra_mbe/Cargo.toml b/crates/ra_mbe/Cargo.toml
index 23315910c..e518f73e3 100644
--- a/crates/ra_mbe/Cargo.toml
+++ b/crates/ra_mbe/Cargo.toml
@@ -10,7 +10,7 @@ doctest = false
10 10
11[dependencies] 11[dependencies]
12ra_syntax = { path = "../ra_syntax" } 12ra_syntax = { path = "../ra_syntax" }
13ra_parser = { path = "../ra_parser" } 13parser = { path = "../parser" }
14tt = { path = "../tt" } 14tt = { path = "../tt" }
15rustc-hash = "1.1.0" 15rustc-hash = "1.1.0"
16smallvec = "1.2.0" 16smallvec = "1.2.0"
diff --git a/crates/ra_mbe/src/mbe_expander/matcher.rs b/crates/ra_mbe/src/mbe_expander/matcher.rs
index 933a3a3b5..c752804b2 100644
--- a/crates/ra_mbe/src/mbe_expander/matcher.rs
+++ b/crates/ra_mbe/src/mbe_expander/matcher.rs
@@ -9,7 +9,7 @@ use crate::{
9}; 9};
10 10
11use super::ExpandResult; 11use super::ExpandResult;
12use ra_parser::{FragmentKind::*, TreeSink}; 12use parser::{FragmentKind::*, TreeSink};
13use ra_syntax::{SmolStr, SyntaxKind}; 13use ra_syntax::{SmolStr, SyntaxKind};
14use tt::buffer::{Cursor, TokenBuffer}; 14use tt::buffer::{Cursor, TokenBuffer};
15 15
@@ -285,7 +285,7 @@ impl<'a> TtIter<'a> {
285 285
286 pub(crate) fn expect_fragment( 286 pub(crate) fn expect_fragment(
287 &mut self, 287 &mut self,
288 fragment_kind: ra_parser::FragmentKind, 288 fragment_kind: parser::FragmentKind,
289 ) -> ExpandResult<Option<tt::TokenTree>> { 289 ) -> ExpandResult<Option<tt::TokenTree>> {
290 pub(crate) struct OffsetTokenSink<'a> { 290 pub(crate) struct OffsetTokenSink<'a> {
291 pub(crate) cursor: Cursor<'a>, 291 pub(crate) cursor: Cursor<'a>,
@@ -303,7 +303,7 @@ impl<'a> TtIter<'a> {
303 } 303 }
304 fn start_node(&mut self, _kind: SyntaxKind) {} 304 fn start_node(&mut self, _kind: SyntaxKind) {}
305 fn finish_node(&mut self) {} 305 fn finish_node(&mut self) {}
306 fn error(&mut self, _error: ra_parser::ParseError) { 306 fn error(&mut self, _error: parser::ParseError) {
307 self.error = true; 307 self.error = true;
308 } 308 }
309 } 309 }
@@ -312,7 +312,7 @@ impl<'a> TtIter<'a> {
312 let mut src = SubtreeTokenSource::new(&buffer); 312 let mut src = SubtreeTokenSource::new(&buffer);
313 let mut sink = OffsetTokenSink { cursor: buffer.begin(), error: false }; 313 let mut sink = OffsetTokenSink { cursor: buffer.begin(), error: false };
314 314
315 ra_parser::parse_fragment(&mut src, &mut sink, fragment_kind); 315 parser::parse_fragment(&mut src, &mut sink, fragment_kind);
316 316
317 let mut err = None; 317 let mut err = None;
318 if !sink.cursor.is_root() || sink.error { 318 if !sink.cursor.is_root() || sink.error {
diff --git a/crates/ra_mbe/src/subtree_source.rs b/crates/ra_mbe/src/subtree_source.rs
index d7866452d..1a1cb08cf 100644
--- a/crates/ra_mbe/src/subtree_source.rs
+++ b/crates/ra_mbe/src/subtree_source.rs
@@ -1,6 +1,6 @@
1//! FIXME: write short doc here 1//! FIXME: write short doc here
2 2
3use ra_parser::{Token, TokenSource}; 3use parser::{Token, TokenSource};
4use ra_syntax::{lex_single_syntax_kind, SmolStr, SyntaxKind, SyntaxKind::*, T}; 4use ra_syntax::{lex_single_syntax_kind, SmolStr, SyntaxKind, SyntaxKind::*, T};
5use std::cell::{Cell, Ref, RefCell}; 5use std::cell::{Cell, Ref, RefCell};
6use tt::buffer::{Cursor, TokenBuffer}; 6use tt::buffer::{Cursor, TokenBuffer};
diff --git a/crates/ra_mbe/src/syntax_bridge.rs b/crates/ra_mbe/src/syntax_bridge.rs
index 5fc48507f..7b9c88ae6 100644
--- a/crates/ra_mbe/src/syntax_bridge.rs
+++ b/crates/ra_mbe/src/syntax_bridge.rs
@@ -1,6 +1,6 @@
1//! FIXME: write short doc here 1//! FIXME: write short doc here
2 2
3use ra_parser::{FragmentKind, ParseError, TreeSink}; 3use parser::{FragmentKind, ParseError, TreeSink};
4use ra_syntax::{ 4use ra_syntax::{
5 ast::{self, make::tokens::doc_comment}, 5 ast::{self, make::tokens::doc_comment},
6 tokenize, AstToken, Parse, SmolStr, SyntaxKind, 6 tokenize, AstToken, Parse, SmolStr, SyntaxKind,
@@ -81,7 +81,7 @@ pub fn token_tree_to_syntax_node(
81 let buffer = TokenBuffer::new(&tokens); 81 let buffer = TokenBuffer::new(&tokens);
82 let mut token_source = SubtreeTokenSource::new(&buffer); 82 let mut token_source = SubtreeTokenSource::new(&buffer);
83 let mut tree_sink = TtTreeSink::new(buffer.begin()); 83 let mut tree_sink = TtTreeSink::new(buffer.begin());
84 ra_parser::parse_fragment(&mut token_source, &mut tree_sink, fragment_kind); 84 parser::parse_fragment(&mut token_source, &mut tree_sink, fragment_kind);
85 if tree_sink.roots.len() != 1 { 85 if tree_sink.roots.len() != 1 {
86 return Err(ExpandError::ConversionError); 86 return Err(ExpandError::ConversionError);
87 } 87 }
@@ -715,7 +715,7 @@ impl<'a> TreeSink for TtTreeSink<'a> {
715mod tests { 715mod tests {
716 use super::*; 716 use super::*;
717 use crate::tests::parse_macro; 717 use crate::tests::parse_macro;
718 use ra_parser::TokenSource; 718 use parser::TokenSource;
719 use ra_syntax::{ 719 use ra_syntax::{
720 algo::{insert_children, InsertPosition}, 720 algo::{insert_children, InsertPosition},
721 ast::AstNode, 721 ast::AstNode,
diff --git a/crates/ra_mbe/src/tests.rs b/crates/ra_mbe/src/tests.rs
index 286983d60..be39b0e45 100644
--- a/crates/ra_mbe/src/tests.rs
+++ b/crates/ra_mbe/src/tests.rs
@@ -1,6 +1,6 @@
1use std::fmt::Write; 1use std::fmt::Write;
2 2
3use ra_parser::FragmentKind; 3use ::parser::FragmentKind;
4use ra_syntax::{ast, AstNode, NodeOrToken, SyntaxKind::IDENT, SyntaxNode, WalkEvent, T}; 4use ra_syntax::{ast, AstNode, NodeOrToken, SyntaxKind::IDENT, SyntaxNode, WalkEvent, T};
5use test_utils::assert_eq_text; 5use test_utils::assert_eq_text;
6 6
@@ -9,9 +9,10 @@ use super::*;
9mod rule_parsing { 9mod rule_parsing {
10 use ra_syntax::{ast, AstNode}; 10 use ra_syntax::{ast, AstNode};
11 11
12 use super::*;
13 use crate::ast_to_token_tree; 12 use crate::ast_to_token_tree;
14 13
14 use super::*;
15
15 #[test] 16 #[test]
16 fn test_valid_arms() { 17 fn test_valid_arms() {
17 fn check(macro_body: &str) { 18 fn check(macro_body: &str) {
diff --git a/crates/ra_syntax/Cargo.toml b/crates/ra_syntax/Cargo.toml
index f2789e6a3..eec4bd845 100644
--- a/crates/ra_syntax/Cargo.toml
+++ b/crates/ra_syntax/Cargo.toml
@@ -21,7 +21,7 @@ once_cell = "1.3.1"
21stdx = { path = "../stdx" } 21stdx = { path = "../stdx" }
22 22
23text_edit = { path = "../text_edit" } 23text_edit = { path = "../text_edit" }
24ra_parser = { path = "../ra_parser" } 24parser = { path = "../parser" }
25 25
26# This crate transitively depends on `smol_str` via `rowan`. 26# This crate transitively depends on `smol_str` via `rowan`.
27# ideally, `serde` should be enabled by `rust-analyzer`, but we enable it here 27# ideally, `serde` should be enabled by `rust-analyzer`, but we enable it here
diff --git a/crates/ra_syntax/src/ast/node_ext.rs b/crates/ra_syntax/src/ast/node_ext.rs
index 733e97877..50c1c157d 100644
--- a/crates/ra_syntax/src/ast/node_ext.rs
+++ b/crates/ra_syntax/src/ast/node_ext.rs
@@ -4,7 +4,7 @@
4use std::fmt; 4use std::fmt;
5 5
6use itertools::Itertools; 6use itertools::Itertools;
7use ra_parser::SyntaxKind; 7use parser::SyntaxKind;
8 8
9use crate::{ 9use crate::{
10 ast::{self, support, AstNode, NameOwner, SyntaxNode}, 10 ast::{self, support, AstNode, NameOwner, SyntaxNode},
diff --git a/crates/ra_syntax/src/lib.rs b/crates/ra_syntax/src/lib.rs
index 465607f55..7f8da66af 100644
--- a/crates/ra_syntax/src/lib.rs
+++ b/crates/ra_syntax/src/lib.rs
@@ -11,7 +11,7 @@
11//! 11//!
12//! The most interesting modules here are `syntax_node` (which defines concrete 12//! The most interesting modules here are `syntax_node` (which defines concrete
13//! syntax tree) and `ast` (which defines abstract syntax tree on top of the 13//! syntax tree) and `ast` (which defines abstract syntax tree on top of the
14//! CST). The actual parser live in a separate `ra_parser` crate, though the 14//! CST). The actual parser live in a separate `parser` crate, though the
15//! lexer lives in this crate. 15//! lexer lives in this crate.
16//! 16//!
17//! See `api_walkthrough` test in this file for a quick API tour! 17//! See `api_walkthrough` test in this file for a quick API tour!
@@ -53,7 +53,7 @@ pub use crate::{
53 SyntaxNodeChildren, SyntaxToken, SyntaxTreeBuilder, 53 SyntaxNodeChildren, SyntaxToken, SyntaxTreeBuilder,
54 }, 54 },
55}; 55};
56pub use ra_parser::{SyntaxKind, T}; 56pub use parser::{SyntaxKind, T};
57pub use rowan::{SmolStr, SyntaxText, TextRange, TextSize, TokenAtOffset, WalkEvent}; 57pub use rowan::{SmolStr, SyntaxText, TextRange, TextSize, TokenAtOffset, WalkEvent};
58 58
59/// `Parse` is the result of the parsing: a syntax tree and a collection of 59/// `Parse` is the result of the parsing: a syntax tree and a collection of
@@ -169,35 +169,35 @@ impl SourceFile {
169impl ast::Path { 169impl ast::Path {
170 /// Returns `text`, parsed as a path, but only if it has no errors. 170 /// Returns `text`, parsed as a path, but only if it has no errors.
171 pub fn parse(text: &str) -> Result<Self, ()> { 171 pub fn parse(text: &str) -> Result<Self, ()> {
172 parsing::parse_text_fragment(text, ra_parser::FragmentKind::Path) 172 parsing::parse_text_fragment(text, parser::FragmentKind::Path)
173 } 173 }
174} 174}
175 175
176impl ast::Pat { 176impl ast::Pat {
177 /// Returns `text`, parsed as a pattern, but only if it has no errors. 177 /// Returns `text`, parsed as a pattern, but only if it has no errors.
178 pub fn parse(text: &str) -> Result<Self, ()> { 178 pub fn parse(text: &str) -> Result<Self, ()> {
179 parsing::parse_text_fragment(text, ra_parser::FragmentKind::Pattern) 179 parsing::parse_text_fragment(text, parser::FragmentKind::Pattern)
180 } 180 }
181} 181}
182 182
183impl ast::Expr { 183impl ast::Expr {
184 /// Returns `text`, parsed as an expression, but only if it has no errors. 184 /// Returns `text`, parsed as an expression, but only if it has no errors.
185 pub fn parse(text: &str) -> Result<Self, ()> { 185 pub fn parse(text: &str) -> Result<Self, ()> {
186 parsing::parse_text_fragment(text, ra_parser::FragmentKind::Expr) 186 parsing::parse_text_fragment(text, parser::FragmentKind::Expr)
187 } 187 }
188} 188}
189 189
190impl ast::Item { 190impl ast::Item {
191 /// Returns `text`, parsed as an item, but only if it has no errors. 191 /// Returns `text`, parsed as an item, but only if it has no errors.
192 pub fn parse(text: &str) -> Result<Self, ()> { 192 pub fn parse(text: &str) -> Result<Self, ()> {
193 parsing::parse_text_fragment(text, ra_parser::FragmentKind::Item) 193 parsing::parse_text_fragment(text, parser::FragmentKind::Item)
194 } 194 }
195} 195}
196 196
197impl ast::Type { 197impl ast::Type {
198 /// Returns `text`, parsed as an type reference, but only if it has no errors. 198 /// Returns `text`, parsed as an type reference, but only if it has no errors.
199 pub fn parse(text: &str) -> Result<Self, ()> { 199 pub fn parse(text: &str) -> Result<Self, ()> {
200 parsing::parse_text_fragment(text, ra_parser::FragmentKind::Type) 200 parsing::parse_text_fragment(text, parser::FragmentKind::Type)
201 } 201 }
202} 202}
203 203
diff --git a/crates/ra_syntax/src/parsing.rs b/crates/ra_syntax/src/parsing.rs
index 0ed3c20ef..68a39eb21 100644
--- a/crates/ra_syntax/src/parsing.rs
+++ b/crates/ra_syntax/src/parsing.rs
@@ -1,4 +1,4 @@
1//! Lexing, bridging to ra_parser (which does the actual parsing) and 1//! Lexing, bridging to parser (which does the actual parsing) and
2//! incremental reparsing. 2//! incremental reparsing.
3 3
4mod lexer; 4mod lexer;
@@ -13,7 +13,7 @@ use text_tree_sink::TextTreeSink;
13pub use lexer::*; 13pub use lexer::*;
14 14
15pub(crate) use self::reparsing::incremental_reparse; 15pub(crate) use self::reparsing::incremental_reparse;
16use ra_parser::SyntaxKind; 16use parser::SyntaxKind;
17 17
18pub(crate) fn parse_text(text: &str) -> (GreenNode, Vec<SyntaxError>) { 18pub(crate) fn parse_text(text: &str) -> (GreenNode, Vec<SyntaxError>) {
19 let (tokens, lexer_errors) = tokenize(&text); 19 let (tokens, lexer_errors) = tokenize(&text);
@@ -21,7 +21,7 @@ pub(crate) fn parse_text(text: &str) -> (GreenNode, Vec<SyntaxError>) {
21 let mut token_source = TextTokenSource::new(text, &tokens); 21 let mut token_source = TextTokenSource::new(text, &tokens);
22 let mut tree_sink = TextTreeSink::new(text, &tokens); 22 let mut tree_sink = TextTreeSink::new(text, &tokens);
23 23
24 ra_parser::parse(&mut token_source, &mut tree_sink); 24 parser::parse(&mut token_source, &mut tree_sink);
25 25
26 let (tree, mut parser_errors) = tree_sink.finish(); 26 let (tree, mut parser_errors) = tree_sink.finish();
27 parser_errors.extend(lexer_errors); 27 parser_errors.extend(lexer_errors);
@@ -32,7 +32,7 @@ pub(crate) fn parse_text(text: &str) -> (GreenNode, Vec<SyntaxError>) {
32/// Returns `text` parsed as a `T` provided there are no parse errors. 32/// Returns `text` parsed as a `T` provided there are no parse errors.
33pub(crate) fn parse_text_fragment<T: AstNode>( 33pub(crate) fn parse_text_fragment<T: AstNode>(
34 text: &str, 34 text: &str,
35 fragment_kind: ra_parser::FragmentKind, 35 fragment_kind: parser::FragmentKind,
36) -> Result<T, ()> { 36) -> Result<T, ()> {
37 let (tokens, lexer_errors) = tokenize(&text); 37 let (tokens, lexer_errors) = tokenize(&text);
38 if !lexer_errors.is_empty() { 38 if !lexer_errors.is_empty() {
@@ -44,13 +44,13 @@ pub(crate) fn parse_text_fragment<T: AstNode>(
44 44
45 // TextTreeSink assumes that there's at least some root node to which it can attach errors and 45 // TextTreeSink assumes that there's at least some root node to which it can attach errors and
46 // tokens. We arbitrarily give it a SourceFile. 46 // tokens. We arbitrarily give it a SourceFile.
47 use ra_parser::TreeSink; 47 use parser::TreeSink;
48 tree_sink.start_node(SyntaxKind::SOURCE_FILE); 48 tree_sink.start_node(SyntaxKind::SOURCE_FILE);
49 ra_parser::parse_fragment(&mut token_source, &mut tree_sink, fragment_kind); 49 parser::parse_fragment(&mut token_source, &mut tree_sink, fragment_kind);
50 tree_sink.finish_node(); 50 tree_sink.finish_node();
51 51
52 let (tree, parser_errors) = tree_sink.finish(); 52 let (tree, parser_errors) = tree_sink.finish();
53 use ra_parser::TokenSource; 53 use parser::TokenSource;
54 if !parser_errors.is_empty() || token_source.current().kind != SyntaxKind::EOF { 54 if !parser_errors.is_empty() || token_source.current().kind != SyntaxKind::EOF {
55 return Err(()); 55 return Err(());
56 } 56 }
diff --git a/crates/ra_syntax/src/parsing/reparsing.rs b/crates/ra_syntax/src/parsing/reparsing.rs
index 6644ffca4..4149f856a 100644
--- a/crates/ra_syntax/src/parsing/reparsing.rs
+++ b/crates/ra_syntax/src/parsing/reparsing.rs
@@ -6,7 +6,7 @@
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_parser::Reparser; 9use parser::Reparser;
10use text_edit::Indel; 10use text_edit::Indel;
11 11
12use crate::{ 12use crate::{
diff --git a/crates/ra_syntax/src/parsing/text_token_source.rs b/crates/ra_syntax/src/parsing/text_token_source.rs
index 97aa3e795..df866dc2b 100644
--- a/crates/ra_syntax/src/parsing/text_token_source.rs
+++ b/crates/ra_syntax/src/parsing/text_token_source.rs
@@ -1,10 +1,10 @@
1//! See `TextTokenSource` docs. 1//! See `TextTokenSource` docs.
2 2
3use ra_parser::TokenSource; 3use parser::TokenSource;
4 4
5use crate::{parsing::lexer::Token, SyntaxKind::EOF, TextRange, TextSize}; 5use crate::{parsing::lexer::Token, SyntaxKind::EOF, TextRange, TextSize};
6 6
7/// Implementation of `ra_parser::TokenSource` that takes tokens from source code text. 7/// Implementation of `parser::TokenSource` that takes tokens from source code text.
8pub(crate) struct TextTokenSource<'t> { 8pub(crate) struct TextTokenSource<'t> {
9 text: &'t str, 9 text: &'t str,
10 /// token and its start position (non-whitespace/comment tokens) 10 /// token and its start position (non-whitespace/comment tokens)
@@ -20,15 +20,15 @@ pub(crate) struct TextTokenSource<'t> {
20 token_offset_pairs: Vec<(Token, TextSize)>, 20 token_offset_pairs: Vec<(Token, TextSize)>,
21 21
22 /// Current token and position 22 /// Current token and position
23 curr: (ra_parser::Token, usize), 23 curr: (parser::Token, usize),
24} 24}
25 25
26impl<'t> TokenSource for TextTokenSource<'t> { 26impl<'t> TokenSource for TextTokenSource<'t> {
27 fn current(&self) -> ra_parser::Token { 27 fn current(&self) -> parser::Token {
28 self.curr.0 28 self.curr.0
29 } 29 }
30 30
31 fn lookahead_nth(&self, n: usize) -> ra_parser::Token { 31 fn lookahead_nth(&self, n: usize) -> parser::Token {
32 mk_token(self.curr.1 + n, &self.token_offset_pairs) 32 mk_token(self.curr.1 + n, &self.token_offset_pairs)
33 } 33 }
34 34
@@ -49,7 +49,7 @@ impl<'t> TokenSource for TextTokenSource<'t> {
49 } 49 }
50} 50}
51 51
52fn mk_token(pos: usize, token_offset_pairs: &[(Token, TextSize)]) -> ra_parser::Token { 52fn mk_token(pos: usize, token_offset_pairs: &[(Token, TextSize)]) -> parser::Token {
53 let (kind, is_jointed_to_next) = match token_offset_pairs.get(pos) { 53 let (kind, is_jointed_to_next) = match token_offset_pairs.get(pos) {
54 Some((token, offset)) => ( 54 Some((token, offset)) => (
55 token.kind, 55 token.kind,
@@ -60,7 +60,7 @@ fn mk_token(pos: usize, token_offset_pairs: &[(Token, TextSize)]) -> ra_parser::
60 ), 60 ),
61 None => (EOF, false), 61 None => (EOF, false),
62 }; 62 };
63 ra_parser::Token { kind, is_jointed_to_next } 63 parser::Token { kind, is_jointed_to_next }
64} 64}
65 65
66impl<'t> TextTokenSource<'t> { 66impl<'t> TextTokenSource<'t> {
diff --git a/crates/ra_syntax/src/parsing/text_tree_sink.rs b/crates/ra_syntax/src/parsing/text_tree_sink.rs
index 6d1828d20..c1b5f246d 100644
--- a/crates/ra_syntax/src/parsing/text_tree_sink.rs
+++ b/crates/ra_syntax/src/parsing/text_tree_sink.rs
@@ -2,7 +2,7 @@
2 2
3use std::mem; 3use std::mem;
4 4
5use ra_parser::{ParseError, TreeSink}; 5use parser::{ParseError, TreeSink};
6 6
7use crate::{ 7use crate::{
8 parsing::Token, 8 parsing::Token,
diff --git a/crates/ra_syntax/src/syntax_node.rs b/crates/ra_syntax/src/syntax_node.rs
index a7dbdba7b..b2abcbfbb 100644
--- a/crates/ra_syntax/src/syntax_node.rs
+++ b/crates/ra_syntax/src/syntax_node.rs
@@ -71,7 +71,7 @@ impl SyntaxTreeBuilder {
71 self.inner.finish_node() 71 self.inner.finish_node()
72 } 72 }
73 73
74 pub fn error(&mut self, error: ra_parser::ParseError, text_pos: TextSize) { 74 pub fn error(&mut self, error: parser::ParseError, text_pos: TextSize) {
75 self.errors.push(SyntaxError::new_at_offset(*error.0, text_pos)) 75 self.errors.push(SyntaxError::new_at_offset(*error.0, text_pos))
76 } 76 }
77} 77}