mipl 0.2.1

Minimal Imperative Parsing Library
Documentation
//! [Parsers](Parser) that consume parts of other [Parser]'s tokens.

use crate::prelude::*;

/// Functionality to build blanket [Parsers](Parser) using 
/// a parent [Parser] by consuming its
/// tokens based on some pattern.
/// 
/// The pattern depends on the generic `C`, which corresponds
/// to a concrete parser. (See [concrete_parser].)
pub trait ConcreteSubparser<C> {
    /// Build the subparser based on the concrete parser.
    fn subparse
    (value: C::Input, parser: &mut Parser) -> Parser
    where
        C: concrete_parser::ContainerCp;
}

/// Functionality to build blanket [Parsers](Parser) using
/// a parent [Parser] by consuming a list of tokens from it.
pub trait VariadicConcreteSubparser<C> {
    /// Build the subparser based on the concrete parser.
    fn subparse
    (values: Vec<C::Input>, parser: &mut Parser) -> Parser
    where 
        C: concrete_parser::ContainerCp;
}

mod collect_until;
mod collect_while;
mod collect_if_sequence;
pub use {
    collect_until::CollectUntil,
    collect_while::CollectWhile,
    collect_if_sequence::{CollectIfSeq, CollectIfExactSeq},
};