optional
Optional parsing expression that yields Some value of the type T on successful parsing, or None otherwise.
Samples
import io.kpeg.pe.Symbol.Rule
fun main() {
//sampleStart
// a - OK - Some('a')
// A - FAIL - None
// b - FAIL - None
char('a') // EvalPE<Char>
.optional() // EvalPE<Option<Char>>
//sampleEnd
}
Sources
JVM source
Link copied to clipboard