def redefine(self, synopsis): """ Defines macros 'cond', 'loopBody', 'epilogue', and 'bad' in the environment. """ stmts = lambda x: FolFormula.join(self.SEMI, x, self.SKIP) delta = synopsis.expansion.delta delta.transformers += [ DeltaReduction.Transformer(delta, name, params=[], body=expr) for name, expr in [("cond", self.cond), ( "loopBody", self.body), ("epilogue", stmts(self.epilogue))] ] if not any( getattr(t, 'head', None) == "bad" for t in delta.transformers): bad = synopsis.expansion.parser * self.BAD delta.transformers += [ DeltaReduction.Transformer(delta, "bad", params=[], body=bad) ]
def join(self, connective=FolFormula.AND, default_value=None): return FolFormula.join(connective, self, default_value)