diff options
Diffstat (limited to 'crates/ra_syntax/src/parser_impl.rs')
-rw-r--r-- | crates/ra_syntax/src/parser_impl.rs | 15 |
1 files changed, 13 insertions, 2 deletions
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}; | |||
22 | pub(crate) trait Sink { | 22 | pub(crate) trait Sink { |
23 | type Tree; | 23 | type Tree; |
24 | 24 | ||
25 | /// Adds new leaf to the current branch. | ||
25 | fn leaf(&mut self, kind: SyntaxKind, text: SmolStr); | 26 | fn leaf(&mut self, kind: SyntaxKind, text: SmolStr); |
26 | fn start_internal(&mut self, kind: SyntaxKind); | 27 | |
27 | fn finish_internal(&mut self); | 28 | /// Start new branch and make it current. |
29 | fn start_branch(&mut self, kind: SyntaxKind); | ||
30 | |||
31 | /// Finish current branch and restore previous | ||
32 | /// branch as current. | ||
33 | fn finish_branch(&mut self); | ||
34 | |||
28 | fn error(&mut self, error: SyntaxError); | 35 | fn error(&mut self, error: SyntaxError); |
36 | |||
37 | /// Complete tree building. Make sure that | ||
38 | /// `start_branch` and `finish_branch` calls | ||
39 | /// are paired! | ||
29 | fn finish(self) -> Self::Tree; | 40 | fn finish(self) -> Self::Tree; |
30 | } | 41 | } |
31 | 42 | ||