def parse_file(doc_file):
 output_entries = ''
 soup = BeautifulSoup(open(doc_file), 'html.parser')
 section_div = soup.find('div', attrs={'class': 'section'})
 title = get_title(section_div)
 if (not title):
  return ''
 abstract = get_abstract(section_div)
 if (not abstract):
  return ''
 related_topics = get_related_topics(section_div)
 redirects = get_redirects(title)
 url = (DOCS_URL + op.basename(doc_file))
 output_entries = OUTPUT_TEMPLATE.format(title=title, entry_type='A', redirect_title='', empty_field='', categories='', related_topics=related_topics, external_links='', disambiguation='', image='', abstract=abstract, url=url)
 for redirect in redirects:
  output_entries = ((output_entries + '\n') + OUTPUT_TEMPLATE.format(title=redirect, entry_type='R', redirect_title=title, empty_field='', categories='', related_topics='', external_links='', disambiguation='', image='', abstract='', url=''))
 return (output_entries + '\n')

def parse_file ( doc_file ) : output_entries = '' soup = BeautifulSoup ( open ( doc_file ) , 'html.parser' ) section_div = soup . find ( 'div' , attrs = { 'class' : 'section' } ) title = get_title ( section_div ) if ( not title ) : return '' abstract = get_abstract ( section_div ) if ( not abstract ) : return '' related_topics = get_related_topics ( section_div ) redirects = get_redirects ( title ) url = ( DOCS_URL + op . basename ( doc_file ) ) output_entries = OUTPUT_TEMPLATE . format ( title = title , entry_type = 'A' , redirect_title = '' , empty_field = '' , categories = '' , related_topics = related_topics , external_links = '' , disambiguation = '' , image = '' , abstract = abstract , url = url ) for redirect in redirects : output_entries = ( ( output_entries + '\n' ) + OUTPUT_TEMPLATE . format ( title = redirect , entry_type = 'R' , redirect_title = title , empty_field = '' , categories = '' , related_topics = '' , external_links = '' , disambiguation = '' , image = '' , abstract = '' , url = '' ) ) return ( output_entries + '\n' )
parse a c file using pycparser .