[][src]Module abnf::types

This module contains a collection of all types in the ABNF crate. The types can be used to manually construct new rules.

Note: currently you need to take care of some internals and use specific containers to construct the variants (e.g. Vec for an Alternation and String for a Rulename).

This crate will provide a better abstraction in the future.

Example

use abnf::types::*;

let rule = Rule::new("test", Node::Alternation(vec![
    Node::Rulename("A".into()),
    Node::Concatenation(vec![
        Node::Rulename("B".into()),
        Node::Rulename("C".into())
    ])
]));

println!("{}", rule); // prints "test = A / B C"

Structs

Repeat

An optionally lower and optionally upper bounded repeat value. Both bounds are inclusive.

Repetition

Struct to bind a Repeat value to a Node.

Rule

A single ABNF rule with a name, it's definition (implemented as Node) and a kind (Kind::Basic or Kind::Incremental).

Enums

Kind

Is a rule a basic rule or an incremental alternative? See https://tools.ietf.org/html/rfc5234#section-3.3

Node

A Node enumerates all building blocks in ABNF. Any rule is a composition of Nodes.

NumVal

A single value within a range (e.g. %x01-ff) or a terminal defined by a series of values (e.g. %x0f.f1.ce).