7 releases
0.2.2 | Mar 17, 2020 |
---|---|
0.2.1 | Mar 16, 2020 |
0.1.3 | Mar 16, 2020 |
#9 in #batteries
15KB
478 lines
kombi
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)>
- Implementation for
()
to ensure that there is nothing left to parseMany
for repeated occurrencesMaybe
for optionals (e.g.' '.maybe()
to allow, but not require, a space)NaturalNumber
for whole numbers between 0 andu128::max_value()
Or
for choosing between twoParser
sThen
for chaining multipleParser
s togetherTransform
for transforming the output of aParser
into another value.
("true".or("True"))
.or("false".or("False"))
.transform(|x|match x {
Either::A(_) => true,
Either::B(_) => false,
})
.parse_str("false!")? == ("!", false)