Function rightAssoc1

  • Make a parser that parses any number of values and then one extra value to combine in right-to-left (last-to-first) order.

    Note: This can fail if pOper and pRight can consume same tokens. You'll have to make an ahead guard to prevent it from consuming the last token.

    Use rightAssoc2 if the grammar has an explicit operator between values.

    Implementation is based on ab and reduceRight.

    Type Parameters

    • TToken

    • TOptions

    • TRight

    Parameters

    • pOper: Parser<TToken, TOptions, ((y: TRight) => TRight)>

      A parser for each consecutive value. Result type is a transformation operation for the accumulator.

    • pRight: Parser<TToken, TOptions, TRight>

      A parser for the last value, also defines the result type (accumulator).

    Returns Parser<TToken, TOptions, TRight>

Generated using TypeDoc