arity_parser/rd.rs
1//! Lossless, static parsing of UTF-8 R documentation (`.Rd`) files.
2//!
3//! The independent Rd CST retains source spelling, comments, and delimiters.
4//! Macro arguments select prose, R-like, or verbatim scanning; R-like text is
5//! not parsed as R expressions. Macros and conditionals are never evaluated.
6//!
7//! ```
8//! use arity_parser::rd;
9//! let source = "\\title{An example}\n";
10//! let parsed = rd::parse(source);
11//! assert!(parsed.diagnostics.is_empty());
12//! assert_eq!(parsed.document().macros().next().unwrap().name(), "title");
13//! assert_eq!(rd::reconstruct(source), source);
14//! ```
15
16pub mod ast;
17mod macros;
18pub mod parser;
19pub mod syntax;
20
21pub use ast::{Argument, Conditional, Document, Group, Macro, Option};
22pub use parser::{ParseOutput, parse, reconstruct};
23pub use syntax::{RdLanguage, SyntaxElement, SyntaxKind, SyntaxNode, SyntaxToken};
24
25pub use crate::parser::ParseDiagnostic;