diff options
author | Aleksey Kladov <[email protected]> | 2018-07-29 11:51:55 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-07-29 11:51:55 +0100 |
commit | c12450fb4e30c3418555e47d045bb9fd4318a10a (patch) | |
tree | e2dc508e1e415388392657cda3dfb00175cdabf2 /src/parser/event.rs | |
parent | 8d9961b75377a7bd2656b5aa1451710de8c86f60 (diff) |
Introduce red-green syntax tree
Diffstat (limited to 'src/parser/event.rs')
-rw-r--r-- | src/parser/event.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/parser/event.rs b/src/parser/event.rs index ac8a55de9..0fbfaeb9f 100644 --- a/src/parser/event.rs +++ b/src/parser/event.rs | |||
@@ -1,5 +1,5 @@ | |||
1 | use { | 1 | use { |
2 | ErrorMsg, File, FileBuilder, Sink, SyntaxKind, Token, | 2 | ErrorMsg, File, FileBuilder, Sink, SyntaxKind, Token, GreenBuilder, |
3 | syntax_kinds::TOMBSTONE, | 3 | syntax_kinds::TOMBSTONE, |
4 | }; | 4 | }; |
5 | use super::is_insignificant; | 5 | use super::is_insignificant; |
@@ -69,6 +69,11 @@ pub(crate) enum Event { | |||
69 | 69 | ||
70 | pub(super) fn to_file(text: String, tokens: &[Token], events: Vec<Event>) -> File { | 70 | pub(super) fn to_file(text: String, tokens: &[Token], events: Vec<Event>) -> File { |
71 | let mut builder = FileBuilder::new(text); | 71 | let mut builder = FileBuilder::new(text); |
72 | process(&mut builder, tokens, events); | ||
73 | builder.finish() | ||
74 | } | ||
75 | |||
76 | pub(super) fn process(builder: &mut Sink, tokens: &[Token], events: Vec<Event>) { | ||
72 | let mut idx = 0; | 77 | let mut idx = 0; |
73 | 78 | ||
74 | let mut holes = Vec::new(); | 79 | let mut holes = Vec::new(); |
@@ -145,5 +150,4 @@ pub(super) fn to_file(text: String, tokens: &[Token], events: Vec<Event>) -> Fil | |||
145 | &Event::Error { ref msg } => builder.error(ErrorMsg { msg: msg.clone() }), | 150 | &Event::Error { ref msg } => builder.error(ErrorMsg { msg: msg.clone() }), |
146 | } | 151 | } |
147 | } | 152 | } |
148 | builder.finish() | ||
149 | } | 153 | } |