679 releases

new 0.0.687 Feb 12, 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

#32 in Parser tooling

Download history 961/week @ 2024-10-27 1018/week @ 2024-11-03 948/week @ 2024-11-10 1128/week @ 2024-11-17 1193/week @ 2024-11-24 1078/week @ 2024-12-01 1252/week @ 2024-12-08 1027/week @ 2024-12-15 1031/week @ 2024-12-22 767/week @ 2024-12-29 1035/week @ 2025-01-05 844/week @ 2025-01-12 943/week @ 2025-01-19 452/week @ 2025-01-26 87/week @ 2025-02-02 299/week @ 2025-02-09

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