parameters: (self)
return_statement: return subp
docstring: Internal method. Returns a characteristic path of the
          pattern tree. This method must be run for all leaves until the
          linear subpatterns are merged into a single
docstring_summary: Internal method. Returns a characteristic path of the
          pattern tree. This method must be run for all leaves until the
          linear subpatterns are merged into a single
docstring_tokens: Internal method . Returns a characteristic path of the pattern tree . This method must be run for all leaves until the linear subpatterns are merged into a single
function: def leaf_to_root(self):
          """Internal method. Returns a characteristic path of the
          pattern tree. This method must be run for all leaves until the
          linear subpatterns are merged into a single"""
          node = self
          subp = []
          while node:
              if node.type == TYPE_ALTERNATIVES:
                  node.alternatives.append(subp)
                  if len(node.alternatives) == len(node.children):
                      #last alternative
                      subp = [tuple(node.alternatives)]
                      node.alternatives = []
                      node = node.parent
                      continue
                  else:
                      node = node.parent
                      subp = None
                      break
  
              if node.type == TYPE_GROUP:
                  node.group.append(subp)
                  #probably should check the number of leaves
                  if len(node.group) == len(node.children):
                      subp = get_characteristic_subpattern(node.group)
                      node.group = []
                      node = node.parent
                      continue
                  else:
                      node = node.parent
                      subp = None
                      break
  
              if node.type == token_labels.NAME and node.name:
                  #in case of type=name, use the name instead
                  subp.append(node.name)
              else:
                  subp.append(node.type)
  
              node = node.parent
          return subp
function_tokens: def leaf_to_root ( self ) : node = self subp = [ ] while node : if node . type == TYPE_ALTERNATIVES : node . alternatives . append ( subp ) if len ( node . alternatives ) == len ( node . children ) : #last alternative subp = [ tuple ( node . alternatives ) ] node . alternatives = [ ] node = node . parent continue else : node = node . parent subp = None break if node . type == TYPE_GROUP : node . group . append ( subp ) #probably should check the number of leaves if len ( node . group ) == len ( node . children ) : subp = get_characteristic_subpattern ( node . group ) node . group = [ ] node = node . parent continue else : node = node . parent subp = None break if node . type == token_labels . NAME and node . name : #in case of type=name, use the name instead subp . append ( node . name ) else : subp . append ( node . type ) node = node . parent return subp