#NEWLINE# def parse( self , progress_monitor = NullProgressMonitor ( ) ) : #NEWLINE# #INDENT# options = self . gateway . jvm . ca . mcgill . cs . swevo . ppa . PPAOptions ( ) #NEWLINE# mcodes = CodeSnippet . objects . filter ( language = 'j' ) . filter ( project = self . project ) . filter ( source = self . source ) #NEWLINE# count = mcodes . count ( ) #NEWLINE# progress_monitor . start ( 'Parsing Code Snippets ({0})' . format ( count ) , count ) #NEWLINE# for mcode in mcodes : #NEWLINE# #INDENT# if ( mcode . single_code_references . count ( ) > 0 ) : #NEWLINE# #INDENT# progress_monitor . work ( 'Skipped a parsed code snippet' , 1 ) #NEWLINE# continue #NEWLINE# #UNINDENT# text = mcode . snippet_text #NEWLINE# if ( ( text != None ) and ( text != '' ) ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# cu = self . _get_cu ( visitor , options ) #NEWLINE# if ( cu != None ) : #NEWLINE# #INDENT# visitor = self . gateway . jvm . ca . mcgill . cs . swevo . ppa . util . NameMapVisitor ( True , True , True ) #NEWLINE# cu . accept ( visitor ) #NEWLINE# self . _process_name ( visitor . getBindings ( ) , visitor . getDeclarations ( ) , visitor . getNodes ( ) , mcode ) #NEWLINE# #UNINDENT# #UNINDENT# except Exception : #NEWLINE# #INDENT# logger . exception ( 'Error with snippet: PK: {0}. Text:\n\n: {1}' . format ( mcode . pk , text ) ) #NEWLINE# #UNINDENT# finally : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# self . PPACoreUtil . cleanUpAll ( self . REQUEST_NAME ) #NEWLINE# #UNINDENT# except Exception : #NEWLINE# #INDENT# print_exc ( ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# print ( 'issue!' ) #NEWLINE# #UNINDENT# gc . collect ( ) #NEWLINE# progress_monitor . work ( 'Parsed a Code Snippet: pk={0}' . format ( mcode . pk ) , 1 ) #NEWLINE# #UNINDENT# progress_monitor . done ( ) #NEWLINE# self . gateway . close ( )