Skip to content
/ kombi Public

A Parser Combinator Library for Rust

License

Notifications You must be signed in to change notification settings

jess-sch/kombi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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)

About

A Parser Combinator Library for Rust

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages