422 releases

new 0.0.430 May 5, 2024
0.0.427 Apr 30, 2024
0.0.398 Mar 31, 2024
0.0.308 Dec 31, 2023
0.0.4 Nov 15, 2021

#29 in Parser tooling

Download history 122/week @ 2024-01-14 101/week @ 2024-01-21 47/week @ 2024-01-28 62/week @ 2024-02-04 310/week @ 2024-02-11 2163/week @ 2024-02-18 1601/week @ 2024-02-25 1172/week @ 2024-03-03 1868/week @ 2024-03-10 1384/week @ 2024-03-17 908/week @ 2024-03-24 1367/week @ 2024-03-31 1008/week @ 2024-04-07 1245/week @ 2024-04-14 1292/week @ 2024-04-21 855/week @ 2024-04-28

4,641 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
~55K SLoC