diff options
Diffstat (limited to 'src/parser')
-rw-r--r-- | src/parser/mod.rs | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/parser/mod.rs b/src/parser/mod.rs index 22ccb4921..f17ffbf3a 100644 --- a/src/parser/mod.rs +++ b/src/parser/mod.rs | |||
@@ -10,16 +10,14 @@ use self::event::Event; | |||
10 | 10 | ||
11 | /// Parse a sequence of tokens into the representative node tree | 11 | /// Parse a sequence of tokens into the representative node tree |
12 | pub fn parse(text: String, tokens: &[Token]) -> File { | 12 | pub fn parse(text: String, tokens: &[Token]) -> File { |
13 | let events = parse_into_events(&text, tokens); | 13 | let events = { |
14 | let mut parser = parser::Parser::new(&text, tokens); | ||
15 | grammar::file(&mut parser); | ||
16 | parser.into_events() | ||
17 | }; | ||
14 | event::to_file(text, tokens, events) | 18 | event::to_file(text, tokens, events) |
15 | } | 19 | } |
16 | 20 | ||
17 | pub(crate) fn parse_into_events<'t>(text: &'t str, raw_tokens: &'t [Token]) -> Vec<Event> { | ||
18 | let mut parser = parser::Parser::new(text, raw_tokens); | ||
19 | grammar::file(&mut parser); | ||
20 | parser.into_events() | ||
21 | } | ||
22 | |||
23 | fn is_insignificant(kind: SyntaxKind) -> bool { | 21 | fn is_insignificant(kind: SyntaxKind) -> bool { |
24 | match kind { | 22 | match kind { |
25 | WHITESPACE | COMMENT => true, | 23 | WHITESPACE | COMMENT => true, |