code: def scan(self, text):
          
          self.pos = 0
          self.text = text
          while self.pos < len(text):
              m = self.wsregexp.match(text, self.pos)
              if m is not None:
                  self.pos = m.end()
                  continue
  
              m = self.regexp.match(text, self.pos)
              if m is None:
                  raise ParseError("unknown token %s" % text[self.pos:])
  
              self.pos = m.end()
              yield (m.lastgroup, m.group(m.lastgroup))
docs: Analyse some data
  
          Analyse the passed content. Each time a token is recognized, a
          2-uple containing its name and parsed value is raised (via
          yield).
  
          On error, a ParseError exception is raised.
  
          :param text: a binary string containing the data to parse