Matcher for a repeated pattern.
class repeat matcher[readonly value element type, covariant any value result type, any value intermediate type]
extends repeat pattern[element type]
implements matcher[element type, result type]
repeat matcher(matcher[element type, intermediate type] the pattern, boolean do match empty, procedure[result type, readonly list[intermediate type]] list converter)
super(the pattern, do match empty)
this • list converter = list converter
Parse the list and produce a result.
Assumes this pattern matches the list.
implement result type parse(readonly list[element type] the list)
var nonnegative index : 0
while index < the list • size
if match is null
assert match > 0
matched : (the pattern !> matcher[element type, intermediate type]) • parse(the list • slice(index, index + match))
index += match
return list converter(intermediate list)