aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-08-12 16:15:00 +0100
committerGitHub <[email protected]>2020-08-12 16:15:00 +0100
commit3d6889cba72a9d02199f7adaa2ecc69bc30af834 (patch)
treea17351b1e3addea0a719f38990fea9289b6ef65e
parenta573e088ac64eeeb19e4fc74be2ff019be510477 (diff)
parent50a02eb3593591a02677e1b56f24d7ff0459b9d0 (diff)
Merge #5727
5727: Rename ra_parser -> parser r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
-rw-r--r--Cargo.lock20
-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
-rw-r--r--docs/dev/README.md4
-rw-r--r--docs/dev/architecture.md2
-rw-r--r--docs/dev/syntax.md2
-rw-r--r--xtask/src/codegen.rs4
-rw-r--r--xtask/tests/tidy.rs2
47 files changed, 65 insertions, 65 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 4a6a65934..095127b99 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -835,6 +835,13 @@ dependencies = [
835] 835]
836 836
837[[package]] 837[[package]]
838name = "parser"
839version = "0.0.0"
840dependencies = [
841 "drop_bomb",
842]
843
844[[package]]
838name = "paths" 845name = "paths"
839version = "0.1.0" 846version = "0.1.0"
840 847
@@ -1018,10 +1025,10 @@ dependencies = [
1018 "arena", 1025 "arena",
1019 "either", 1026 "either",
1020 "log", 1027 "log",
1028 "parser",
1021 "profile", 1029 "profile",
1022 "ra_db", 1030 "ra_db",
1023 "ra_mbe", 1031 "ra_mbe",
1024 "ra_parser",
1025 "ra_syntax", 1032 "ra_syntax",
1026 "rustc-hash", 1033 "rustc-hash",
1027 "test_utils", 1034 "test_utils",
@@ -1105,7 +1112,7 @@ name = "ra_mbe"
1105version = "0.1.0" 1112version = "0.1.0"
1106dependencies = [ 1113dependencies = [
1107 "log", 1114 "log",
1108 "ra_parser", 1115 "parser",
1109 "ra_syntax", 1116 "ra_syntax",
1110 "rustc-hash", 1117 "rustc-hash",
1111 "smallvec", 1118 "smallvec",
@@ -1114,13 +1121,6 @@ dependencies = [
1114] 1121]
1115 1122
1116[[package]] 1123[[package]]
1117name = "ra_parser"
1118version = "0.1.0"
1119dependencies = [
1120 "drop_bomb",
1121]
1122
1123[[package]]
1124name = "ra_proc_macro" 1124name = "ra_proc_macro"
1125version = "0.1.0" 1125version = "0.1.0"
1126dependencies = [ 1126dependencies = [
@@ -1190,7 +1190,7 @@ dependencies = [
1190 "expect", 1190 "expect",
1191 "itertools", 1191 "itertools",
1192 "once_cell", 1192 "once_cell",
1193 "ra_parser", 1193 "parser",
1194 "rayon", 1194 "rayon",
1195 "rowan", 1195 "rowan",
1196 "rustc-ap-rustc_lexer", 1196 "rustc-ap-rustc_lexer",
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}
diff --git a/docs/dev/README.md b/docs/dev/README.md
index 51cf716b3..33829c593 100644
--- a/docs/dev/README.md
+++ b/docs/dev/README.md
@@ -92,11 +92,11 @@ This is primarily useful for performance optimizations, or for bug minimization.
92 92
93## Parser Tests 93## Parser Tests
94 94
95Tests for the parser (`ra_parser`) live in the `ra_syntax` crate (see `test_data` directory). 95Tests for the parser (`parser`) live in the `ra_syntax` crate (see `test_data` directory).
96There are two kinds of tests: 96There are two kinds of tests:
97 97
98* Manually written test cases in `parser/ok` and `parser/err` 98* Manually written test cases in `parser/ok` and `parser/err`
99* "Inline" tests in `parser/inline` (these are generated) from comments in `ra_parser` crate. 99* "Inline" tests in `parser/inline` (these are generated) from comments in `parser` crate.
100 100
101The purpose of inline tests is not to achieve full coverage by test cases, but to explain to the reader of the code what each particular `if` and `match` is responsible for. 101The purpose of inline tests is not to achieve full coverage by test cases, but to explain to the reader of the code what each particular `if` and `match` is responsible for.
102If you are tempted to add a large inline test, it might be a good idea to leave only the simplest example in place, and move the test to a manual `parser/ok` test. 102If you are tempted to add a large inline test, it might be a good idea to leave only the simplest example in place, and move the test to a manual `parser/ok` test.
diff --git a/docs/dev/architecture.md b/docs/dev/architecture.md
index d0c6eea61..21373729c 100644
--- a/docs/dev/architecture.md
+++ b/docs/dev/architecture.md
@@ -64,7 +64,7 @@ The source for 1 and 2 is in [`ast_src.rs`](https://github.com/rust-analyzer/rus
64 64
65## Code Walk-Through 65## Code Walk-Through
66 66
67### `crates/ra_syntax`, `crates/ra_parser` 67### `crates/ra_syntax`, `crates/parser`
68 68
69Rust syntax tree structure and parser. See 69Rust syntax tree structure and parser. See
70[RFC](https://github.com/rust-lang/rfcs/pull/2256) and [./syntax.md](./syntax.md) for some design notes. 70[RFC](https://github.com/rust-lang/rfcs/pull/2256) and [./syntax.md](./syntax.md) for some design notes.
diff --git a/docs/dev/syntax.md b/docs/dev/syntax.md
index f1bcdc4af..c08062ef4 100644
--- a/docs/dev/syntax.md
+++ b/docs/dev/syntax.md
@@ -11,7 +11,7 @@ The things described are implemented in two places
11* [rowan](https://github.com/rust-analyzer/rowan/tree/v0.9.0) -- a generic library for rowan syntax trees. 11* [rowan](https://github.com/rust-analyzer/rowan/tree/v0.9.0) -- a generic library for rowan syntax trees.
12* [ra_syntax](https://github.com/rust-analyzer/rust-analyzer/tree/cf5bdf464cad7ceb9a67e07985a3f4d3799ec0b6/crates/ra_syntax) crate inside rust-analyzer which wraps `rowan` into rust-analyzer specific API. 12* [ra_syntax](https://github.com/rust-analyzer/rust-analyzer/tree/cf5bdf464cad7ceb9a67e07985a3f4d3799ec0b6/crates/ra_syntax) crate inside rust-analyzer which wraps `rowan` into rust-analyzer specific API.
13 Nothing in rust-analyzer except this crate knows about `rowan`. 13 Nothing in rust-analyzer except this crate knows about `rowan`.
14* [ra_parser](https://github.com/rust-analyzer/rust-analyzer/tree/cf5bdf464cad7ceb9a67e07985a3f4d3799ec0b6/crates/ra_parser) crate parses input tokens into an `ra_syntax` tree 14* [parser](https://github.com/rust-analyzer/rust-analyzer/tree/cf5bdf464cad7ceb9a67e07985a3f4d3799ec0b6/crates/parser) crate parses input tokens into an `ra_syntax` tree
15 15
16## Design Goals 16## Design Goals
17 17
diff --git a/xtask/src/codegen.rs b/xtask/src/codegen.rs
index f5f4b964a..08e7a10b7 100644
--- a/xtask/src/codegen.rs
+++ b/xtask/src/codegen.rs
@@ -24,11 +24,11 @@ pub use self::{
24 gen_syntax::generate_syntax, 24 gen_syntax::generate_syntax,
25}; 25};
26 26
27const GRAMMAR_DIR: &str = "crates/ra_parser/src/grammar"; 27const GRAMMAR_DIR: &str = "crates/parser/src/grammar";
28const OK_INLINE_TESTS_DIR: &str = "crates/ra_syntax/test_data/parser/inline/ok"; 28const OK_INLINE_TESTS_DIR: &str = "crates/ra_syntax/test_data/parser/inline/ok";
29const ERR_INLINE_TESTS_DIR: &str = "crates/ra_syntax/test_data/parser/inline/err"; 29const ERR_INLINE_TESTS_DIR: &str = "crates/ra_syntax/test_data/parser/inline/err";
30 30
31const SYNTAX_KINDS: &str = "crates/ra_parser/src/syntax_kind/generated.rs"; 31const SYNTAX_KINDS: &str = "crates/parser/src/syntax_kind/generated.rs";
32const AST_NODES: &str = "crates/ra_syntax/src/ast/generated/nodes.rs"; 32const AST_NODES: &str = "crates/ra_syntax/src/ast/generated/nodes.rs";
33const AST_TOKENS: &str = "crates/ra_syntax/src/ast/generated/tokens.rs"; 33const AST_TOKENS: &str = "crates/ra_syntax/src/ast/generated/tokens.rs";
34 34
diff --git a/xtask/tests/tidy.rs b/xtask/tests/tidy.rs
index ddaab93ab..f1a7e8288 100644
--- a/xtask/tests/tidy.rs
+++ b/xtask/tests/tidy.rs
@@ -196,7 +196,7 @@ impl TidyDocs {
196 "ra_hir_expand", 196 "ra_hir_expand",
197 "ra_ide", 197 "ra_ide",
198 "ra_mbe", 198 "ra_mbe",
199 "ra_parser", 199 "parser",
200 "profile", 200 "profile",
201 "ra_project_model", 201 "ra_project_model",
202 "ra_syntax", 202 "ra_syntax",