rust/crates/ra_syntax/src/parsing.rs

25 lines
543 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::{
parsing::builder::GreenBuilder,
syntax_node::{GreenNode, SyntaxError},
};
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)
}