示例#1
0
        def recursiverule(e):
            newe = rule(e)
            writer.write_if_enabled(newe, str(rule))

            LOG.debug("apply rule %s\n" +
                      colored("  -", "red") + " %s" + "\n" +
                      colored("  +", "green") + " %s", rule, e, newe)
            newe.apply(recursiverule)

            return newe
示例#2
0
        def recursiverule(e):
            newe = rule(e)
            writer.write_if_enabled(newe, str(rule))

            # log the optimizer step
            if str(e) == str(newe):
                LOG.debug("apply rule %s (no effect)\n" +
                          " %s \n", rule, e)
            else:
                LOG.debug("apply rule %s\n" +
                          colored("  -", "red") + " %s" + "\n" +
                          colored("  +", "green") + " %s", rule, e, newe)

            newe.apply(recursiverule)

            return newe
示例#3
0
        def recursiverule(e):
            newe = rule(e)
            writer.write_if_enabled(newe, str(rule))
            if newe.stop_recursion:
                return newe

            # log the optimizer step
            if str(e) == str(newe):
                LOG.debug("apply rule %s (no effect)\n" + " %s \n", rule, e)
            else:
                LOG.debug(
                    "apply rule %s\n" + colored("  -", "red") + " %s" + "\n" +
                    colored("  +", "green") + " %s", rule, e, newe)

            newe.apply(recursiverule)

            return newe