repeated

fun <T> EvalPE<T>.repeated(range: UIntRange): EvalPE<List<T>>

Repeat parsing expression an arbitrary number of times in the specified range.

Samples

import io.kpeg.pe.Symbol.Rule
fun main() { 
   //sampleStart 
   // a      - FAIL
// aaa    - OK
// aaaa   - OK
// aaaaa  - OK
// aaaaaa - FAIL

char('a')                     // EvalPE<Char>
    .repeated(range = 3u..5u) // EvalPE<List<Char>> 
   //sampleEnd
}
fun <T> EvalPE<T>.repeated(min: UInt = 0u, max: UInt = UInt.MAX_VALUE): EvalPE<List<T>>

Repeat parsing expression from the min to the max numbers of times.

Samples

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

char('a')                         // EvalPE<Char>
    .repeated(min = 1u, max = 2u) // EvalPE<List<Char>> 
   //sampleEnd
}