and

fun and(pe: EvalPE<*>): EvalPE<Unit>

"And" predicate on the pe parsing expression. It succeed iff pe succeeds.

It worth noting that the pe won't be consumed, this is, its only a predicate and not something, that would be parsed. Thus, repeating it will yield the same result.

Samples

import io.kpeg.pe.Symbol.Rule
fun main() { 
   //sampleStart 
   // a - OK
// b - FAIL

and(char('a')) 
   //sampleEnd
}

Sources

JVM source
Link copied to clipboard