aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_parser/src
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2019-04-01 10:30:25 +0100
committerbors[bot] <bors[bot]@users.noreply.github.com>2019-04-01 10:30:25 +0100
commit42a883f06c28ddeab22e5703a578f19110dde7f3 (patch)
treefe57697b54ccfb791fe96c13cb553a8570516270 /crates/ra_parser/src
parentdec9bde10868b5e459535449476d17a6a0987b3e (diff)
parent9e213385c9d06db3c8ca20812779e2b8f8ad2c71 (diff)
Merge #1078
1078: rewrite syntax trees r=matklad a=matklad Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_parser/src')
-rw-r--r--crates/ra_parser/src/event.rs6
-rw-r--r--crates/ra_parser/src/lib.rs8
2 files changed, 7 insertions, 7 deletions
diff --git a/crates/ra_parser/src/event.rs b/crates/ra_parser/src/event.rs
index c1773e8e0..87cf4eca0 100644
--- a/crates/ra_parser/src/event.rs
+++ b/crates/ra_parser/src/event.rs
@@ -116,12 +116,12 @@ pub(super) fn process(sink: &mut dyn TreeSink, mut events: Vec<Event>) {
116 } 116 }
117 117
118 for kind in forward_parents.drain(..).rev() { 118 for kind in forward_parents.drain(..).rev() {
119 sink.start_branch(kind); 119 sink.start_node(kind);
120 } 120 }
121 } 121 }
122 Event::Finish => sink.finish_branch(), 122 Event::Finish => sink.finish_node(),
123 Event::Token { kind, n_raw_tokens } => { 123 Event::Token { kind, n_raw_tokens } => {
124 sink.leaf(kind, n_raw_tokens); 124 sink.token(kind, n_raw_tokens);
125 } 125 }
126 Event::Error { msg } => sink.error(msg), 126 Event::Error { msg } => sink.error(msg),
127 } 127 }
diff --git a/crates/ra_parser/src/lib.rs b/crates/ra_parser/src/lib.rs
index ddc08e462..30ba06aac 100644
--- a/crates/ra_parser/src/lib.rs
+++ b/crates/ra_parser/src/lib.rs
@@ -40,15 +40,15 @@ pub trait TokenSource {
40 40
41/// `TreeSink` abstracts details of a particular syntax tree implementation. 41/// `TreeSink` abstracts details of a particular syntax tree implementation.
42pub trait TreeSink { 42pub trait TreeSink {
43 /// Adds new leaf to the current branch. 43 /// Adds new token to the current branch.
44 fn leaf(&mut self, kind: SyntaxKind, n_tokens: u8); 44 fn token(&mut self, kind: SyntaxKind, n_tokens: u8);
45 45
46 /// Start new branch and make it current. 46 /// Start new branch and make it current.
47 fn start_branch(&mut self, kind: SyntaxKind); 47 fn start_node(&mut self, kind: SyntaxKind);
48 48
49 /// Finish current branch and restore previous 49 /// Finish current branch and restore previous
50 /// branch as current. 50 /// branch as current.
51 fn finish_branch(&mut self); 51 fn finish_node(&mut self);
52 52
53 fn error(&mut self, error: ParseError); 53 fn error(&mut self, error: ParseError);
54} 54}