code: def iterscan(self, string, idx=0, context=None):
          
          match = self.scanner.scanner(string, idx).match
          actions = self.actions
          lastend = idx
          end = len(string)
          while True:
              m = match()
              if m is None:
                  break
              matchbegin, matchend = m.span()
              if lastend == matchend:
                  break
              action = actions[m.lastindex]
              if action is not None:
                  rval, next_pos = action(m, context)
                  if next_pos is not None and next_pos != matchend:
                      # "fast forward" the scanner
                      matchend = next_pos
                      match = self.scanner.scanner(string, matchend).match
                  yield rval, matchend
              lastend = matchend
docs: Yield match, end_idx for each match