1.1 --- a/viewer.py Tue Nov 28 00:37:12 2006 +0100
1.2 +++ b/viewer.py Fri Dec 01 00:32:06 2006 +0100
1.3 @@ -121,6 +121,7 @@
1.4 display: none; z-index: 2;
1.5 position: absolute; top: 1em; left: 0.5em;
1.6 padding: 0.2em; background-color: #000000;
1.7 + border: 2px solid #dddddd;
1.8 }
1.9
1.10 .invocations {
1.11 @@ -188,14 +189,14 @@
1.12
1.13 Covered: Add, And, AssAttr, AssList, AssName, AssTuple, Assign, AugAssign,
1.14 Break, CallFunc, Class, Compare, Const, Continue, Dict, Discard,
1.15 - For, Function, Getattr, If, Keyword, Lambda, List, Module, Name,
1.16 - Not, Or, Pass, Raise, Return, Slice, Stmt, Subscript, TryExcept,
1.17 - TryFinally, Tuple, While.
1.18 + Div, FloorDiv, For, Function, Getattr, If, Keyword, Lambda, List,
1.19 + Module, Mul, Name, Not, Or, Pass, Raise, Return, Slice, Stmt, Sub,
1.20 + Subscript, TryExcept, TryFinally, Tuple, UnaryAdd, UnarySub, While.
1.21
1.22 - Missing: Assert, Backquote, Bitand, Bitor, Bitxor, Decorators, Div,
1.23 - Ellipsis, Exec, FloorDiv, From, Global, Import, Invert, LeftShift,
1.24 - ListComp, ListCompFor, ListCompIf, Mod, Mul, Not, Or, Power, Print,
1.25 - Printnl, RightShift, Sliceobj, Sub, UnaryAdd, UnarySub, Yield.
1.26 + Missing: Assert, Backquote, Bitand, Bitor, Bitxor, Decorators, Ellipsis,
1.27 + Exec, From, Global, Import, Invert, LeftShift, ListComp,
1.28 + ListCompFor, ListCompIf, Mod, Power, Print, Printnl, RightShift,
1.29 + Sliceobj, Yield.
1.30 """
1.31
1.32 def __init__(self, stream):
1.33 @@ -493,7 +494,7 @@
1.34 self.stream.write("</div>\n")
1.35 self.stream.write("</div>\n")
1.36
1.37 - # Expressions.
1.38 + # Expression-related helper methods.
1.39
1.40 def _visitBinary(self, node, name, symbol):
1.41 self.stream.write("<span class='%s'>\n" % name)
1.42 @@ -510,6 +511,21 @@
1.43 self.dispatch(node.right)
1.44 self.stream.write("</span>")
1.45
1.46 + def _visitUnary(self, node, name, symbol):
1.47 + self.stream.write("<span class='%s'>\n" % name)
1.48 + self.stream.write("<span class='operator'>\n")
1.49 + self.stream.write(symbol)
1.50 + self._popup_start()
1.51 + self.stream.write("<div class='invocations'>\n")
1.52 + self._invocations_list(node._node) # NOTE: See _visitUnary in simplify.
1.53 + self.stream.write("</div>\n")
1.54 + self._popup_end()
1.55 + self.stream.write("</span>\n")
1.56 + self.dispatch(node.expr)
1.57 + self.stream.write("</span>")
1.58 +
1.59 + # Expressions.
1.60 +
1.61 def visitAdd(self, node):
1.62 self._visitBinary(node, "add", "+")
1.63
1.64 @@ -606,6 +622,9 @@
1.65 def visitDiv(self, node):
1.66 self._visitBinary(node, "div", "/")
1.67
1.68 + def visitFloorDiv(self, node):
1.69 + self._visitBinary(node, "floordiv", "//")
1.70 +
1.71 def visitGetattr(self, node):
1.72 self.stream.write("<span class='getattr'>\n")
1.73 self.dispatch(node.expr)
1.74 @@ -701,6 +720,12 @@
1.75
1.76 visitTuple = visitAssTuple
1.77
1.78 + def visitUnaryAdd(self, node):
1.79 + self._visitUnary(node, "add", "+")
1.80 +
1.81 + def visitUnarySub(self, node):
1.82 + self._visitUnary(node, "sub", "-")
1.83 +
1.84 # Output preparation methods.
1.85
1.86 def _text(self, text):