#NEWLINE# def set_active_grammars( self ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# self . active_global_grammars = utilities . filter_grammar_list ( self . global_grammars , self . process_contexts ) #NEWLINE# #UNINDENT# except KeyError : #NEWLINE# #INDENT# self . active_global_grammars = [ ] #NEWLINE# #UNINDENT# self . active_local_grammars = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# self . active_global_grammars . sort ( reverse = True ) #NEWLINE# for ( app_pattern , grammar_list ) in self . local_grammars . items ( ) : #NEWLINE# #INDENT# active_list = utilities . filter_grammar_list ( grammar_list , self . process_contexts ) #NEWLINE# self . active_local_grammars [ app_pattern ] = ( active_list + self . active_global_grammars ) #NEWLINE# self . active_local_grammars [ app_pattern ] . sort ( reverse = True )