Glue

Build Status Latest Version Documentation Minimum rustc version License:MIT lines of code

Glue is a parser combinator library that is designed for parsing text based formats with speed and efficiency.

Usage

```rust use glue::prelude::*;

let input = Context::from("foobar");

match merge(oneormore(is(alphabetic))).parse(input) { Ok((input, token)) => { println!("Found: {}", token.asstr()); }, Err() => { println!("Nothing found!"); } } ```

Writing your own parser functions

```rust use glue::prelude::*;

[derive(Debug, PartialEq)]

enum Token { Identifier(String), }

fn identifier<'i>() -> impl Parser<'i, Token> { move |input: Context<'i>| { let (input, token) = merge(oneormore(is(alphabetic))).parse(input)?;

    Ok((input, Token::Identifier(token.into())))
}

}

let input = Context::from("foobar");

assert_eq!(identifier().parse(input), Ok(( Context { input: "foobar", start: 6, end: 6, }, Token::Identifier("foobar".into()), ))); ```