rename Sink -> TreeSink

This commit is contained in:
Aleksey Kladov 2019-02-20 21:08:59 +03:00
parent 96899f8278
commit 3517c175ac
3 changed files with 8 additions and 8 deletions

View file

@ -1,5 +1,5 @@
use crate::{
parsing::parser_impl::Sink,
parsing::parser_impl::TreeSink,
syntax_node::{GreenNode, RaTypes},
SmolStr, SyntaxKind, SyntaxError,
};
@ -17,7 +17,7 @@ impl GreenBuilder {
}
}
impl Sink for GreenBuilder {
impl TreeSink for GreenBuilder {
type Tree = (GreenNode, Vec<SyntaxError>);
fn leaf(&mut self, kind: SyntaxKind, text: SmolStr) {

View file

@ -18,7 +18,7 @@ use crate::{
use crate::SyntaxKind::{self, EOF, TOMBSTONE};
pub(super) trait Sink {
pub(super) trait TreeSink {
type Tree;
/// Adds new leaf to the current branch.
@ -40,7 +40,7 @@ pub(super) trait Sink {
}
/// Parse a sequence of tokens into the representative node tree
pub(super) fn parse_with<S: Sink>(
pub(super) fn parse_with<S: TreeSink>(
sink: S,
text: &str,
tokens: &[Token],

View file

@ -3,7 +3,7 @@
//! parser, so as to allow to evolve the tree representation
//! and the parser algorithm independently.
//!
//! The `Sink` trait is the bridge between the parser and the
//! The `TreeSink` trait is the bridge between the parser and the
//! tree builder: the parser produces a stream of events like
//! `start node`, `finish node`, and `FileBuilder` converts
//! this stream to a real tree.
@ -20,7 +20,7 @@ use crate::{
},
parsing::{
lexer::Token,
parser_impl::Sink,
parser_impl::TreeSink,
},
};
@ -93,7 +93,7 @@ impl Event {
}
}
pub(super) struct EventProcessor<'a, S: Sink> {
pub(super) struct EventProcessor<'a, S: TreeSink> {
sink: S,
text_pos: TextUnit,
text: &'a str,
@ -102,7 +102,7 @@ pub(super) struct EventProcessor<'a, S: Sink> {
events: &'a mut [Event],
}
impl<'a, S: Sink> EventProcessor<'a, S> {
impl<'a, S: TreeSink> EventProcessor<'a, S> {
pub(super) fn new(
sink: S,
text: &'a str,