diff options
Diffstat (limited to 'crates/ra_syntax/src/syntax_node')
-rw-r--r-- | crates/ra_syntax/src/syntax_node/builder.rs | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/crates/ra_syntax/src/syntax_node/builder.rs b/crates/ra_syntax/src/syntax_node/builder.rs deleted file mode 100644 index 8abd0f051..000000000 --- a/crates/ra_syntax/src/syntax_node/builder.rs +++ /dev/null | |||
@@ -1,41 +0,0 @@ | |||
1 | use crate::{ | ||
2 | parser_impl::Sink, | ||
3 | syntax_node::{GreenNode, RaTypes, SyntaxError}, | ||
4 | SmolStr, SyntaxKind, | ||
5 | }; | ||
6 | use rowan::GreenNodeBuilder; | ||
7 | |||
8 | pub(crate) struct GreenBuilder { | ||
9 | errors: Vec<SyntaxError>, | ||
10 | inner: GreenNodeBuilder<RaTypes>, | ||
11 | } | ||
12 | |||
13 | impl GreenBuilder { | ||
14 | pub(crate) fn new() -> GreenBuilder { | ||
15 | GreenBuilder { errors: Vec::new(), inner: GreenNodeBuilder::new() } | ||
16 | } | ||
17 | } | ||
18 | |||
19 | impl Sink for GreenBuilder { | ||
20 | type Tree = (GreenNode, Vec<SyntaxError>); | ||
21 | |||
22 | fn leaf(&mut self, kind: SyntaxKind, text: SmolStr) { | ||
23 | self.inner.leaf(kind, text); | ||
24 | } | ||
25 | |||
26 | fn start_branch(&mut self, kind: SyntaxKind) { | ||
27 | self.inner.start_internal(kind) | ||
28 | } | ||
29 | |||
30 | fn finish_branch(&mut self) { | ||
31 | self.inner.finish_internal(); | ||
32 | } | ||
33 | |||
34 | fn error(&mut self, error: SyntaxError) { | ||
35 | self.errors.push(error) | ||
36 | } | ||
37 | |||
38 | fn finish(self) -> (GreenNode, Vec<SyntaxError>) { | ||
39 | (self.inner.finish(), self.errors) | ||
40 | } | ||
41 | } | ||