761 releases (81 stable)

new 1.2.78 May 26, 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

#14 in Parser tooling

Download history 75/week @ 2025-02-03 322/week @ 2025-02-10 141/week @ 2025-02-17 403/week @ 2025-02-24 1039/week @ 2025-03-03 1015/week @ 2025-03-10 965/week @ 2025-03-17 1065/week @ 2025-03-24 497/week @ 2025-03-31 1064/week @ 2025-04-07 1180/week @ 2025-04-14 1031/week @ 2025-04-21 961/week @ 2025-04-28 1072/week @ 2025-05-05 1550/week @ 2025-05-12 695/week @ 2025-05-19

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

MIT/Apache

160KB
4K 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–3MB
~55K SLoC