Expand description
Lossless intermediate representation (IR) for network device configuration text.
This crate provides:
- a tree model (
Document,Node,LineNode,BlockNode) - a conservative parser (
parse_generic,parse_with_dialect) - a lossless renderer (
Document::render)
The parser is intentionally conservative for pre-alpha use:
- it only uses indentation as a structural cue
- unknown patterns are preserved as regular lines
- no input lines are dropped
§Example
use netform_ir::parse_generic;
let input = "interface Ethernet1\n description uplink\n";
let doc = parse_generic(input);
assert_eq!(doc.render(), input);Structs§
- Block
Node - Structured block node with a header line and nested children.
- Document
- Lossless parsed document backed by an arena and root node list.
- Document
Metadata - Document metadata attached during parsing.
- Generic
Dialect - Conservative default dialect for vendor-agnostic parsing.
- Line
Node - Leaf node preserving original raw text and parse metadata for one line.
- NodeId
- Stable arena identifier for a node in a
Document. - Parse
Finding - Parser-level uncertainty note attached to a source span.
- Parsed
Line Parts - Minimal tokenized representation of a content line.
- Path
- Location path used by diffs and diagnostics (
root_index, then child indices). - Span
- Source span pointing to a single line and byte range in the original input.
Enums§
- Dialect
Hint - Declared parser dialect used for this document.
- Node
- Arena node variant.
- Trivia
Kind - Lightweight classification used by parser, normalization, and diff views.
Traits§
- Dialect
- Dialect extension point for trivia classification and line tokenization.
Functions§
- parse_
generic - Parse input using the built-in generic dialect.
- parse_
with_ dialect - Parse input into a lossless IR using the given dialect implementation.