def _parse_text_rule(rule):
 if (not rule):
  return TrueCheck()
 state = ParseState()
 for (tok, value) in _parse_tokenize(rule):
  state.shift(tok, value)
 try:
  return state.result
 except ValueError:
  LOG.exception((_('Failed to understand rule %(rule)r') % locals()))
  return FalseCheck()

def _parse_text_rule ( rule ) : if ( not rule ) : return TrueCheck ( ) state = ParseState ( ) for ( tok , value ) in _parse_tokenize ( rule ) : state . shift ( tok , value ) try : return state . result except ValueError : LOG . exception ( ( _ ( 'Failed to understand rule %(rule)r' ) % locals ( ) ) ) return FalseCheck ( )
translates a policy written in the policy language into a tree of check objects .