Instead of only indicating whether a given expression matches by returning a Bool, return a [(Index,Index)] where each pair of indices identifies a matching substring.
This can be implemented by changing the Status type. Instead of using a Bool to indicate whether an expression is final, use a [Index] to indicate where the words started that are now completely matched. In order to pass the starting index, the next function can pass it to activateFirst after the input string is zipped with [0..].
Instead of only indicating whether a given expression matches by returning a
Bool
, return a[(Index,Index)]
where each pair of indices identifies a matching substring.This can be implemented by changing the
Status
type. Instead of using aBool
to indicate whether an expression is final, use a[Index]
to indicate where the words started that are now completely matched. In order to pass the starting index, thenext
function can pass it toactivateFirst
after the input string iszip
ped with[0..]
.