634 releases

new 0.0.642 Dec 11, 2024
0.0.631 Nov 30, 2024
0.0.513 Jul 31, 2024
0.0.398 Mar 31, 2024
0.0.4 Nov 15, 2021

#30 in Parser tooling

Download history 1258/week @ 2024-08-21 1059/week @ 2024-08-28 1256/week @ 2024-09-04 1698/week @ 2024-09-11 1487/week @ 2024-09-18 1511/week @ 2024-09-25 1536/week @ 2024-10-02 1633/week @ 2024-10-09 1500/week @ 2024-10-16 1135/week @ 2024-10-23 938/week @ 2024-10-30 1003/week @ 2024-11-06 973/week @ 2024-11-13 1193/week @ 2024-11-20 1125/week @ 2024-11-27 998/week @ 2024-12-04

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