Function until

  • It defines a TokenParser that will match anything until the given terminator parser matches. The terminator parser will not be consumed and index will stay just behind it so that it can be parsed right ahead. That is, if terminator is chained to until it will always succeed.

    If target reaches EOF before matching, an error with a semantic error value returned by EOFError gets returned.

    Returns

    A new TokenParser that matched everything until terminator.

    Type Parameters

    Parameters

    • terminator: TokenParser<D, E>

      The parser until which everything gets matched.

    • EOFError: ParseErrorProduction<E>

      A callback that returns a semantic error value for "Unexpected EOF".

    Returns TokenParser<D, E>