code: def get_rules(self):
      tsymbols = [f for f in self.ldict if f[:2] == "t_"]
  
      # Now build up a list of functions and a list of strings
      self.toknames = {}  # Mapping of symbols to token names
      self.funcsym = {}  # Symbols defined as functions
      self.strsym = {}  # Symbols defined as strings
      self.ignore = {}  # Ignore strings by state
      self.errorf = {}  # Error functions by state
      self.eoff = {}  # EOF functions by state
  
      for s in self.stateinfo:
          self.funcsym[s] = []
          self.strsym[s] = []
  
      if len(tsymbols) == 0:
          self.log.error("No rules of the form t_rulename are defined")
          self.error = True
          return
  
      for f in tsymbols:
          t = self.ldict[f]
          states, tokname = _statetoken(f, self.stateinfo)
          self.toknames[f] = tokname
  
          if hasattr(t, "__call__"):
              if tokname == "error":
                  for s in states:
                      self.errorf[s] = t
              elif tokname == "eof":
                  for s in states:
                      self.eoff[s] = t
              elif tokname == "ignore":
                  line = t.__code__.co_firstlineno
                  file = t.__code__.co_filename
                  self.log.error(
                      "%s:%d: Rule '%s' must be defined as a string",
                      file,
                      line,
                      t.__name__,
                  )
                  self.error = True
              else:
                  for s in states:
                      self.funcsym[s].append((f, t))
          elif isinstance(t, StringTypes):
              if tokname == "ignore":
                  for s in states:
                      self.ignore[s] = t
                  if "\\" in t:
                      self.log.warning(
                          "%s contains a literal backslash '\\'", f
                      )
  
              elif tokname == "error":
                  self.log.error(
                      "Rule '%s' must be defined as a function", f
                  )
                  self.error = True
              else:
                  for s in states:
                      self.strsym[s].append((f, t))
          else:
              self.log.error(
                  "%s not defined as a function or string", f
              )
              self.error = True
  
      # Sort the functions by line number
      for f in self.funcsym.values():
          f.sort(key=lambda x: x[1].__code__.co_firstlineno)
  
      # Sort the strings by regular expression length
      for s in self.strsym.values():
          s.sort(key=lambda x: len(x[1]), reverse=True)
  
imports: import re
  import sys
  import types
  import copy
  import os
  import inspect
label_desc: Use image node_id 9 for calling the LexerReflect obj's underlying member method code with example usage: obj.get_rules() without return types