def to_repr(self, seen): res = u"" pats_seen = set(seen) res += u"{%s}" % (u", ".join( map(lambda x: urepr(x, pats_seen), self._patterns))) res += u" ↦ " exp_seen = set(seen) res += urepr(self._expression, exp_seen) return res
def to_repr(self, seen): def rp(o): return name_if_lam(o, seen) r = u"C%d" % self._get_size_list() r += (urepr(self.w_expr, seen) + u"/[" + u", ".join([rp(x) for x in self._get_full_list()]) + u"]") if not isinstance(self.cont, execution.FinishContinuation): r += u"\n\t\t --> " + urepr(self.cont, seen) return r
def to_repr(self, seen): res = u"λ" res += self.name() res += u"(" res += u"; ".join(map(lambda x: urepr(x, seen), self._rules)) res += u")" return res
def name_if_lam(c, seen): res = u"" if isinstance(c, expression.Quote): res += "'" c = c.w_value if isinstance(c, model.W_Lambda): res += u"λ" + unicode(c._name) else: res += urepr(c, seen) return res
def _dot(self, seen): if self in seen: return seen.add(self) yield u'%s [label="%s", shape=box]' % (id(self), urepr(self)[:50]) ignored = ['_tag', '_lamb'] for key, value in self.__dict__.iteritems(): if key in ignored: # ignore certain properies continue if hasattr(value, "_dot"): yield u"%s -> %s [label=%s]" % (id(self), id(value), key) for line in value._dot(seen): yield line
def sw(l, seen): res = u"[" first = True for item in l: if first: first = False else: res += u", " if not item in seen: seen.add(item) if hasattr(item, "get_storage"): res += sw(item.get_storage(), seen) else: res += urepr(item) else: res += u"…" res += u"]" return res
def to_repr(self, seen): return u"&" + urepr(self._tag, seen) + u"(" \ + u", ".join(map(lambda x: urepr(x, seen), self._children)) \ + u")"
def to_repr(self, seen): return u"&" + urepr(self.variable, seen)
def mini_urepr(x): s = set(seen) s.discard(x) return urepr(x, s)
def to_repr(self, seen): return u"'" + urepr(self.w_value, seen)
def to_repr(self, seen): return u"^" + urepr(self._tag, seen) \ + ( (u"(" + u", ".join( map(lambda x: urepr(x, seen), self._children)) + u")") \ if len(self._children) > 0 else "")