678 releases

0.0.686 Jan 28, 2025
0.0.662 Dec 31, 2024
0.0.631 Nov 30, 2024
0.0.513 Jul 31, 2024
0.0.4 Nov 15, 2021

#31 in Parser tooling

Download history 1222/week @ 2024-10-22 930/week @ 2024-10-29 996/week @ 2024-11-05 945/week @ 2024-11-12 1202/week @ 2024-11-19 1148/week @ 2024-11-26 1090/week @ 2024-12-03 1245/week @ 2024-12-10 985/week @ 2024-12-17 1061/week @ 2024-12-24 773/week @ 2024-12-31 1066/week @ 2025-01-07 797/week @ 2025-01-14 909/week @ 2025-01-21 211/week @ 2025-01-28 58/week @ 2025-02-04

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

MIT/Apache

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