2019-02-20 12:47:32 +00:00
|
|
|
#[macro_use]
|
|
|
|
mod token_set;
|
|
|
|
mod builder;
|
|
|
|
mod lexer;
|
|
|
|
mod parser_impl;
|
|
|
|
mod parser_api;
|
|
|
|
mod reparsing;
|
|
|
|
mod grammar;
|
|
|
|
|
|
|
|
use crate::{
|
2019-02-20 13:16:14 +00:00
|
|
|
SyntaxError,
|
2019-02-20 12:47:32 +00:00
|
|
|
parsing::builder::GreenBuilder,
|
2019-02-20 13:16:14 +00:00
|
|
|
syntax_node::GreenNode,
|
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);
|
|
|
|
let (green, errors) =
|
|
|
|
parser_impl::parse_with(GreenBuilder::new(), text, &tokens, grammar::root);
|
|
|
|
(green, errors)
|
|
|
|
}
|