500 releases

new 0.0.508 Jul 26, 2024
0.0.485 Jun 30, 2024
0.0.398 Mar 31, 2024
0.0.308 Dec 31, 2023
0.0.4 Nov 15, 2021

#25 in Parser tooling

Download history 1159/week @ 2024-04-04 1096/week @ 2024-04-11 1235/week @ 2024-04-18 1402/week @ 2024-04-25 976/week @ 2024-05-02 1299/week @ 2024-05-09 1371/week @ 2024-05-16 1370/week @ 2024-05-23 1077/week @ 2024-05-30 1387/week @ 2024-06-06 1407/week @ 2024-06-13 1382/week @ 2024-06-20 1042/week @ 2024-06-27 1085/week @ 2024-07-04 1084/week @ 2024-07-11 791/week @ 2024-07-18

4,212 downloads per month
Used in 6 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
~54K SLoC