600 releases

new 0.0.608 Nov 7, 2024
0.0.602 Oct 31, 2024
0.0.513 Jul 31, 2024
0.0.398 Mar 31, 2024
0.0.4 Nov 15, 2021

#29 in Parser tooling

Download history 908/week @ 2024-07-18 1136/week @ 2024-07-25 938/week @ 2024-08-01 1002/week @ 2024-08-08 1260/week @ 2024-08-15 1255/week @ 2024-08-22 1026/week @ 2024-08-29 1245/week @ 2024-09-05 1774/week @ 2024-09-12 1496/week @ 2024-09-19 1591/week @ 2024-09-26 1497/week @ 2024-10-03 1555/week @ 2024-10-10 1518/week @ 2024-10-17 1074/week @ 2024-10-24 797/week @ 2024-10-31

5,194 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