#NEWLINE# def reduce( self ) : #NEWLINE# #INDENT# 'Perform a greedy reduction of the token stream.\n\n        If a reducer method matches, it will be executed, then the\n        reduce() method will be called recursively to search for any more\n        possible reductions.\n        ' #NEWLINE# for ( reduction , methname ) in self . reducers : #NEWLINE# #INDENT# if ( ( len ( self . tokens ) >= len ( reduction ) ) and ( self . tokens [ ( - len ( reduction ) ) : ] == reduction ) ) : #NEWLINE# #INDENT# meth = getattr ( self , methname ) #NEWLINE# results = meth ( * self . values [ ( - len ( reduction ) ) : ] ) #NEWLINE# self . tokens [ ( - len ( reduction ) ) : ] = [ r [ 0 ] for r in reduction ] #NEWLINE# self . values [ ( - len ( reduction ) ) : ] = [ r [ 1 ] for r in results ] #NEWLINE# return self . reduce ( )