(f)
return z
Decorator for debugging parse actions.
Decorator for debugging parse actions.
Decorator for debugging parse actions .
def traceParseAction(f):
    """Decorator for debugging parse actions."""
    f = ParserElement._normalizeParseActionArgs(f)
    def z(*paArgs):
        thisFunc = f.func_name
        s,l,t = paArgs[-3:]
        if len(paArgs)>3:
            thisFunc = paArgs[0].__class__.__name__ + '.' + thisFunc
        sys.stderr.write( ">>entering %s(line: '%s', %d, %s)\n" % (thisFunc,line(l,s),l,t) )
        try:
            ret = f(*paArgs)
        except Exception, exc:
            sys.stderr.write( "<<leaving %s (exception: %s)\n" % (thisFunc,exc) )
            raise
        sys.stderr.write( "<<leaving %s (ret: %s)\n" % (thisFunc,ret) )
        return ret
    try:
        z.__name__ = f.__name__
    except AttributeError:
        pass
    return z
def traceParseAction ( f ) : f = ParserElement . _normalizeParseActionArgs ( f ) def z ( * paArgs ) : thisFunc = f . func_name s , l , t = paArgs [ - 3 : ] if len ( paArgs ) > 3 : thisFunc = paArgs [ 0 ] . __class__ . __name__ + '.' + thisFunc sys . stderr . write ( ">>entering %s(line: '%s', %d, %s)\n" % ( thisFunc , line ( l , s ) , l , t ) ) try : ret = f ( * paArgs ) except Exception , exc : sys . stderr . write ( "<<leaving %s (exception: %s)\n" % ( thisFunc , exc ) ) raise sys . stderr . write ( "<<leaving %s (ret: %s)\n" % ( thisFunc , ret ) ) return ret try : z . __name__ = f . __name__ except AttributeError : pass return z