1.1 --- a/viewer.py Sun Nov 26 21:28:11 2006 +0100
1.2 +++ b/viewer.py Mon Nov 27 01:06:38 2006 +0100
1.3 @@ -151,7 +151,8 @@
1.4 .op,
1.5 .name,
1.6 .attr,
1.7 - .conditional
1.8 + .conditional,
1.9 + .operator
1.10 {
1.11 position: relative;
1.12 }
1.13 @@ -159,7 +160,8 @@
1.14 .op:hover > .popup,
1.15 .name:hover > .popup,
1.16 .attr:hover > .popup,
1.17 - .conditional:hover > .popup
1.18 + .conditional:hover > .popup,
1.19 + .operator:hover > .popup
1.20 {
1.21 display: block;
1.22 }
1.23 @@ -180,16 +182,16 @@
1.24 """
1.25 A browsing visitor for AST nodes.
1.26
1.27 - Covered: And, AssAttr, AssList, AssName, AssTuple, Assign, AugAssign, Break,
1.28 - CallFunc, Class, Compare, Const, Continue, Dict, Discard, For,
1.29 - Function, Getattr, If, Keyword, Lambda, List, Module, Name, Not,
1.30 - Or, Pass, Raise, Return, Slice, Stmt, Subscript, Tuple, While.
1.31 + Covered: Add, And, AssAttr, AssList, AssName, AssTuple, Assign, AugAssign,
1.32 + Break, CallFunc, Class, Compare, Const, Continue, Dict, Discard,
1.33 + For, Function, Getattr, If, Keyword, Lambda, List, Module, Name,
1.34 + Not, Or, Pass, Raise, Return, Slice, Stmt, Subscript, TryExcept,
1.35 + TryFinally, Tuple, While.
1.36
1.37 - Missing: Add, Assert, Backquote, Bitand, Bitor, Bitxor, Decorators, Div,
1.38 + Missing: Assert, Backquote, Bitand, Bitor, Bitxor, Decorators, Div,
1.39 Ellipsis, Exec, FloorDiv, From, Global, Import, Invert, LeftShift,
1.40 ListComp, ListCompFor, ListCompIf, Mod, Mul, Not, Or, Power, Print,
1.41 - Printnl, RightShift, Sliceobj, Sub, TryExcept, TryFinally,
1.42 - UnaryAdd, UnarySub, Yield.
1.43 + Printnl, RightShift, Sliceobj, Sub, UnaryAdd, UnarySub, Yield.
1.44 """
1.45
1.46 def __init__(self, stream):
1.47 @@ -474,6 +476,21 @@
1.48
1.49 # Expressions.
1.50
1.51 + def visitAdd(self, node):
1.52 + self.stream.write("<span class='add'>\n")
1.53 + self.dispatch(node.left)
1.54 + self.stream.write("<span class='operator'>\n")
1.55 + self.stream.write("+")
1.56 + self._popup_start()
1.57 + self.stream.write("<div class='invocations'>\n")
1.58 + self._invocations_list(node._node.body[0].expr) # NOTE: See visitAdd in simplify.
1.59 + self._invocations_list(node._node.handler[0].body[0].expr) # NOTE: See visitAdd in simplify.
1.60 + self.stream.write("</div>\n")
1.61 + self._popup_end()
1.62 + self.stream.write("</span>\n")
1.63 + self.dispatch(node.right)
1.64 + self.stream.write("</span>")
1.65 +
1.66 def visitAnd(self, node):
1.67 self.stream.write("<span class='and'>\n")
1.68 first = 1
1.69 @@ -738,22 +755,22 @@
1.70 self._invocations(op)
1.71
1.72 def _invocations(self, node):
1.73 - if hasattr(node, "invocations"):
1.74 - self._invocations_list(node.invocations)
1.75 + self.stream.write("<div class='invocations'>\n")
1.76 + self._invocations_list(node)
1.77 + self.stream.write("</div>\n")
1.78
1.79 - def _invocations_list(self, invocations):
1.80 - self.stream.write("<div class='invocations'>\n")
1.81 - for invocation in invocations:
1.82 - fn = invocation.full_name()
1.83 - module = invocation.module.name
1.84 - name = invocation.name
1.85 - structures = [x.name for x in invocation.structures]
1.86 - self.stream.write("<div class='invocation'>")
1.87 - self.stream.write("<a href='%s.html#%s'>" % (self._url(module), self._url(fn)))
1.88 - self.stream.write(self._text(".".join([module] + structures + [name])))
1.89 - self.stream.write("</a>")
1.90 - self.stream.write("</div>\n")
1.91 - self.stream.write("</div>\n")
1.92 + def _invocations_list(self, node):
1.93 + if hasattr(node, "invocations"):
1.94 + for invocation in node.invocations:
1.95 + fn = invocation.full_name()
1.96 + module = invocation.module.name
1.97 + name = invocation.name
1.98 + structures = [x.name for x in invocation.structures]
1.99 + self.stream.write("<div class='invocation'>")
1.100 + self.stream.write("<a href='%s.html#%s'>" % (self._url(module), self._url(fn)))
1.101 + self.stream.write(self._text(".".join([module] + structures + [name])))
1.102 + self.stream.write("</a>")
1.103 + self.stream.write("</div>\n")
1.104
1.105 def _types(self, node):
1.106 if hasattr(node, "types"):