From ea7b569e1b133b6c19ef60c9cb2b2fd6b79847da Mon Sep 17 00:00:00 2001 From: csmoe Date: Mon, 31 Dec 2018 20:53:43 +0800 Subject: docing parser methods --- crates/ra_syntax/src/parser_impl.rs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'crates/ra_syntax/src/parser_impl.rs') diff --git a/crates/ra_syntax/src/parser_impl.rs b/crates/ra_syntax/src/parser_impl.rs index cb6e370ac..d4032a6d9 100644 --- a/crates/ra_syntax/src/parser_impl.rs +++ b/crates/ra_syntax/src/parser_impl.rs @@ -22,10 +22,21 @@ use crate::SyntaxKind::{self, EOF, TOMBSTONE}; pub(crate) trait Sink { type Tree; + /// Adds new leaf to the current branch. fn leaf(&mut self, kind: SyntaxKind, text: SmolStr); - fn start_internal(&mut self, kind: SyntaxKind); - fn finish_internal(&mut self); + + /// Start new branch and make it current. + fn start_branch(&mut self, kind: SyntaxKind); + + /// Finish current branch and restore previous + /// branch as current. + fn finish_branch(&mut self); + fn error(&mut self, error: SyntaxError); + + /// Complete tree building. Make sure that + /// `start_branch` and `finish_branch` calls + /// are paired! fn finish(self) -> Self::Tree; } -- cgit v1.2.3