kul_core 0.1.2

Parser for a unique textual notation that can be used as both a data format and a markup language and that has powerful extensibility of both lexical syntax and semantics. Inspired by the little-known Curl programming language. Has no unsafe code and has no external dependencies. This is the core crate that is no_std and does not use heap allocation.
Documentation
#![allow(clippy::type_complexity)]

use std::{borrow::Borrow, iter::{repeat_with, FromIterator}};

use kul_core::{
    Parser, Datum,
    parser::{DatumAllocator, premade::{PairOperatorBindings, SliceDatumAllocator,
                                       DefaultCharClassifier}},
    combiner::{Combiner, OpFn, ApFn},
    text::{premade::TextDatumList, chunk::premade::PosStr},
    datum::premade::MutRefDatum,
};

use kul_shared_tests::{suites::test_suite0, bindings::BindingsSpec};


fn parser<DA, B, CE>(
    allocator: DA,
    bindings: B,
)
    -> Parser<DefaultCharClassifier,
              DA,
              PairOperatorBindings<B, DA, Box<OpFn<DA, CE>>, Box<ApFn<DA, CE>>, CE>>
where DA: DatumAllocator,
      B: Borrow<[(Datum<DA::TT, DA::ET, DA::DR>,
                  Combiner<Box<OpFn<DA, CE>>, Box<ApFn<DA, CE>>>)]>
{
    Parser {
        classifier: DefaultCharClassifier,
        allocator,
        bindings: PairOperatorBindings::new(bindings),
    }
}


#[test]
fn suite0_core_types() {
    type CombErr = u16;
    type Extra = bool;
    type Array<'a, 's> = [MutRefDatum<'a, TextDatumList<'a, PosStr<'s>, Extra>, Extra>];

    let mut datum_array: Box<Array<'_, '_>> =
        Vec::from_iter(repeat_with(|| Datum::Extra(true)).take(0x200))
        .into_boxed_slice();

    test_suite0(parser::<_, _, CombErr>(SliceDatumAllocator::new(&mut datum_array[..]),
                                        BindingsSpec::default()));
}