kombi

Crates.iokombi
lib.rskombi
version0.2.2
sourcesrc
created_at2020-03-16 15:27:00.238301
updated_at2020-03-17 09:54:42.205072
descriptionA Parser Combinator Library
homepage
repositoryhttps://github.com/jess-sch/kombi
max_upload_size
id219499
size15,127
Jess Schallenberg (jess-sch)

documentation

https://docs.rs/kombi

README

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)
Commit count: 10

cargo fmt