723 releases (43 stable)

new 1.2.40 Apr 16, 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 1178/week @ 2024-12-25 630/week @ 2025-01-01 1061/week @ 2025-01-08 851/week @ 2025-01-15 874/week @ 2025-01-22 90/week @ 2025-01-29 69/week @ 2025-02-05 333/week @ 2025-02-12 127/week @ 2025-02-19 706/week @ 2025-02-26 1022/week @ 2025-03-05 1018/week @ 2025-03-12 1030/week @ 2025-03-19 1010/week @ 2025-03-26 481/week @ 2025-04-02 875/week @ 2025-04-09

3,513 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–3MB
~55K SLoC