admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame^] | 1 | <?xml version="1.0" encoding="ascii"?> |
| 2 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
| 3 | "DTD/xhtml1-transitional.dtd"> |
| 4 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
| 5 | <head> |
| 6 | <title>TestON.core.ast.NodeVisitor</title> |
| 7 | <link rel="stylesheet" href="epydoc.css" type="text/css" /> |
| 8 | <script type="text/javascript" src="epydoc.js"></script> |
| 9 | </head> |
| 10 | |
| 11 | <body bgcolor="white" text="black" link="blue" vlink="#204080" |
| 12 | alink="#204080"> |
| 13 | <!-- ==================== NAVIGATION BAR ==================== --> |
| 14 | <table class="navbar" border="0" width="100%" cellpadding="0" |
| 15 | bgcolor="#a0c0ff" cellspacing="0"> |
| 16 | <tr valign="middle"> |
| 17 | <!-- Home link --> |
| 18 | <th> <a |
| 19 | href="TestON-module.html">Home</a> </th> |
| 20 | |
| 21 | <!-- Tree link --> |
| 22 | <th> <a |
| 23 | href="module-tree.html">Trees</a> </th> |
| 24 | |
| 25 | <!-- Index link --> |
| 26 | <th> <a |
| 27 | href="identifier-index.html">Indices</a> </th> |
| 28 | |
| 29 | <!-- Help link --> |
| 30 | <th> <a |
| 31 | href="help.html">Help</a> </th> |
| 32 | |
| 33 | <th class="navbar" width="100%"></th> |
| 34 | </tr> |
| 35 | </table> |
| 36 | <table width="100%" cellpadding="0" cellspacing="0"> |
| 37 | <tr valign="top"> |
| 38 | <td width="100%"> |
| 39 | <span class="breadcrumbs"> |
| 40 | <a href="TestON-module.html">Package TestON</a> :: |
| 41 | <a href="TestON.core-module.html">Package core</a> :: |
| 42 | <a href="TestON.core.ast-module.html">Module ast</a> :: |
| 43 | Class NodeVisitor |
| 44 | </span> |
| 45 | </td> |
| 46 | <td> |
| 47 | <table cellpadding="0" cellspacing="0"> |
| 48 | <!-- hide/show private --> |
| 49 | <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink" |
| 50 | onclick="toggle_private();">hide private</a>]</span></td></tr> |
| 51 | <tr><td align="right"><span class="options" |
| 52 | >[<a href="frames.html" target="_top">frames</a |
| 53 | >] | <a href="TestON.core.ast.NodeVisitor-class.html" |
| 54 | target="_top">no frames</a>]</span></td></tr> |
| 55 | </table> |
| 56 | </td> |
| 57 | </tr> |
| 58 | </table> |
| 59 | <!-- ==================== CLASS DESCRIPTION ==================== --> |
| 60 | <h1 class="epydoc">Class NodeVisitor</h1><p class="nomargin-top"><span class="codelink"><a href="TestON.core.ast-pysrc.html#NodeVisitor">source code</a></span></p> |
| 61 | <pre class="base-tree"> |
| 62 | object --+ |
| 63 | | |
| 64 | <strong class="uidshort">NodeVisitor</strong> |
| 65 | </pre> |
| 66 | |
| 67 | <hr /> |
| 68 | <p>A node visitor base class that walks the abstract syntax tree and |
| 69 | calls a visitor function for every node found. This function may return |
| 70 | a value which is forwarded by the `visit` method.</p> |
| 71 | <p>This class is meant to be subclassed, with the subclass adding visitor |
| 72 | methods.</p> |
| 73 | <p>Per default the visitor functions for the nodes are ``'visit_'`` + |
| 74 | class name of the node. So a `TryFinally` node visit function would be |
| 75 | `visit_TryFinally`. This behavior can be changed by overriding the |
| 76 | `visit` method. If no visitor function exists for a node (return value |
| 77 | `None`) the `generic_visit` visitor is used instead.</p> |
| 78 | <p>Don't use the `NodeVisitor` if you want to apply changes to nodes |
| 79 | during traversing. For this a special visitor exists (`NodeTransformer`) |
| 80 | that allows modifications.</p> |
| 81 | |
| 82 | <!-- ==================== INSTANCE METHODS ==================== --> |
| 83 | <a name="section-InstanceMethods"></a> |
| 84 | <table class="summary" border="1" cellpadding="3" |
| 85 | cellspacing="0" width="100%" bgcolor="white"> |
| 86 | <tr bgcolor="#70b0f0" class="table-header"> |
| 87 | <td colspan="2" class="table-header"> |
| 88 | <table border="0" cellpadding="0" cellspacing="0" width="100%"> |
| 89 | <tr valign="top"> |
| 90 | <td align="left"><span class="table-header">Instance Methods</span></td> |
| 91 | <td align="right" valign="top" |
| 92 | ><span class="options">[<a href="#section-InstanceMethods" |
| 93 | class="privatelink" onclick="toggle_private();" |
| 94 | >hide private</a>]</span></td> |
| 95 | </tr> |
| 96 | </table> |
| 97 | </td> |
| 98 | </tr> |
| 99 | <tr> |
| 100 | <td width="15%" align="right" valign="top" class="summary"> |
| 101 | <span class="summary-type"> </span> |
| 102 | </td><td class="summary"> |
| 103 | <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
| 104 | <tr> |
| 105 | <td><span class="summary-sig"><a name="visit"></a><span class="summary-sig-name">visit</span>(<span class="summary-sig-arg">self</span>, |
| 106 | <span class="summary-sig-arg">node</span>)</span><br /> |
| 107 | Visit a node.</td> |
| 108 | <td align="right" valign="top"> |
| 109 | <span class="codelink"><a href="TestON.core.ast-pysrc.html#NodeVisitor.visit">source code</a></span> |
| 110 | |
| 111 | </td> |
| 112 | </tr> |
| 113 | </table> |
| 114 | |
| 115 | </td> |
| 116 | </tr> |
| 117 | <tr> |
| 118 | <td width="15%" align="right" valign="top" class="summary"> |
| 119 | <span class="summary-type"> </span> |
| 120 | </td><td class="summary"> |
| 121 | <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
| 122 | <tr> |
| 123 | <td><span class="summary-sig"><a name="generic_visit"></a><span class="summary-sig-name">generic_visit</span>(<span class="summary-sig-arg">self</span>, |
| 124 | <span class="summary-sig-arg">node</span>)</span><br /> |
| 125 | Called if no explicit visitor function exists for a node.</td> |
| 126 | <td align="right" valign="top"> |
| 127 | <span class="codelink"><a href="TestON.core.ast-pysrc.html#NodeVisitor.generic_visit">source code</a></span> |
| 128 | |
| 129 | </td> |
| 130 | </tr> |
| 131 | </table> |
| 132 | |
| 133 | </td> |
| 134 | </tr> |
| 135 | <tr> |
| 136 | <td colspan="2" class="summary"> |
| 137 | <p class="indent-wrapped-lines"><b>Inherited from <code>object</code></b>: |
| 138 | <code>__delattr__</code>, |
| 139 | <code>__format__</code>, |
| 140 | <code>__getattribute__</code>, |
| 141 | <code>__hash__</code>, |
| 142 | <code>__init__</code>, |
| 143 | <code>__new__</code>, |
| 144 | <code>__reduce__</code>, |
| 145 | <code>__reduce_ex__</code>, |
| 146 | <code>__repr__</code>, |
| 147 | <code>__setattr__</code>, |
| 148 | <code>__sizeof__</code>, |
| 149 | <code>__str__</code>, |
| 150 | <code>__subclasshook__</code> |
| 151 | </p> |
| 152 | </td> |
| 153 | </tr> |
| 154 | </table> |
| 155 | <!-- ==================== PROPERTIES ==================== --> |
| 156 | <a name="section-Properties"></a> |
| 157 | <table class="summary" border="1" cellpadding="3" |
| 158 | cellspacing="0" width="100%" bgcolor="white"> |
| 159 | <tr bgcolor="#70b0f0" class="table-header"> |
| 160 | <td colspan="2" class="table-header"> |
| 161 | <table border="0" cellpadding="0" cellspacing="0" width="100%"> |
| 162 | <tr valign="top"> |
| 163 | <td align="left"><span class="table-header">Properties</span></td> |
| 164 | <td align="right" valign="top" |
| 165 | ><span class="options">[<a href="#section-Properties" |
| 166 | class="privatelink" onclick="toggle_private();" |
| 167 | >hide private</a>]</span></td> |
| 168 | </tr> |
| 169 | </table> |
| 170 | </td> |
| 171 | </tr> |
| 172 | <tr> |
| 173 | <td colspan="2" class="summary"> |
| 174 | <p class="indent-wrapped-lines"><b>Inherited from <code>object</code></b>: |
| 175 | <code>__class__</code> |
| 176 | </p> |
| 177 | </td> |
| 178 | </tr> |
| 179 | </table> |
| 180 | <!-- ==================== NAVIGATION BAR ==================== --> |
| 181 | <table class="navbar" border="0" width="100%" cellpadding="0" |
| 182 | bgcolor="#a0c0ff" cellspacing="0"> |
| 183 | <tr valign="middle"> |
| 184 | <!-- Home link --> |
| 185 | <th> <a |
| 186 | href="TestON-module.html">Home</a> </th> |
| 187 | |
| 188 | <!-- Tree link --> |
| 189 | <th> <a |
| 190 | href="module-tree.html">Trees</a> </th> |
| 191 | |
| 192 | <!-- Index link --> |
| 193 | <th> <a |
| 194 | href="identifier-index.html">Indices</a> </th> |
| 195 | |
| 196 | <!-- Help link --> |
| 197 | <th> <a |
| 198 | href="help.html">Help</a> </th> |
| 199 | |
| 200 | <th class="navbar" width="100%"></th> |
| 201 | </tr> |
| 202 | </table> |
| 203 | <table border="0" cellpadding="0" cellspacing="0" width="100%%"> |
| 204 | <tr> |
| 205 | <td align="left" class="footer"> |
| 206 | Generated by Epydoc 3.0.1 on Mon Mar 11 12:56:26 2013 |
| 207 | </td> |
| 208 | <td align="right" class="footer"> |
| 209 | <a target="mainFrame" href="http://epydoc.sourceforge.net" |
| 210 | >http://epydoc.sourceforge.net</a> |
| 211 | </td> |
| 212 | </tr> |
| 213 | </table> |
| 214 | |
| 215 | <script type="text/javascript"> |
| 216 | <!-- |
| 217 | // Private objects are initially displayed (because if |
| 218 | // javascript is turned off then we want them to be |
| 219 | // visible); but by default, we want to hide them. So hide |
| 220 | // them unless we have a cookie that says to show them. |
| 221 | checkCookie(); |
| 222 | // --> |
| 223 | </script> |
| 224 | </body> |
| 225 | </html> |