411 releases

new 0.0.419 Apr 22, 2024
0.0.398 Mar 31, 2024
0.0.308 Dec 31, 2023
0.0.277 Nov 30, 2023
0.0.4 Nov 15, 2021

#30 in Parser tooling

Download history 276/week @ 2023-12-25 286/week @ 2024-01-01 121/week @ 2024-01-08 116/week @ 2024-01-15 99/week @ 2024-01-22 51/week @ 2024-01-29 57/week @ 2024-02-05 408/week @ 2024-02-12 2285/week @ 2024-02-19 1529/week @ 2024-02-26 1197/week @ 2024-03-04 2014/week @ 2024-03-11 1240/week @ 2024-03-18 918/week @ 2024-03-25 1351/week @ 2024-04-01 473/week @ 2024-04-08

4,304 downloads per month
Used in 5 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–3MB
~55K SLoC