• This overload makes a Matcher that applies two matchers one after another and joins the results.

    Use abc if you want to join 3 different parsers/matchers.

    Use left or right if you want to keep one result and discard another.

    Use all if you want a sequence of parsers of arbitrary length (but they have to share a common value type).

    Type Parameters

    • TToken

    • TOptions

    • TValueA

    • TValueB

    • TValue

    Parameters

    • pa: Matcher<TToken, TOptions, TValueA>

      First matcher.

    • pb: Matcher<TToken, TOptions, TValueB>

      Second matcher.

    • join: ((va: TValueA, vb: TValueB, data: Data<TToken, TOptions>, i: number, j: number) => TValue)

      A function to combine values from both matchers.

        • (va: TValueA, vb: TValueB, data: Data<TToken, TOptions>, i: number, j: number): TValue
        • Parameters

          • va: TValueA

            A value matched by the first matcher.

          • vb: TValueB

            A value matched by the second matcher.

          • data: Data<TToken, TOptions>

            Data object (tokens and options).

          • i: number

            Parser position in the tokens array (before both matchers matched).

          • j: number

            Parser position in the tokens array (after both matchers matched).

          Returns TValue

    Returns Matcher<TToken, TOptions, TValue>

  • Make a parser that tries two parsers one after another and joins the results.

    A nonmatch is returned if any of two parsers did not match.

    Use abc if you want to join 3 different parsers.

    Use left or right if you want to keep one result and discard another.

    Use all if you want a sequence of parsers of arbitrary length (but they have to share a common value type).

    Type Parameters

    • TToken

    • TOptions

    • TValueA

    • TValueB

    • TValue

    Parameters

    • pa: Parser<TToken, TOptions, TValueA>

      First parser.

    • pb: Parser<TToken, TOptions, TValueB>

      Second parser.

    • join: ((va: TValueA, vb: TValueB, data: Data<TToken, TOptions>, i: number, j: number) => TValue)

      A function to combine matched values from both parsers.

        • (va: TValueA, vb: TValueB, data: Data<TToken, TOptions>, i: number, j: number): TValue
        • Parameters

          • va: TValueA

            A value matched by the first parser.

          • vb: TValueB

            A value matched by the second parser.

          • data: Data<TToken, TOptions>

            Data object (tokens and options).

          • i: number

            Parser position in the tokens array (before both parsers matched).

          • j: number

            Parser position in the tokens array (after both parsers matched).

          Returns TValue

    Returns Parser<TToken, TOptions, TValue>

Generated using TypeDoc