2019-02-21 12:24:42 +00:00
|
|
|
//! Lexing, bridging to ra_parser (which does the actual parsing) and
|
|
|
|
//! incremental reparsing.
|
|
|
|
|
2019-02-20 12:47:32 +00:00
|
|
|
mod lexer;
|
2019-02-20 19:52:32 +00:00
|
|
|
mod input;
|
2019-02-21 12:24:42 +00:00
|
|
|
mod builder;
|
2019-02-20 13:24:39 +00:00
|
|
|
mod reparsing;
|
2019-02-20 12:47:32 +00:00
|
|
|
|
|
|
|
use crate::{
|
2019-02-21 12:24:42 +00:00
|
|
|
SyntaxError,
|
|
|
|
syntax_node::GreenNode,
|
2019-02-20 19:52:32 +00:00
|
|
|
parsing::{
|
2019-02-21 09:03:42 +00:00
|
|
|
builder::TreeBuilder,
|
2019-02-20 19:52:32 +00:00
|
|
|
input::ParserInput,
|
|
|
|
},
|
2019-02-20 12:47:32 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
pub use self::lexer::{tokenize, Token};
|
|
|
|
|
|
|
|
pub(crate) use self::reparsing::incremental_reparse;
|
|
|
|
|
|
|
|
pub(crate) fn parse_text(text: &str) -> (GreenNode, Vec<SyntaxError>) {
|
|
|
|
let tokens = tokenize(&text);
|
2019-02-21 10:37:32 +00:00
|
|
|
let token_source = ParserInput::new(text, &tokens);
|
|
|
|
let mut tree_sink = TreeBuilder::new(text, &tokens);
|
2019-02-21 12:24:42 +00:00
|
|
|
ra_parser::parse(&token_source, &mut tree_sink);
|
2019-02-21 09:03:42 +00:00
|
|
|
tree_sink.finish()
|
2019-02-20 12:47:32 +00:00
|
|
|
}
|