Skip to main content

Module rd

Module rd 

Source
Expand description

Lossless, static parsing of UTF-8 R documentation (.Rd) files.

The independent Rd CST retains source spelling, comments, and delimiters. Macro arguments select prose, R-like, or verbatim scanning; R-like text is not parsed as R expressions. Macros and conditionals are never evaluated.

use arity_parser::rd;
let source = "\\title{An example}\n";
let parsed = rd::parse(source);
assert!(parsed.diagnostics.is_empty());
assert_eq!(parsed.document().macros().next().unwrap().name(), "title");
assert_eq!(rd::reconstruct(source), source);

Re-exports§

pub use ast::Argument;
pub use ast::Conditional;
pub use ast::Document;
pub use ast::Group;
pub use ast::Macro;
pub use ast::Option;
pub use parser::ParseOutput;
pub use parser::parse;
pub use parser::reconstruct;
pub use syntax::RdLanguage;
pub use syntax::SyntaxElement;
pub use syntax::SyntaxKind;
pub use syntax::SyntaxNode;
pub use syntax::SyntaxToken;
pub use crate::parser::ParseDiagnostic;

Modules§

ast
Read-only navigation over the source CST, without semantic interpretation.
parser
A mode-aware source scanner and recoverable recursive-descent Rd parser.
syntax
Rd-specific rowan kinds. These are independent of the R and DCF kinds.