#NEWLINE# def _parse_text_rule( rule ) : #NEWLINE# #INDENT# 'Parses policy to the tree.\n\n    Translates a policy written in the policy language into a tree of\n    Check objects.\n    ' #NEWLINE# if ( not rule ) : #NEWLINE# #INDENT# return TrueCheck ( ) #NEWLINE# #UNINDENT# state = ParseState ( ) #NEWLINE# for ( tok , value ) in _parse_tokenize ( rule ) : #NEWLINE# #INDENT# state . shift ( tok , value ) #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# return state . result #NEWLINE# #UNINDENT# except ValueError : #NEWLINE# #INDENT# LOG . exception ( ( _LE ( 'Failed to understand rule %s' ) % rule ) ) #NEWLINE# return FalseCheck ( )