This commit is contained in:
Aleksey Kladov 2018-02-04 13:56:51 +03:00
parent d94124e3b4
commit c74eaf1fdf

View file

@ -10,14 +10,12 @@ use self::event::Event;
/// Parse a sequence of tokens into the representative node tree /// Parse a sequence of tokens into the representative node tree
pub fn parse(text: String, tokens: &[Token]) -> File { pub fn parse(text: String, tokens: &[Token]) -> File {
let events = parse_into_events(&text, tokens); let events = {
event::to_file(text, tokens, events) let mut parser = parser::Parser::new(&text, tokens);
}
pub(crate) fn parse_into_events<'t>(text: &'t str, raw_tokens: &'t [Token]) -> Vec<Event> {
let mut parser = parser::Parser::new(text, raw_tokens);
grammar::file(&mut parser); grammar::file(&mut parser);
parser.into_events() parser.into_events()
};
event::to_file(text, tokens, events)
} }
fn is_insignificant(kind: SyntaxKind) -> bool { fn is_insignificant(kind: SyntaxKind) -> bool {