optional

fun <S, A> optional(parser: Parser<S, A>): Parser<S, A?>

Creates a parser that optionally matches the given parser.

Return

A parser that optionally matches the given parser.

Parameters

parser

The parser to optionally match.