A matcher that combines a pattern and a parse procedure.
class procedure matcher[readonly value element type, any value result type]
implements validatable, matcher[element type, result type]
pattern[element type] the pattern
procedure[result type, readonly list[element type]] parser
implement void validate()
implement implicit boolean call(readonly list[element type] the list)
return the pattern(the list)
Check whether the given list can be a start of the sequence that matches this pattern.
implement boolean is viable prefix(readonly list[element type] the list)
return the patternis viable prefix(the list)
Returns the maximum number of the elements of a given list that matches the pattern, or null if there is no prefix match. This is a greedy match: it mtaches the longest prefix.
implement nonnegative or null match prefix(readonly list[element type] the list)
return the patternmatch prefix(the list)
Gets the first non-empty match for this pattern.
implement range or null find first(readonly list[element type] the list, nonnegative start index)
return the patternfind first(the list, start index)
immutable list[immutable list[element type]] split(immutable list[element type] the list)
return the patternsplit(the list)
Parse the list and produce a result. Assumes this pattern matches the list.
implement result type parse(readonly list[element type] the list)
return parser(the list)