From e576b50fe251d249889aa77cc7c6ddc31cc5ba6d Mon Sep 17 00:00:00 2001 From: Boshen Date: Sun, 2 Apr 2023 00:23:21 +0800 Subject: [PATCH] docs(parser): add details --- crates/oxc_parser/src/lib.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/crates/oxc_parser/src/lib.rs b/crates/oxc_parser/src/lib.rs index 2971235fb..ad5451435 100644 --- a/crates/oxc_parser/src/lib.rs +++ b/crates/oxc_parser/src/lib.rs @@ -8,8 +8,10 @@ //! * No other heap allocations are done expect the above two //! * SIMD is used for skipping whitespace and multiline comments //! * [oxc_ast::Span] offsets uses `u32` instead of `usize` +//! * Scope binding, symbol resolution and complicated syntax errors are not done in the parser, +//! they are deligated to the [semantic analyzer](https://docs.rs/oxc_semantic) //! -//! # Parser Conformance +//! # Conformance //! The parser parses all of Test262 and most of Babel and TypeScript parser conformance tests. //! //! See [oxc coverage](https://github.com/Boshen/oxc/tree/main/tasks/coverage) for details @@ -24,6 +26,14 @@ //! AST Parsed : 2330/2340 (99.57%) //! ``` //! +//! # Usage +//! +//! The parser has a minimal API with three inputs and one return struct ([ParserReturn]). +//! +//! ```rust +//! let parser_return = Parser::new(&allocator, &source_text, source_type).parse(); +//! ``` +//! //! # Example //! //! @@ -78,7 +88,7 @@ use crate::{ state::ParserState, }; -/// Return value of parser +/// Return value of parser consisting of AST, errors and comments /// /// The parser always return a valid AST. /// When `panicked = true`, then program will always be empty.