choice
Prioritized choice of parsing expressions. Variants will be checked in the order in which they are placed, this is, firstPe, secondPe, otherPes.first(), ..., otherPes.last(). The first one to be successful will be the result of this operator.
Samples
import io.kpeg.pe.Symbol.Rule
fun main() {
//sampleStart
// alpha - OK
// beta - OK
// gamma - OK
// delta - FAIL
choice(
literal("alpha"),
literal("beta"),
literal("gamma"),
) // EvalPE<String>
//sampleEnd
}
Sources
JVM source
Link copied to clipboard