mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 20:42:04 +00:00
move all parsing related bits to a separate module
This commit is contained in:
parent
9d0cda4bc8
commit
5222b8aba3
31 changed files with 78 additions and 47 deletions
24
crates/ra_syntax/src/parsing.rs
Normal file
24
crates/ra_syntax/src/parsing.rs
Normal file
|
@ -0,0 +1,24 @@
|
|||
#[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)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue