+ def delete(self, alo, ahi, blo, bhi):
+ assert alo < ahi
+ assert blo == bhi
+ for i in xrange(alo, ahi):
+ call = self.a[i]
+ self.highlighter.write('- ')
+ self.dumpCallNos(call.no, None)
+ self.highlighter.strike()
+ self.highlighter.color(self.delete_color)
+ self.dumpCall(call)
+
+ def insert(self, alo, ahi, blo, bhi):
+ assert alo == ahi
+ assert blo < bhi
+ for i in xrange(blo, bhi):
+ call = self.b[i]
+ self.highlighter.write('+ ')
+ self.dumpCallNos(None, call.no)
+ self.highlighter.color(self.insert_color)
+ self.dumpCall(call)
+
+ def equal(self, alo, ahi, blo, bhi):
+ assert alo < ahi and blo < bhi
+ assert ahi - alo == bhi - blo
+ for i in xrange(0, bhi - blo):
+ self.highlighter.write(' ')
+ a_call = self.a[alo + i]
+ b_call = self.b[blo + i]
+ assert a_call.functionName == b_call.functionName
+ assert len(a_call.args) == len(b_call.args)
+ self.dumpCallNos(a_call.no, b_call.no)
+ self.dumpCall(b_call)
+
+ def dumpCallNos(self, aNo, bNo):
+ if not self.callNos:
+ return
+
+ if aNo is None:
+ self.highlighter.write(' '*self.aSpace)
+ else:
+ aNoStr = str(aNo)
+ self.highlighter.strike()
+ self.highlighter.color(self.delete_color)
+ self.highlighter.write(aNoStr)
+ self.highlighter.normal()
+ self.aSpace = len(aNoStr)
+ self.highlighter.write(' ')
+ if bNo is None:
+ self.highlighter.write(' '*self.bSpace)
+ else:
+ bNoStr = str(bNo)
+ self.highlighter.color(self.insert_color)
+ self.highlighter.write(bNoStr)
+ self.highlighter.normal()
+ self.bSpace = len(bNoStr)
+ self.highlighter.write(' ')
+
+ def dumpCall(self, call):
+ self.highlighter.bold(True)
+ self.highlighter.write(call.functionName)
+ self.highlighter.bold(False)
+ self.highlighter.write('(' + ', '.join(itertools.imap(self.dumper.visit, call.args)) + ')')
+ if call.ret is not None:
+ self.highlighter.write(' = ' + self.dumper.visit(call.ret))
+ self.highlighter.normal()
+ self.highlighter.write('\n')
+