udled 0.8.0

Tokenizer and parser
Documentation
use udled::{any, Input};

#[test]
fn any_macro_single() {
    let mut input = Input::new("a");
    let item = input.parse(any!['a']).unwrap();
    assert_eq!(item.value, 'a');
}

#[test]
fn any_macro_multiple() {
    let mut input = Input::new("b");
    let item = input.parse(any!['a', 'b', 'c']).unwrap();
    let value = match item {
        udled::Either::Left(item) => item.value,
        udled::Either::Right(udled::Either::Left(item)) => item.value,
        udled::Either::Right(udled::Either::Right(item)) => item.value,
    };
    assert_eq!(value, 'b');

    let mut input = Input::new("d");
    assert!(input.parse(any!['a', 'b', 'c']).is_err());
}