mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 21:05:02 +00:00
rename Sink -> TreeSink
This commit is contained in:
parent
96899f8278
commit
3517c175ac
3 changed files with 8 additions and 8 deletions
|
@ -1,5 +1,5 @@
|
||||||
use crate::{
|
use crate::{
|
||||||
parsing::parser_impl::Sink,
|
parsing::parser_impl::TreeSink,
|
||||||
syntax_node::{GreenNode, RaTypes},
|
syntax_node::{GreenNode, RaTypes},
|
||||||
SmolStr, SyntaxKind, SyntaxError,
|
SmolStr, SyntaxKind, SyntaxError,
|
||||||
};
|
};
|
||||||
|
@ -17,7 +17,7 @@ impl GreenBuilder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Sink for GreenBuilder {
|
impl TreeSink for GreenBuilder {
|
||||||
type Tree = (GreenNode, Vec<SyntaxError>);
|
type Tree = (GreenNode, Vec<SyntaxError>);
|
||||||
|
|
||||||
fn leaf(&mut self, kind: SyntaxKind, text: SmolStr) {
|
fn leaf(&mut self, kind: SyntaxKind, text: SmolStr) {
|
||||||
|
|
|
@ -18,7 +18,7 @@ use crate::{
|
||||||
|
|
||||||
use crate::SyntaxKind::{self, EOF, TOMBSTONE};
|
use crate::SyntaxKind::{self, EOF, TOMBSTONE};
|
||||||
|
|
||||||
pub(super) trait Sink {
|
pub(super) trait TreeSink {
|
||||||
type Tree;
|
type Tree;
|
||||||
|
|
||||||
/// Adds new leaf to the current branch.
|
/// 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
|
/// 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,
|
sink: S,
|
||||||
text: &str,
|
text: &str,
|
||||||
tokens: &[Token],
|
tokens: &[Token],
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
//! parser, so as to allow to evolve the tree representation
|
//! parser, so as to allow to evolve the tree representation
|
||||||
//! and the parser algorithm independently.
|
//! 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
|
//! tree builder: the parser produces a stream of events like
|
||||||
//! `start node`, `finish node`, and `FileBuilder` converts
|
//! `start node`, `finish node`, and `FileBuilder` converts
|
||||||
//! this stream to a real tree.
|
//! this stream to a real tree.
|
||||||
|
@ -20,7 +20,7 @@ use crate::{
|
||||||
},
|
},
|
||||||
parsing::{
|
parsing::{
|
||||||
lexer::Token,
|
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,
|
sink: S,
|
||||||
text_pos: TextUnit,
|
text_pos: TextUnit,
|
||||||
text: &'a str,
|
text: &'a str,
|
||||||
|
@ -102,7 +102,7 @@ pub(super) struct EventProcessor<'a, S: Sink> {
|
||||||
events: &'a mut [Event],
|
events: &'a mut [Event],
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, S: Sink> EventProcessor<'a, S> {
|
impl<'a, S: TreeSink> EventProcessor<'a, S> {
|
||||||
pub(super) fn new(
|
pub(super) fn new(
|
||||||
sink: S,
|
sink: S,
|
||||||
text: &'a str,
|
text: &'a str,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue