parameters: (clean_lines, linenum)
return_statement: return typenames
docstring: Find list of template arguments associated with this function declaration.
  
    Args:
      clean_lines: A CleansedLines instance containing the file.
      linenum: Line number containing the start of the function declaration,
               usually one line after the end of the template-argument-list.
    Returns:
      Set of type names, or empty set if this does not appear to have
      any template parameters.
docstring_summary: Find list of template arguments associated with this function declaration.
docstring_tokens: Find list of template arguments associated with this function declaration .
function: def GetTemplateArgs(clean_lines, linenum):
    """Find list of template arguments associated with this function declaration.
  
    Args:
      clean_lines: A CleansedLines instance containing the file.
      linenum: Line number containing the start of the function declaration,
               usually one line after the end of the template-argument-list.
    Returns:
      Set of type names, or empty set if this does not appear to have
      any template parameters.
    """
    # Find start of function
    func_line = linenum
    while func_line > 0:
      line = clean_lines.elided[func_line]
      if Match(r'^\s*$', line):
        return set()
      if line.find('(') >= 0:
        break
      func_line -= 1
    if func_line == 0:
      return set()
  
    # Collapse template-argument-list into a single string
    argument_list = ''
    match = Match(r'^(\s*template\s*)<', clean_lines.elided[func_line])
    if match:
      # template-argument-list on the same line as function name
      start_col = len(match.group(1))
      _, end_line, end_col = CloseExpression(clean_lines, func_line, start_col)
      if end_col > -1 and end_line == func_line:
        start_col += 1  # Skip the opening bracket
        argument_list = clean_lines.elided[func_line][start_col:end_col]
  
    elif func_line > 1:
      # template-argument-list one line before function name
      match = Match(r'^(.*)>\s*$', clean_lines.elided[func_line - 1])
      if match:
        end_col = len(match.group(1))
        _, start_line, start_col = ReverseCloseExpression(
            clean_lines, func_line - 1, end_col)
        if start_col > -1:
          start_col += 1  # Skip the opening bracket
          while start_line < func_line - 1:
            argument_list += clean_lines.elided[start_line][start_col:]
            start_col = 0
            start_line += 1
          argument_list += clean_lines.elided[func_line - 1][start_col:end_col]
  
    if not argument_list:
      return set()
  
    # Extract type names
    typenames = set()
    while True:
      match = Match(r'^[,\s]*(?:typename|class)(?:\.\.\.)?\s+(\w+)(.*)$',
                    argument_list)
      if not match:
        break
      typenames.add(match.group(1))
      argument_list = match.group(2)
    return typenames
function_tokens: def GetTemplateArgs ( clean_lines , linenum ) : # Find start of function func_line = linenum while func_line > 0 : line = clean_lines . elided [ func_line ] if Match ( r'^\s*$' , line ) : return set ( ) if line . find ( '(' ) >= 0 : break func_line -= 1 if func_line == 0 : return set ( ) # Collapse template-argument-list into a single string argument_list = '' match = Match ( r'^(\s*template\s*)<' , clean_lines . elided [ func_line ] ) if match : # template-argument-list on the same line as function name start_col = len ( match . group ( 1 ) ) _ , end_line , end_col = CloseExpression ( clean_lines , func_line , start_col ) if end_col > - 1 and end_line == func_line : start_col += 1 # Skip the opening bracket argument_list = clean_lines . elided [ func_line ] [ start_col : end_col ] elif func_line > 1 : # template-argument-list one line before function name match = Match ( r'^(.*)>\s*$' , clean_lines . elided [ func_line - 1 ] ) if match : end_col = len ( match . group ( 1 ) ) _ , start_line , start_col = ReverseCloseExpression ( clean_lines , func_line - 1 , end_col ) if start_col > - 1 : start_col += 1 # Skip the opening bracket while start_line < func_line - 1 : argument_list += clean_lines . elided [ start_line ] [ start_col : ] start_col = 0 start_line += 1 argument_list += clean_lines . elided [ func_line - 1 ] [ start_col : end_col ] if not argument_list : return set ( ) # Extract type names typenames = set ( ) while True : match = Match ( r'^[,\s]*(?:typename|class)(?:\.\.\.)?\s+(\w+)(.*)$' , argument_list ) if not match : break typenames . add ( match . group ( 1 ) ) argument_list = match . group ( 2 ) return typenames