option

fun <S : Any, A : Any> option(parser: Parser<S, A>, default: A): Parser<S, A>

Creates a parser that matches the given parser or returns a default value.

Return

A parser that matches the given parser or returns the default value.

Parameters

parser

The parser to match.

default

The default value to return if the parser does not match.