#NEWLINE# def parse( self , content ) : #NEWLINE# #INDENT# 'Parse the contents of a Parser file and return a list\n        of root objects.\n        ' #NEWLINE# lines = content . splitlines ( ) #NEWLINE# if ( not lines ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# num_lines = len ( lines ) #NEWLINE# lines = list ( zip ( list ( range ( num_lines ) ) , lines ) ) #NEWLINE# self . sourcecode = lines [ : ] #NEWLINE# if __debug__ : #NEWLINE# #INDENT# trace ( ( 'Parser: parsing %d lines' % num_lines ) ) #NEWLINE# #UNINDENT# self . strip_comments ( lines ) #NEWLINE# self . execute_directives ( ) #NEWLINE# ( objects , remaining_lines ) = self . parse_level ( 0 , lines ) #NEWLINE# for rule in objects : #NEWLINE# #INDENT# rule . precompile ( ) #NEWLINE# #UNINDENT# if remaining_lines : #NEWLINE# #INDENT# ( ln , content ) = remaining_lines [ 0 ] #NEWLINE# raise ParserException ( self , ln , 'Invalid data (not parsed)' )