743 releases (63 stable)

new 1.2.60 May 6, 2025
1.2.54 Apr 30, 2025
1.2.28 Mar 31, 2025
0.0.688 Feb 27, 2025
0.0.4 Nov 15, 2021

#12 in Parser tooling

Download history 797/week @ 2025-01-14 909/week @ 2025-01-21 211/week @ 2025-01-28 79/week @ 2025-02-04 327/week @ 2025-02-11 133/week @ 2025-02-18 557/week @ 2025-02-25 1019/week @ 2025-03-04 1055/week @ 2025-03-11 986/week @ 2025-03-18 993/week @ 2025-03-25 511/week @ 2025-04-01 1050/week @ 2025-04-08 1254/week @ 2025-04-15 996/week @ 2025-04-22 815/week @ 2025-04-29

4,255 downloads per month
Used in 8 crates (4 directly)

MIT/Apache

395KB
9K SLoC

oni-comb-parser-rs

A Rust crate for LL(k) parser combinators.

Install to Cargo.toml

Add this to your Cargo.toml:

[dependencies]
oni-comb-parser-rs = "<<version>>"

Usage

use oni_comb_parser_rs::prelude::*;

fn main() {
  let input: &[u8; 14] = b"'hello world';";

  let parser: Parser<u8, &str> = surround(
    elm(b'\''),
    (seq(b"hello") + elm_space() + seq(b"world")).collect(),
    elm(b'\'') + elm(b';'),
  )
  .map_res(std::str::from_utf8);
  let result: &str = parser.parse(input).unwrap();

  println!("{}", result); // hello world
}

Influenced by the following parsers implementations

Examples

Alternative parsers

Dependencies

~2.1–3MB
~55K SLoC