peberminta - v0.10.0
    Preparing search index...

    Function takeUntil

    • Make a Matcher that returns all (0 or more) sequential matches of the same given parser while the test function equates to false (that is until it equates to true for the first time).

      Use many if there is no stop condition.

      Use takeUntilP if the stop condition is expressed as a parser.

      Implementation is based on takeWhile.

      Type Parameters

      • TToken
      • TOptions
      • TValue

      Parameters

      • p: Parser<TToken, TOptions, TValue>

        A parser.

      • test: (
            value: TValue,
            n: number,
            data: Data<TToken, TOptions>,
            i: number,
            j: number,
        ) => boolean

        Matched results are accumulated until the result of this function is true.

          • (
                value: TValue,
                n: number,
                data: Data<TToken, TOptions>,
                i: number,
                j: number,
            ): boolean
          • Parameters

            • value: TValue

              Current value matched by the parser.

            • n: number

              Number of matches so far (including the current value).

            • data: Data<TToken, TOptions>

              Data object (tokens and options).

            • i: number

              Parser position in the tokens array (before the current value matched).

            • j: number

              Parser position in the tokens array (after the current value matched).

            Returns boolean

      Returns Matcher<TToken, TOptions, TValue[]>