kombi 0.2.2

A Parser Combinator Library
Documentation

kombi Foo

An Iterator-based Parser Combinator Library for Rust.

Included batteries:

  • Parser trait
    • Implementation for &str
    • Implementation for char
    • Implementation for <T, Iter: Iterator + Clone> Fn(Iter) -> Option<(Iter, T)>
  • () to ensure that there is nothing left to parse
  • Many for repeated occurrences
  • Maybe for optionals (e.g. ' '.maybe() to allow, but not require, a space)
  • NaturalNumber for whole numbers between 0 and u128::max_value()
  • Or for choosing between two Parsers
  • Then for chaining multiple Parsers together
  • Transform for transforming the output of a Parser into another value.
("true".or("True"))
.or("false".or("False"))
.transform(|x|match x {
    Either::A(_) => true,
    Either::B(_) => false,
})
.parse_str("false!")? == ("!", false)