This commit is contained in:
Aleksey Kladov 2019-02-20 23:05:59 +03:00
parent 4c1f9b8d4e
commit 61992dc1cd
5 changed files with 4 additions and 29 deletions

View file

@ -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,
};

View file

@ -41,7 +41,7 @@ use crate::{
SyntaxKind::{self, *},
parsing::{
token_set::TokenSet,
parser_api::{CompletedMarker, Marker, Parser}
parser::{CompletedMarker, Marker, Parser}
},
};

View file

@ -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()
}

View file

@ -6,7 +6,7 @@ use crate::{
parsing::{
grammar, parse_with,
builder::GreenBuilder,
parser_api::Parser,
parser::Parser,
lexer::{tokenize, Token},
}
};