726 releases (46 stable)

new 1.2.43 Apr 19, 2025
1.2.28 Mar 31, 2025
0.0.688 Feb 27, 2025
0.0.662 Dec 31, 2024
0.0.4 Nov 15, 2021

#11 in Parser tooling

Download history 914/week @ 2024-12-28 899/week @ 2025-01-04 869/week @ 2025-01-11 958/week @ 2025-01-18 549/week @ 2025-01-25 86/week @ 2025-02-01 200/week @ 2025-02-08 266/week @ 2025-02-15 152/week @ 2025-02-22 1019/week @ 2025-03-01 1001/week @ 2025-03-08 982/week @ 2025-03-15 1066/week @ 2025-03-22 657/week @ 2025-03-29 891/week @ 2025-04-05 832/week @ 2025-04-12

3,571 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.2–3.5MB
~56K SLoC