code: def _iter_tokens(self):
          
          reobj, actions, nextstates = self._rules[self.states[-1]]
          mobj = reobj.match(self.string, self.pos)
          while mobj is not None:
              text = mobj.group(0)
              idx = mobj.lastindex - 1
              nextstate = nextstates[idx]
  
              # Take action
              actions[idx](self, text)
              while self.tokens:
                  yield self.pop_token()
              if nextstate and nextstate != self.states[-1]:
                  self.states[-1] = nextstate
  
              # Update position variables
              self.pos = mobj.end()
              lines = text.split('\n')
              nlines = len(lines) - 1
              if nlines == 0:
                  self.offset = self.offset + len(lines[0])
              else:
                  self.lineno = self.lineno + nlines
                  self.offset = 1 + len(lines[-1])
  
              reobj, actions, nextstates = self._rules[self.states[-1]]
              mobj = reobj.match(self.string, self.pos)
  
          if self.pos != len(self.string):
              msg = "unexpected character"
              text = self.string[self.pos]
              raise RunError(msg, self.lineno, self.offset, text)
  
          yield EndToken("", self.lineno, self.offset)
docs: Iterate through all tokens in the input string.