416 releases

new 0.0.424 Apr 27, 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

#29 in Parser tooling

Download history 171/week @ 2024-01-05 134/week @ 2024-01-12 109/week @ 2024-01-19 69/week @ 2024-01-26 50/week @ 2024-02-02 128/week @ 2024-02-09 1993/week @ 2024-02-16 1456/week @ 2024-02-23 1282/week @ 2024-03-01 1375/week @ 2024-03-08 1878/week @ 2024-03-15 996/week @ 2024-03-22 1315/week @ 2024-03-29 1039/week @ 2024-04-05 1200/week @ 2024-04-12 1064/week @ 2024-04-19

4,730 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.1–3MB
~54K SLoC