parameters: (clean_lines, linenum, init_suffix)
return_statement: return True
docstring: Find the corresponding > to close a template.
  
    Args:
      clean_lines: A CleansedLines instance containing the file.
      linenum: Current line number.
      init_suffix: Remainder of the current line after the initial <.
  
    Returns:
      True if a matching bracket exists.
docstring_summary: Find the corresponding > to close a template.
docstring_tokens: Find the corresponding > to close a template .
function: def FindNextMatchingAngleBracket(clean_lines, linenum, init_suffix):
    """Find the corresponding > to close a template.
  
    Args:
      clean_lines: A CleansedLines instance containing the file.
      linenum: Current line number.
      init_suffix: Remainder of the current line after the initial <.
  
    Returns:
      True if a matching bracket exists.
    """
    line = init_suffix
    nesting_stack = ['<']
    while True:
      # Find the next operator that can tell us whether < is used as an
      # opening bracket or as a less-than operator.  We only want to
      # warn on the latter case.
      #
      # We could also check all other operators and terminate the search
      # early, e.g. if we got something like this "a<b+c", the "<" is
      # most likely a less-than operator, but then we will get false
      # positives for default arguments (e.g. http://go/prccd) and
      # other template expressions (e.g. http://go/oxcjq).
      match = Search(r'^[^<>(),;\[\]]*([<>(),;\[\]])(.*)$', line)
      if match:
        # Found an operator, update nesting stack
        operator = match.group(1)
        line = match.group(2)
  
        if nesting_stack[-1] == '<':
          # Expecting closing angle bracket
          if operator in ('<', '(', '['):
            nesting_stack.append(operator)
          elif operator == '>':
            nesting_stack.pop()
            if not nesting_stack:
              # Found matching angle bracket
              return True
          elif operator == ',':
            # Got a comma after a bracket, this is most likely a template
            # argument.  We have not seen a closing angle bracket yet, but
            # it's probably a few lines later if we look for it, so just
            # return early here.
            return True
          else:
            # Got some other operator.
            return False
  
        else:
          # Expecting closing parenthesis or closing bracket
          if operator in ('<', '(', '['):
            nesting_stack.append(operator)
          elif operator in (')', ']'):
            # We don't bother checking for matching () or [].  If we got
            # something like (] or [), it would have been a syntax error.
            nesting_stack.pop()
  
      else:
        # Scan the next line
        linenum += 1
        if linenum >= len(clean_lines.elided):
          break
        line = clean_lines.elided[linenum]
  
    # Exhausted all remaining lines and still no matching angle bracket.
    # Most likely the input was incomplete, otherwise we should have
    # seen a semicolon and returned early.
    return True
function_tokens: def FindNextMatchingAngleBracket ( clean_lines , linenum , init_suffix ) : line = init_suffix nesting_stack = [ '<' ] while True : # Find the next operator that can tell us whether < is used as an # opening bracket or as a less-than operator.  We only want to # warn on the latter case. # # We could also check all other operators and terminate the search # early, e.g. if we got something like this "a<b+c", the "<" is # most likely a less-than operator, but then we will get false # positives for default arguments (e.g. http://go/prccd) and # other template expressions (e.g. http://go/oxcjq). match = Search ( r'^[^<>(),;\[\]]*([<>(),;\[\]])(.*)$' , line ) if match : # Found an operator, update nesting stack operator = match . group ( 1 ) line = match . group ( 2 ) if nesting_stack [ - 1 ] == '<' : # Expecting closing angle bracket if operator in ( '<' , '(' , '[' ) : nesting_stack . append ( operator ) elif operator == '>' : nesting_stack . pop ( ) if not nesting_stack : # Found matching angle bracket return True elif operator == ',' : # Got a comma after a bracket, this is most likely a template # argument.  We have not seen a closing angle bracket yet, but # it's probably a few lines later if we look for it, so just # return early here. return True else : # Got some other operator. return False else : # Expecting closing parenthesis or closing bracket if operator in ( '<' , '(' , '[' ) : nesting_stack . append ( operator ) elif operator in ( ')' , ']' ) : # We don't bother checking for matching () or [].  If we got # something like (] or [), it would have been a syntax error. nesting_stack . pop ( ) else : # Scan the next line linenum += 1 if linenum >= len ( clean_lines . elided ) : break line = clean_lines . elided [ linenum ] # Exhausted all remaining lines and still no matching angle bracket. # Most likely the input was incomplete, otherwise we should have # seen a semicolon and returned early. return True