aboutsummaryrefslogtreecommitdiff
path: root/src/parser
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-02-04 10:56:51 +0000
committerAleksey Kladov <[email protected]>2018-02-04 10:56:51 +0000
commitc74eaf1fdfbe027379ab4a4df715a917bcbffef1 (patch)
tree97b11360a184d4271fe904cd29f3ff5a15333917 /src/parser
parentd94124e3b4a4380ad23c1a317fd3943664b7182a (diff)
Simplify
Diffstat (limited to 'src/parser')
-rw-r--r--src/parser/mod.rs12
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
12pub fn parse(text: String, tokens: &[Token]) -> File { 12pub 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
17pub(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
23fn is_insignificant(kind: SyntaxKind) -> bool { 21fn is_insignificant(kind: SyntaxKind) -> bool {
24 match kind { 22 match kind {
25 WHITESPACE | COMMENT => true, 23 WHITESPACE | COMMENT => true,