mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 13:03:31 +00:00
Simplify
This commit is contained in:
parent
d94124e3b4
commit
c74eaf1fdf
1 changed files with 5 additions and 7 deletions
|
@ -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 {
|
||||||
|
|
Loading…
Reference in a new issue