aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src/parsing.rs
blob: 761accd7be44671838de3596c8e7883d3ec430eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#[macro_use]
mod token_set;
mod builder;
mod lexer;
mod parser_impl;
mod parser_api;
mod grammar;
mod reparsing;

use crate::{
    SyntaxError,
    parsing::builder::GreenBuilder,
    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)
}