711 releases (31 stable)

new 1.2.28 Mar 31, 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

#13 in Parser tooling

Download history 1219/week @ 2024-12-09 1047/week @ 2024-12-16 1022/week @ 2024-12-23 752/week @ 2024-12-30 1076/week @ 2025-01-06 801/week @ 2025-01-13 930/week @ 2025-01-20 335/week @ 2025-01-27 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 863/week @ 2025-03-24

4,031 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