def _tgrep_segmented_pattern_action(_s, _l, tokens):
 node_label = tokens[0]
 reln_preds = tokens[1:]
 def pattern_segment_pred(n, m=None, l=None):
  u'This predicate function ignores its node argument.'
  if ((l is None) or (node_label not in l)):
   raise TgrepException(u'node_label ={0} not bound in pattern'.format(node_label))
  node = l[node_label]
  return all((pred(node, m, l) for pred in reln_preds))
 return pattern_segment_pred

def _tgrep_segmented_pattern_action ( _s , _l , tokens ) : node_label = tokens [ 0 ] reln_preds = tokens [ 1 : ] def pattern_segment_pred ( n , m = None , l = None ) : if ( ( l is None ) or ( node_label not in l ) ) : raise TgrepException ( u'node_label ={0} not bound in pattern' . format ( node_label ) ) node = l [ node_label ] return all ( ( pred ( node , m , l ) for pred in reln_preds ) ) return pattern_segment_pred
builds a lambda function representing a segmented pattern .