Skip to main content

Crate r_dcf_syntax

Crate r_dcf_syntax 

Source
Expand description

Lossless syntax trees, builders, and text-preserving edits for R DCF files.

Parsing is infallible: every input byte is represented in the syntax tree, while malformed constructs are reported separately as diagnostics.

§R DCF dialect

R package metadata uses a dialect derived from Debian Control Files. It is not interchangeable with Debian’s deb822 application rules: R field names are matched case-sensitively, duplicate declarations must remain available to callers, and # lines do not receive debian/control comment semantics. This crate also validates the portable field-name grammar used by R and unfolds dot-only continuation lines as logical blank lines.

These differences are why this crate has its own syntax model rather than exposing deb822-lossless as the raw layer. The parser retains malformed text in Rowan error nodes, preserves physical whitespace and line endings, and offers exact first/last duplicate lookup for the higher-level R metadata crates.

Re-exports§

pub use make::FormatStyle;
pub use make::LineEnding;
pub use make::document;
pub use make::field;
pub use make::record;

Modules§

make
Canonical text builders.

Structs§

Diagnostic
A parser diagnostic with a stable category and byte span.
Editor
A chainable editing session. Each operation is atomic; finish returns the latest persistent parse.
Field
Typed valid DCF field.
FieldName
A validated, case-sensitive DCF field name.
InvalidFieldName
Error returned for a field name outside the portable R DCF grammar.
InvalidLogicalValue
Error returned when logical text cannot be represented without ambiguity.
LogicalValue
An owned logical value, with physical line endings excluded.
Parse
Persistent parse result owning only a Rowan green tree and shared diagnostics.
Record
Typed DCF record.
Root
Typed document root.
SourceSpan
A byte span in the UTF-8 source text.
ValueText
Owned unfolded field text and the enclosing physical source range.

Enums§

DcfLanguage
Rowan language marker for R DCF trees.
DiagnosticKind
Stable category assigned to a parse diagnostic.
EditError
Failure to apply a structured edit.
SyntaxKind
The kinds of nodes and tokens in an R DCF syntax tree.

Functions§

parse
Parses UTF-8 R DCF text into a lossless syntax tree.

Type Aliases§

SyntaxElement
A typed Rowan node-or-token element.
SyntaxNode
A typed Rowan syntax node.
SyntaxToken
A typed Rowan syntax token.