def _tgrep_macro_use_action(_s, _l, tokens):
 assert (len(tokens) == 1)
 assert (tokens[0][0] == u'@')
 macro_name = tokens[0][1:]
 def macro_use(n, m=None, l=None):
  if ((m is None) or (macro_name not in m)):
   raise TgrepException(u'macro {0} not defined'.format(macro_name))
  return m[macro_name](n, m, l)
 return macro_use

def _tgrep_macro_use_action ( _s , _l , tokens ) : assert ( len ( tokens ) == 1 ) assert ( tokens [ 0 ] [ 0 ] == u'@' ) macro_name = tokens [ 0 ] [ 1 : ] def macro_use ( n , m = None , l = None ) : if ( ( m is None ) or ( macro_name not in m ) ) : raise TgrepException ( u'macro {0} not defined' . format ( macro_name ) ) return m [ macro_name ] ( n , m , l ) return macro_use
builds a lambda function which looks up the macro name used .