• Utility function that provides a bit cleaner interface for running a parser.

    This one throws an error in case parser didn't match OR the match is incomplete (some part of tokens array left unparsed).

    Returns

    A matched value.

    Type Parameters

    • TToken

    • TOptions

    • TValue

    Parameters

    • parser: Parser<TToken, TOptions, TValue>

      A parser to run.

    • tokens: TToken[]

      Input tokens.

    • options: TOptions

      Parser options.

    • formatToken: ((t: TToken) => string) = JSON.stringify

      A function to stringify a token (Defaults to JSON.stringify. For incomplete match error message).

        • (t: TToken): string
        • Parameters

          • t: TToken

          Returns string

    Returns TValue

Generated using TypeDoc