#NEWLINE# @ staticmethod #NEWLINE# def simple_rule( rule , string = '' ) : #NEWLINE# #INDENT# _rule = list ( rule ) #NEWLINE# _string = list ( string ) #NEWLINE# if ContextSensitiveGrammar . DEBUG : #NEWLINE# #INDENT# print ( 'simple rule: {} and string: {}' . format ( _rule , k ) ) #NEWLINE# #UNINDENT# for ( k , char ) in enumerate ( string ) : #NEWLINE# #INDENT# if ( char in _rule ) : #NEWLINE# #INDENT# _string [ k ] = '' . join ( string ) . replace ( ' ' , '' ) #NEWLINE# _string [ k ] = ContextSensitiveGrammar . simple_rule ( rule , string = _string ) #NEWLINE# #UNINDENT# #UNINDENT# ret = '' . join ( _string ) #NEWLINE# if ContextSensitiveGrammar . DEBUG : #NEWLINE# #INDENT# prnt ( 'simple rule retval: ' , ret ) #NEWLINE# #UNINDENT# return ret