rust/crates/ra_syntax/src/parsing.rs
Aleksey Kladov 1834bae5b8 allow rustfmt to reorder imports
This wasn't a right decision in the first place, the feature flag was
broken in the last rustfmt release, and syntax highlighting of imports
is more important anyway
2019-07-04 23:09:09 +03:00

22 lines
677 B
Rust

//! Lexing, bridging to ra_parser (which does the actual parsing) and
//! incremental reparsing.
mod lexer;
mod text_token_source;
mod text_tree_sink;
mod reparsing;
use crate::{syntax_node::GreenNode, SyntaxError};
pub use self::lexer::{classify_literal, tokenize, Token};
pub(crate) use self::reparsing::incremental_reparse;
pub(crate) fn parse_text(text: &str) -> (GreenNode, Vec<SyntaxError>) {
let tokens = tokenize(&text);
let mut token_source = text_token_source::TextTokenSource::new(text, &tokens);
let mut tree_sink = text_tree_sink::TextTreeSink::new(text, &tokens);
ra_parser::parse(&mut token_source, &mut tree_sink);
tree_sink.finish()
}