aboutsummaryrefslogtreecommitdiff
path: root/crates/libsyntax2/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/libsyntax2/src/lib.rs')
-rw-r--r--crates/libsyntax2/src/lib.rs55
1 files changed, 55 insertions, 0 deletions
diff --git a/crates/libsyntax2/src/lib.rs b/crates/libsyntax2/src/lib.rs
new file mode 100644
index 000000000..ca33618a0
--- /dev/null
+++ b/crates/libsyntax2/src/lib.rs
@@ -0,0 +1,55 @@
1//! An experimental implementation of [Rust RFC#2256 libsyntax2.0][rfc#2256].
2//!
3//! The intent is to be an IDE-ready parser, i.e. one that offers
4//!
5//! - easy and fast incremental re-parsing,
6//! - graceful handling of errors, and
7//! - maintains all information in the source file.
8//!
9//! For more information, see [the RFC][rfc#2265], or [the working draft][RFC.md].
10//!
11//! [rfc#2256]: <https://github.com/rust-lang/rfcs/pull/2256>
12//! [RFC.md]: <https://github.com/matklad/libsyntax2/blob/master/docs/RFC.md>
13
14#![forbid(
15 missing_debug_implementations,
16 unconditional_recursion,
17 future_incompatible
18)]
19#![deny(bad_style, missing_docs)]
20#![allow(missing_docs)]
21//#![warn(unreachable_pub)] // rust-lang/rust#47816
22
23extern crate itertools;
24extern crate text_unit;
25extern crate unicode_xid;
26extern crate drop_bomb;
27extern crate parking_lot;
28
29pub mod algo;
30pub mod ast;
31mod lexer;
32#[macro_use]
33mod parser_api;
34mod grammar;
35mod parser_impl;
36
37mod syntax_kinds;
38mod smol_str;
39mod yellow;
40/// Utilities for simple uses of the parser.
41pub mod utils;
42
43pub use {
44 ast::{AstNode, File},
45 lexer::{tokenize, Token},
46 syntax_kinds::SyntaxKind,
47 text_unit::{TextRange, TextUnit},
48 yellow::{SyntaxNode, SyntaxNodeRef, SyntaxRoot, TreeRoot, SyntaxError},
49};
50
51
52pub fn parse(text: &str) -> SyntaxNode {
53 let tokens = tokenize(&text);
54 parser_impl::parse::<yellow::GreenBuilder>(text, &tokens)
55}