code: def token(self):
      # Make local copies of frequently referenced attributes
      lexpos = self.lexpos
      lexlen = self.lexlen
      lexignore = self.lexignore
      lexdata = self.lexdata
  
      while lexpos < lexlen:
          # This code provides some short-circuit code for whitespace, tabs, and other ignored characters
          if lexdata[lexpos] in lexignore:
              lexpos += 1
              continue
  
          # Look for a regular expression match
          for lexre, lexindexfunc in self.lexre:
              m = lexre.match(lexdata, lexpos)
              if not m:
                  continue
  
              # Create a token for return
              tok = LexToken()
              tok.value = m.group()
              tok.lineno = self.lineno
              tok.lexpos = lexpos
  
              i = m.lastindex
              func, tok.type = lexindexfunc[i]
  
              if not func:
                  # If no token type was set, it's an ignored token
                  if tok.type:
                      self.lexpos = m.end()
                      return tok
                  else:
                      lexpos = m.end()
                      break
  
              lexpos = m.end()
  
              # If token is processed by a function, call it
  
              tok.lexer = self  # Set additional attributes useful in token rules
              self.lexmatch = m
              self.lexpos = lexpos
  
              newtok = func(tok)
  
              # Every function must return a token, if nothing, we just move to next token
              if not newtok:
                  lexpos = (
                      self.lexpos
                  )  # This is here in case user has updated lexpos.
                  lexignore = (
                      self.lexignore
                  )  # This is here in case there was a state change
                  break
  
              # Verify type of the token.  If not in the token map, raise an error
              if not self.lexoptimize:
                  if newtok.type not in self.lextokens_all:
                      raise LexError(
                          "%s:%d: Rule '%s' returned an unknown token type '%s'"
                          % (
                              func.__code__.co_filename,
                              func.__code__.co_firstlineno,
                              func.__name__,
                              newtok.type,
                          ),
                          lexdata[lexpos:],
                      )
  
              return newtok
          else:
              # No match, see if in literals
              if lexdata[lexpos] in self.lexliterals:
                  tok = LexToken()
                  tok.value = lexdata[lexpos]
                  tok.lineno = self.lineno
                  tok.type = tok.value
                  tok.lexpos = lexpos
                  self.lexpos = lexpos + 1
                  return tok
  
              # No match. Call t_error() if defined.
              if self.lexerrorf:
                  tok = LexToken()
                  tok.value = self.lexdata[lexpos:]
                  tok.lineno = self.lineno
                  tok.type = "error"
                  tok.lexer = self
                  tok.lexpos = lexpos
                  self.lexpos = lexpos
                  newtok = self.lexerrorf(tok)
                  if lexpos == self.lexpos:
                      # Error method didn't change text position at all. This is an error.
                      raise LexError(
                          "Scanning error. Illegal character '%s'"
                          % (lexdata[lexpos]),
                          lexdata[lexpos:],
                      )
                  lexpos = self.lexpos
                  if not newtok:
                      continue
                  return newtok
  
              self.lexpos = lexpos
              raise LexError(
                  "Illegal character '%s' at index %d"
                  % (lexdata[lexpos], lexpos),
                  lexdata[lexpos:],
              )
  
      if self.lexeoff:
          tok = LexToken()
          tok.type = "eof"
          tok.value = ""
          tok.lineno = self.lineno
          tok.lexpos = lexpos
          tok.lexer = self
          self.lexpos = lexpos
          newtok = self.lexeoff(tok)
          return newtok
  
      self.lexpos = lexpos + 1
      if self.lexdata is None:
          raise RuntimeError("No input string given with input()")
      return None
  
imports: import re
  import sys
  import types
  import copy
  import os
  import inspect
label_desc: Use image node_id 11 for calling the Lexer obj's underlying member method code with example usage: obj.token() and returns: None, newtok, newtok, tok, newtok, tok