'Iterate over all occurrences of any keyword in the string.
Returns (keyword, offset) pairs.'

def finditer(self, s):

    state = self.start_state
    start_state = (state, [])
    next_state = self.transitions.get
    pos = 0
    for char in s:
        pos += 1
        (state, matches) = next_state((state, char), start_state)
        if matches:
            for match in matches:
                (yield (match, (pos - len(match))))
