Type alias Continuation<D, E>

Continuation<D, E>: ((state: ParseState<D, E>) => void)

Type Parameters

Type declaration

    • (state: ParseState<D, E>): void
    • Internal

      The type of a continuation.

      Continuation-Passing style: Instead of returning transformation results (like with ParseStateTransformer), the transformed ParseState is passed to a continuation. The continuation then will get the new transformed ParseState and execute side-effects. Continuation: A function that accepts a state and executes side-effects with it.

      The continuation used is often defined at the start of a parse and it's goal is to register any state passed into it to a results array, so that those results will then be returned together.

      It is used in ContinuationParseStateTransformer functions, where it is executed with the transformed state from the state transformer.

      See

      Parameters

      • state: ParseState<D, E>

        The previous state to be transformed

      Returns void