rust-analyzer/crates/ra_syntax/src/parsing.rs

26 lines
545 B
Rust
Raw Normal View History

#[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,
parsing::builder::GreenBuilder,
2019-02-20 13:16:14 +00:00
syntax_node::GreenNode,
};
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)
}