[][src]Module kul_core::premade::inmem

A Parser for parsing inputs that are in-memory strings, for no-heap constrained applications.

Re-exports

pub use crate::parser::premade::DefaultCharClassifier as CharClassifier;

Functions

parse_text_with

Parse the given Text, that contains the input string, using the given Parser, and return an Iterator of the results as Datum ASTs for each successfully-parsed top-level form and/or an Error.

parser

Make a new Parser that uses the given DatumSlice and BindingsSlice values for the DatumAllocator and OperatorBindings and that uses the types chosen by this module.

parser_no_bind

Make a new Parser that uses the given DatumSlice value for the DatumAllocator, that has no bindings of operators, and that uses the types chosen by this module.

Type Definitions

ApplicativeRef

Our Applicative reference type. A &dyn reference to a function as a trait object.

BindingsPair

A pair (2-tuple) that associates an operator sub-form with a macro function, to bind them.

BindingsSlice

A slice of pairs (2-tuples) that associate operator sub-forms with macro functions, to bind them. Used by our OperatorBindings via our parser constructor.

DatumAllocator

Chosen so that the Datums in the AST values returned from parsing are allocated from a contiguous slice of them, which itself must be pre-allocated by you, e.g. as an array on the stack.

DatumRef

Our Datum reference type. Wraps mutable borrows of other Datums of our type.

DatumSlice

A contiguous slice of our Datum type. Used by our DatumAllocator via our parser constructor.

DatumType

Our Datum type. Contains mutable borrows of other Datums of our type, wrapped in our DatumRef type.

OperativeRef

Our Operative reference type. A &dyn reference to a function as a trait object.

OperatorBindings

Chosen so that you may establish bindings using an immutable slice of pairs (2-tuples) and with flexible trait objects for the function types.

Parser

A Parser for parsing inputs that are in-memory strings, as &strs wrapped by this module's Text type, that is suitable for no-heap constrained applications that only use the stack, and that uses: the default characters as delimiters, slices to allocate the Datums in ASTs returned from parsing, and slices of pairs (2-tuples) to bind operator sub-forms to Combiner macro functions.

Text

Chosen so that the referenced parts of an input string are zero-copy, and so that char and byte positions are tracked (relative to the input &str), and so that, when chunks are broken around escape characters, a Datum list is used to logically concatenate them.

TopFormResult

The Result of parsing a top-level form, and the type of items yielded by parse_text_with.