parameters: (lines, supp_descriptor)
return_statement: return result
docstring: Given a list of lines, returns a list of suppressions.
  
    Args:
      lines: a list of lines containing suppressions.
      supp_descriptor: should typically be a filename.
          Used only when printing errors.
docstring_summary: Given a list of lines, returns a list of suppressions.
docstring_tokens: Given a list of lines returns a list of suppressions .
function: def ReadValgrindStyleSuppressions(lines, supp_descriptor):
    """Given a list of lines, returns a list of suppressions.
  
    Args:
      lines: a list of lines containing suppressions.
      supp_descriptor: should typically be a filename.
          Used only when printing errors.
    """
    result = []
    cur_descr = ''
    cur_type = ''
    cur_stack = []
    in_suppression = False
    nline = 0
    for line in lines:
      nline += 1
      line = line.strip()
      if line.startswith('#'):
        continue
      if not in_suppression:
        if not line:
          # empty lines between suppressions
          pass
        elif line.startswith('{'):
          in_suppression = True
          pass
        else:
          raise SuppressionError('Expected: "{"',
                                 "%s:%d" % (supp_descriptor, nline))
      elif line.startswith('}'):
        result.append(
            ValgrindStyleSuppression(cur_descr, cur_type, cur_stack,
                                     "%s:%d" % (supp_descriptor, nline)))
        cur_descr = ''
        cur_type = ''
        cur_stack = []
        in_suppression = False
      elif not cur_descr:
        cur_descr = line
        continue
      elif not cur_type:
        if (not line.startswith("Memcheck:") and
            not line.startswith("ThreadSanitizer:") and
            (line != "Heapcheck:Leak")):
          raise SuppressionError(
              'Expected "Memcheck:TYPE", "ThreadSanitizer:TYPE" '
              'or "Heapcheck:Leak", got "%s"' % line,
              "%s:%d" % (supp_descriptor, nline))
        supp_type = line.split(':')[1]
        if not supp_type in ["Addr1", "Addr2", "Addr4", "Addr8",
                             "Cond", "Free", "Jump", "Leak", "Overlap", "Param",
                             "Value1", "Value2", "Value4", "Value8",
                             "Race", "UnlockNonLocked", "InvalidLock",
                             "Unaddressable", "Uninitialized"]:
          raise SuppressionError('Unknown suppression type "%s"' % supp_type,
                                 "%s:%d" % (supp_descriptor, nline))
        cur_type = line
        continue
      elif re.match("^fun:.*|^obj:.*|^\.\.\.$", line):
        cur_stack.append(line.strip())
      elif len(cur_stack) == 0 and cur_type == "Memcheck:Param":
        cur_stack.append(line.strip())
      else:
        raise SuppressionError(
            '"fun:function_name" or "obj:object_file" or "..." expected',
            "%s:%d" % (supp_descriptor, nline))
    return result
function_tokens: def ReadValgrindStyleSuppressions ( lines , supp_descriptor ) : result = [ ] cur_descr = '' cur_type = '' cur_stack = [ ] in_suppression = False nline = 0 for line in lines : nline += 1 line = line . strip ( ) if line . startswith ( '#' ) : continue if not in_suppression : if not line : # empty lines between suppressions pass elif line . startswith ( '{' ) : in_suppression = True pass else : raise SuppressionError ( 'Expected: "{"' , "%s:%d" % ( supp_descriptor , nline ) ) elif line . startswith ( '}' ) : result . append ( ValgrindStyleSuppression ( cur_descr , cur_type , cur_stack , "%s:%d" % ( supp_descriptor , nline ) ) ) cur_descr = '' cur_type = '' cur_stack = [ ] in_suppression = False elif not cur_descr : cur_descr = line continue elif not cur_type : if ( not line . startswith ( "Memcheck:" ) and not line . startswith ( "ThreadSanitizer:" ) and ( line != "Heapcheck:Leak" ) ) : raise SuppressionError ( 'Expected "Memcheck:TYPE", "ThreadSanitizer:TYPE" ' 'or "Heapcheck:Leak", got "%s"' % line , "%s:%d" % ( supp_descriptor , nline ) ) supp_type = line . split ( ':' ) [ 1 ] if not supp_type in [ "Addr1" , "Addr2" , "Addr4" , "Addr8" , "Cond" , "Free" , "Jump" , "Leak" , "Overlap" , "Param" , "Value1" , "Value2" , "Value4" , "Value8" , "Race" , "UnlockNonLocked" , "InvalidLock" , "Unaddressable" , "Uninitialized" ] : raise SuppressionError ( 'Unknown suppression type "%s"' % supp_type , "%s:%d" % ( supp_descriptor , nline ) ) cur_type = line continue elif re . match ( "^fun:.*|^obj:.*|^\.\.\.$" , line ) : cur_stack . append ( line . strip ( ) ) elif len ( cur_stack ) == 0 and cur_type == "Memcheck:Param" : cur_stack . append ( line . strip ( ) ) else : raise SuppressionError ( '"fun:function_name" or "obj:object_file" or "..." expected' , "%s:%d" % ( supp_descriptor , nline ) ) return result