From 7c67612b8a894187fa3b64725531a5459f9211bf Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 10 Aug 2018 22:33:29 +0300 Subject: organizize --- crates/libsyntax2/src/lib.rs | 55 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 crates/libsyntax2/src/lib.rs (limited to 'crates/libsyntax2/src/lib.rs') 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 @@ +//! An experimental implementation of [Rust RFC#2256 libsyntax2.0][rfc#2256]. +//! +//! The intent is to be an IDE-ready parser, i.e. one that offers +//! +//! - easy and fast incremental re-parsing, +//! - graceful handling of errors, and +//! - maintains all information in the source file. +//! +//! For more information, see [the RFC][rfc#2265], or [the working draft][RFC.md]. +//! +//! [rfc#2256]: +//! [RFC.md]: + +#![forbid( + missing_debug_implementations, + unconditional_recursion, + future_incompatible +)] +#![deny(bad_style, missing_docs)] +#![allow(missing_docs)] +//#![warn(unreachable_pub)] // rust-lang/rust#47816 + +extern crate itertools; +extern crate text_unit; +extern crate unicode_xid; +extern crate drop_bomb; +extern crate parking_lot; + +pub mod algo; +pub mod ast; +mod lexer; +#[macro_use] +mod parser_api; +mod grammar; +mod parser_impl; + +mod syntax_kinds; +mod smol_str; +mod yellow; +/// Utilities for simple uses of the parser. +pub mod utils; + +pub use { + ast::{AstNode, File}, + lexer::{tokenize, Token}, + syntax_kinds::SyntaxKind, + text_unit::{TextRange, TextUnit}, + yellow::{SyntaxNode, SyntaxNodeRef, SyntaxRoot, TreeRoot, SyntaxError}, +}; + + +pub fn parse(text: &str) -> SyntaxNode { + let tokens = tokenize(&text); + parser_impl::parse::(text, &tokens) +} -- cgit v1.2.3