aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-02-20 18:08:59 +0000
committerAleksey Kladov <[email protected]>2019-02-20 18:08:59 +0000
commit3517c175ac537b47dd3e36cc7fb1edd60b02c039 (patch)
treed9d3bb44ce3c163270352729eb866f1026aa6296 /crates
parent96899f8278b787280bd07d9ac9dce29a610ce40d (diff)
rename Sink -> TreeSink
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_syntax/src/parsing/builder.rs4
-rw-r--r--crates/ra_syntax/src/parsing/parser_impl.rs4
-rw-r--r--crates/ra_syntax/src/parsing/parser_impl/event.rs8
3 files changed, 8 insertions, 8 deletions
diff --git a/crates/ra_syntax/src/parsing/builder.rs b/crates/ra_syntax/src/parsing/builder.rs
index 9090c60c2..118f43b2c 100644
--- a/crates/ra_syntax/src/parsing/builder.rs
+++ b/crates/ra_syntax/src/parsing/builder.rs
@@ -1,5 +1,5 @@
1use crate::{ 1use crate::{
2 parsing::parser_impl::Sink, 2 parsing::parser_impl::TreeSink,
3 syntax_node::{GreenNode, RaTypes}, 3 syntax_node::{GreenNode, RaTypes},
4 SmolStr, SyntaxKind, SyntaxError, 4 SmolStr, SyntaxKind, SyntaxError,
5}; 5};
@@ -17,7 +17,7 @@ impl GreenBuilder {
17 } 17 }
18} 18}
19 19
20impl Sink for GreenBuilder { 20impl TreeSink for GreenBuilder {
21 type Tree = (GreenNode, Vec<SyntaxError>); 21 type Tree = (GreenNode, Vec<SyntaxError>);
22 22
23 fn leaf(&mut self, kind: SyntaxKind, text: SmolStr) { 23 fn leaf(&mut self, kind: SyntaxKind, text: SmolStr) {
diff --git a/crates/ra_syntax/src/parsing/parser_impl.rs b/crates/ra_syntax/src/parsing/parser_impl.rs
index 8cce1ab01..02baed76b 100644
--- a/crates/ra_syntax/src/parsing/parser_impl.rs
+++ b/crates/ra_syntax/src/parsing/parser_impl.rs
@@ -18,7 +18,7 @@ use crate::{
18 18
19use crate::SyntaxKind::{self, EOF, TOMBSTONE}; 19use crate::SyntaxKind::{self, EOF, TOMBSTONE};
20 20
21pub(super) trait Sink { 21pub(super) trait TreeSink {
22 type Tree; 22 type Tree;
23 23
24 /// Adds new leaf to the current branch. 24 /// Adds new leaf to the current branch.
@@ -40,7 +40,7 @@ pub(super) trait Sink {
40} 40}
41 41
42/// Parse a sequence of tokens into the representative node tree 42/// Parse a sequence of tokens into the representative node tree
43pub(super) fn parse_with<S: Sink>( 43pub(super) fn parse_with<S: TreeSink>(
44 sink: S, 44 sink: S,
45 text: &str, 45 text: &str,
46 tokens: &[Token], 46 tokens: &[Token],
diff --git a/crates/ra_syntax/src/parsing/parser_impl/event.rs b/crates/ra_syntax/src/parsing/parser_impl/event.rs
index 2ddbdd34d..9663fba35 100644
--- a/crates/ra_syntax/src/parsing/parser_impl/event.rs
+++ b/crates/ra_syntax/src/parsing/parser_impl/event.rs
@@ -3,7 +3,7 @@
3//! parser, so as to allow to evolve the tree representation 3//! parser, so as to allow to evolve the tree representation
4//! and the parser algorithm independently. 4//! and the parser algorithm independently.
5//! 5//!
6//! The `Sink` trait is the bridge between the parser and the 6//! The `TreeSink` trait is the bridge between the parser and the
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.
@@ -20,7 +20,7 @@ use crate::{
20 }, 20 },
21 parsing::{ 21 parsing::{
22 lexer::Token, 22 lexer::Token,
23 parser_impl::Sink, 23 parser_impl::TreeSink,
24 }, 24 },
25}; 25};
26 26
@@ -93,7 +93,7 @@ impl Event {
93 } 93 }
94} 94}
95 95
96pub(super) struct EventProcessor<'a, S: Sink> { 96pub(super) struct EventProcessor<'a, S: TreeSink> {
97 sink: S, 97 sink: S,
98 text_pos: TextUnit, 98 text_pos: TextUnit,
99 text: &'a str, 99 text: &'a str,
@@ -102,7 +102,7 @@ pub(super) struct EventProcessor<'a, S: Sink> {
102 events: &'a mut [Event], 102 events: &'a mut [Event],
103} 103}
104 104
105impl<'a, S: Sink> EventProcessor<'a, S> { 105impl<'a, S: TreeSink> EventProcessor<'a, S> {
106 pub(super) fn new( 106 pub(super) fn new(
107 sink: S, 107 sink: S,
108 text: &'a str, 108 text: &'a str,