Trait OperatorBindings

Source
pub trait OperatorBindings<DA>
where DA: DatumAllocator,
{ type OR: Deref<Target = OpFn<DA, Self::CE>>; type AR: Deref<Target = ApFn<DA, Self::CE>>; type CE; // Required method fn lookup( &self, operator: &Datum<DA::TT, DA::ET, DA::DR>, ) -> Option<&Combiner<Self::OR, Self::AR>>; }
Expand description

Environment of bindings of operator sub-forms to macro functions that substitute forms in a Parser’s returned AST.

Enables different applications to use different sets or none at all.

Required Associated Types§

Source

type OR: Deref<Target = OpFn<DA, Self::CE>>

The type of references to Operative macro functions.

Source

type AR: Deref<Target = ApFn<DA, Self::CE>>

The type of references to Applicative macro functions.

Source

type CE

Required Methods§

Source

fn lookup( &self, operator: &Datum<DA::TT, DA::ET, DA::DR>, ) -> Option<&Combiner<Self::OR, Self::AR>>

Look-up any binding we might have associated with the given datum, referenced by the operator argument, which was found in operator (first, “head”) position of a nested form. If we do have a binding for it, return the “combiner” function that determines the semantics of the entire form and further parses and processes it in possibly arbitrary ways. Else if we do not have a binding, return None to indicate that the form should not be handled according to the operator and that the operands should simply be recursively parsed.

Implementors§

Source§

impl<DA> OperatorBindings<DA> for EmptyOperatorBindings
where DA: DatumAllocator,

Source§

type OR = DummyOperativeRef<DA, <EmptyOperatorBindings as OperatorBindings<DA>>::CE>

Source§

type AR = DummyApplicativeRef<DA, <EmptyOperatorBindings as OperatorBindings<DA>>::CE>

Source§

type CE = ()

Source§

impl<P, DA, OR, AR, CE> OperatorBindings<DA> for PairOperatorBindings<P, DA, OR, AR, CE>
where P: Borrow<[(Datum<DA::TT, DA::ET, DA::DR>, Combiner<OR, AR>)]>, DA: DatumAllocator, Datum<DA::TT, DA::ET, DA::DR>: PartialEq, OR: Deref<Target = OpFn<DA, CE>>, AR: Deref<Target = ApFn<DA, CE>>,

Source§

type OR = OR

Source§

type AR = AR

Source§

type CE = CE