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.
- Parse
Error - List of encountered syntax errors.
- Positioned
Parse Error - A positioned parse error containing location information.
- Text
Range - A range in text, represented as a pair of
TextSize. - Text
Size - A measure of text length. Also, equivalently, an index into text.
Enums§
- Error
- Error parsing deb822 control files
- Indent
Pattern - Detected indentation pattern for multi-line field values
- Indentation
- The indentation to use when writing a deb822 file.
- Lang
- Second, implementing the
Languagetrait teaches rowan to convert between these two SyntaxKind types, allowing for a nicer SyntaxNode API where “kinds” are values from ourenum SyntaxKind, instead of plain u16 values.