aboutsummaryrefslogtreecommitdiff
path: root/src/parser_impl/mod.rs
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-08-01 08:40:07 +0100
committerAleksey Kladov <[email protected]>2018-08-01 08:40:07 +0100
commit966e9db2b83802dfb55d55bd3a26e69dced1bbd7 (patch)
tree6d3bda084eab1221bcad7602aa26a2c307850a72 /src/parser_impl/mod.rs
parentb9189ed2db8cb1934e677a17fcc6282c66306df1 (diff)
Extract libeditor
Diffstat (limited to 'src/parser_impl/mod.rs')
-rw-r--r--src/parser_impl/mod.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/parser_impl/mod.rs b/src/parser_impl/mod.rs
index b58094be3..2791c8da5 100644
--- a/src/parser_impl/mod.rs
+++ b/src/parser_impl/mod.rs
@@ -14,10 +14,10 @@ use {
14 14
15use SyntaxKind::{self, EOF, TOMBSTONE}; 15use SyntaxKind::{self, EOF, TOMBSTONE};
16 16
17pub(crate) trait Sink { 17pub(crate) trait Sink<'a> {
18 type Tree; 18 type Tree;
19 19
20 fn new(text: String) -> Self; 20 fn new(text: &'a str) -> Self;
21 21
22 fn leaf(&mut self, kind: SyntaxKind, len: TextUnit); 22 fn leaf(&mut self, kind: SyntaxKind, len: TextUnit);
23 fn start_internal(&mut self, kind: SyntaxKind); 23 fn start_internal(&mut self, kind: SyntaxKind);
@@ -27,9 +27,9 @@ pub(crate) trait Sink {
27} 27}
28 28
29/// Parse a sequence of tokens into the representative node tree 29/// Parse a sequence of tokens into the representative node tree
30pub(crate) fn parse<S: Sink>(text: String, tokens: &[Token]) -> S::Tree { 30pub(crate) fn parse<'a, S: Sink<'a>>(text: &'a str, tokens: &[Token]) -> S::Tree {
31 let events = { 31 let events = {
32 let input = input::ParserInput::new(&text, tokens); 32 let input = input::ParserInput::new(text, tokens);
33 let parser_impl = ParserImpl::new(&input); 33 let parser_impl = ParserImpl::new(&input);
34 let mut parser_api = Parser(parser_impl); 34 let mut parser_api = Parser(parser_impl);
35 grammar::file(&mut parser_api); 35 grammar::file(&mut parser_api);