694 releases (14 stable)

new 1.2.11 Mar 14, 2025
0.0.688 Feb 27, 2025
0.0.662 Dec 31, 2024
0.0.631 Nov 30, 2024
0.0.4 Nov 15, 2021

#20 in Parser tooling

Download history 1205/week @ 2024-11-22 1115/week @ 2024-11-29 1247/week @ 2024-12-06 1035/week @ 2024-12-13 1011/week @ 2024-12-20 1060/week @ 2024-12-27 746/week @ 2025-01-03 898/week @ 2025-01-10 958/week @ 2025-01-17 675/week @ 2025-01-24 90/week @ 2025-01-31 179/week @ 2025-02-07 234/week @ 2025-02-14 196/week @ 2025-02-21 883/week @ 2025-02-28 836/week @ 2025-03-07

2,192 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