mipl 0.2.1

Minimal Imperative Parsing Library
Documentation
use super::*;

/// Match any string.
/// 
/// In particular, match the [Token::Str] variant of
/// the [Token] enum, and return the inner [String].
pub struct AnyStrMatch;
impl Peeker for AnyStrMatch {
    type Item = String;

    fn peek_for_token(&self, parser: &mut Parser) -> Option<Token> {
        match parser.peek()? {
            Token::Str(s) => Some(Token::Str(s)),
            _ => None
        }
    }
}
impl ContainerCp for AnyStrMatch {
    type Input = ();
    type ContainedType = ();
    
    fn new(_value: Self::Input) -> Self {
        AnyStrMatch
    }
    fn new_contained(_value: Self::Input) -> Self::ContainedType {
        ()
    }
}