parameters: (source_lines)
docstring: Yields (struct_name, [struct_lines]).
docstring_summary: Yields (struct_name, [struct_lines]).
docstring_tokens: Yields ( struct_name [ struct_lines ] ) .
function: def Scan(source_lines):
    """Yields (struct_name, [struct_lines])."""
    in_struct = False
    for lno, line in enumerate(source_lines):
      if in_struct:
        name = Scan.END(line)
        if name:
          assert not ifdef_level, '#ifdef not closed in struct %s' % name.group(1)  # pylint bug; pylint: disable=used-before-assignment
          yield name.group(1), struct  # pylint: disable=used-before-assignment
          in_struct = False
        elif Scan.IFDEF(line):
          ifdef_level += 1
        elif Scan.ENDIF(line):
          ifdef_level -= 1
          assert ifdef_level >= 0, 'Dangling #endif at %d' % (lno + 1)
        elif not ifdef_level:
          struct.append(line)
      elif Scan.START(line):
        struct = []
        in_struct = True
        ifdef_level = 0
    assert not in_struct, 'Last struct not closed'
    assert not ifdef_level, '#ifdef not closed'
function_tokens: def Scan ( source_lines ) : in_struct = False for lno , line in enumerate ( source_lines ) : if in_struct : name = Scan . END ( line ) if name : assert not ifdef_level , '#ifdef not closed in struct %s' % name . group ( 1 ) # pylint bug; pylint: disable=used-before-assignment yield name . group ( 1 ) , struct # pylint: disable=used-before-assignment in_struct = False elif Scan . IFDEF ( line ) : ifdef_level += 1 elif Scan . ENDIF ( line ) : ifdef_level -= 1 assert ifdef_level >= 0 , 'Dangling #endif at %d' % ( lno + 1 ) elif not ifdef_level : struct . append ( line ) elif Scan . START ( line ) : struct = [ ] in_struct = True ifdef_level = 0 assert not in_struct , 'Last struct not closed' assert not ifdef_level , '#ifdef not closed'