mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-11-15 01:17:27 +00:00
simplify
This commit is contained in:
parent
4c1f9b8d4e
commit
61992dc1cd
5 changed files with 4 additions and 29 deletions
|
@ -4,7 +4,7 @@ mod builder;
|
|||
mod lexer;
|
||||
mod event;
|
||||
mod input;
|
||||
mod parser_api;
|
||||
mod parser;
|
||||
mod grammar;
|
||||
mod reparsing;
|
||||
|
||||
|
@ -14,7 +14,7 @@ use crate::{
|
|||
builder::GreenBuilder,
|
||||
input::ParserInput,
|
||||
event::EventProcessor,
|
||||
parser_api::Parser,
|
||||
parser::Parser,
|
||||
},
|
||||
syntax_node::GreenNode,
|
||||
};
|
||||
|
|
|
@ -41,7 +41,7 @@ use crate::{
|
|||
SyntaxKind::{self, *},
|
||||
parsing::{
|
||||
token_set::TokenSet,
|
||||
parser_api::{CompletedMarker, Marker, Parser}
|
||||
parser::{CompletedMarker, Marker, Parser}
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
pub(super) mod event;
|
||||
pub(super) mod input;
|
||||
|
||||
use crate::parsing::{
|
||||
TreeSink, TokenSource,
|
||||
lexer::Token,
|
||||
parser_api::Parser,
|
||||
parser_impl::event::EventProcessor,
|
||||
};
|
||||
|
||||
/// Parse a sequence of tokens into the representative node tree
|
||||
pub(super) fn parse_with<S: TreeSink>(
|
||||
sink: S,
|
||||
text: &str,
|
||||
tokens: &[Token],
|
||||
parser: fn(&mut Parser),
|
||||
) -> S::Tree {
|
||||
let mut events = {
|
||||
let input = input::ParserInput::new(text, tokens);
|
||||
let mut parser_api = Parser::new(&input);
|
||||
parser(&mut parser_api);
|
||||
parser_api.finish()
|
||||
};
|
||||
EventProcessor::new(sink, text, tokens, &mut events).process().finish()
|
||||
}
|
|
@ -6,7 +6,7 @@ use crate::{
|
|||
parsing::{
|
||||
grammar, parse_with,
|
||||
builder::GreenBuilder,
|
||||
parser_api::Parser,
|
||||
parser::Parser,
|
||||
lexer::{tokenize, Token},
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue