Skip to main content

Crate netform_ir

Crate netform_ir 

Source
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§

BlockNode
Structured block node with a header line and nested children.
Document
Lossless parsed document backed by an arena and root node list.
DocumentMetadata
Document metadata attached during parsing.
GenericDialect
Conservative default dialect for vendor-agnostic parsing.
LineNode
Leaf node preserving original raw text and parse metadata for one line.
NodeId
Stable arena identifier for a node in a Document.
ParseFinding
Parser-level uncertainty note attached to a source span.
ParsedLineParts
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§

DialectHint
Declared parser dialect used for this document.
Node
Arena node variant.
TriviaKind
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.