Skip to main content

Crate arity_parser

Crate arity_parser 

Source
Expand description

Lossless CST parser, typed AST wrappers, and incremental reparser for the R language.

This crate is the parsing engine of arity, extracted so that other tools can build on it. The public surface mirrors the module layout of the arity crate itself:

  • syntax — SyntaxKind, the rowan language definition, and position-independent node pointers.
  • parser — the lossless parser (parse/reconstruct), diagnostics, the incremental reparse entry points (reparse, apply_edits), and the predicates that judge a parse against R’s own acceptance rules (is_single_expression).
  • ast — zero-cost typed wrappers over the CST, in rust-analyzer’s mould.
  • dcf — a second, independent grammar: a lossless CST for DCF, the format of R’s DESCRIPTION.
  • namespace — a typed, lossless view of R package NAMESPACE files, built on the R CST without evaluating conditional directives.
  • rd — an independent, lossless grammar for Rd help source files.

The parser preserves all source text: reconstruct(&parse(text).syntax()) is always text.

Modules§

ast
dcf
A lossless CST parser for DCF (Debian Control Format) — R’s DESCRIPTION format.
directive
The # arity… directive grammar, shared by the formatter and the linter.
namespace
A lossless, typed syntax surface for R package NAMESPACE files.
parser
rd
Lossless, static parsing of UTF-8 R documentation (.Rd) files.
syntax