Skip to main content

Crate deb822_lossless

Crate deb822_lossless 

Source
Expand description

§Lossless parser for deb822 style files

§Example

use deb822_lossless::Deb822;
use std::str::FromStr;

let input = r#"Package: deb822-lossless
Maintainer: Jelmer Vernooij <jelmer@debian.org>
Section: rust

Package: deb822-lossless
Architecture: any
Description: Lossless parser for deb822 style files.
  This parser can be used to parse files in the deb822 format, while preserving
  all whitespace and comments. It is based on the [rowan] library, which is a
  lossless parser library for Rust.
"#;

let deb822 = Deb822::from_str(input).unwrap();
assert_eq!(deb822.paragraphs().count(), 2);

Structs§

Deb822
An AST node representing a Deb822.
Entry
An AST node representing a Entry.
Paragraph
An AST node representing a Paragraph.
Parse
The result of parsing: a syntax tree and a collection of errors.
ParseError
List of encountered syntax errors.
PositionedParseError
A positioned parse error containing location information.
TextRange
A range in text, represented as a pair of TextSize.
TextSize
A measure of text length. Also, equivalently, an index into text.

Enums§

Error
Error parsing deb822 control files
IndentPattern
Detected indentation pattern for multi-line field values
Indentation
The indentation to use when writing a deb822 file.
Lang
Second, implementing the Language trait teaches rowan to convert between these two SyntaxKind types, allowing for a nicer SyntaxNode API where “kinds” are values from our enum SyntaxKind, instead of plain u16 values.