paulb@31 | 1 | #!/usr/bin/env python |
paulb@31 | 2 | |
paulb@31 | 3 | """ |
paulb@47 | 4 | Fix name-related operations. The code in this module operates upon simplified |
paulb@47 | 5 | program node trees. |
paulb@31 | 6 | |
paulb@31 | 7 | Copyright (C) 2006 Paul Boddie <paul@boddie.org.uk> |
paulb@31 | 8 | |
paulb@31 | 9 | This software is free software; you can redistribute it and/or |
paulb@31 | 10 | modify it under the terms of the GNU General Public License as |
paulb@31 | 11 | published by the Free Software Foundation; either version 2 of |
paulb@31 | 12 | the License, or (at your option) any later version. |
paulb@31 | 13 | |
paulb@31 | 14 | This software is distributed in the hope that it will be useful, |
paulb@31 | 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
paulb@31 | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
paulb@31 | 17 | GNU General Public License for more details. |
paulb@31 | 18 | |
paulb@31 | 19 | You should have received a copy of the GNU General Public |
paulb@31 | 20 | License along with this library; see the file LICENCE.txt |
paulb@31 | 21 | If not, write to the Free Software Foundation, Inc., |
paulb@31 | 22 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA |
paulb@46 | 23 | |
paulb@46 | 24 | -------- |
paulb@46 | 25 | |
paulb@57 | 26 | To use this module, the easiest approach is to use the fix function: |
paulb@57 | 27 | |
paulb@57 | 28 | fix(module) |
paulb@57 | 29 | |
paulb@57 | 30 | The more complicated approach involves instantiating a Fixer object: |
paulb@46 | 31 | |
paulb@46 | 32 | fixer = Fixer() |
paulb@46 | 33 | |
paulb@57 | 34 | Then, applying the fixer to an existing module: |
paulb@46 | 35 | |
paulb@57 | 36 | fixer.process(module) |
paulb@46 | 37 | |
paulb@57 | 38 | If a module containing built-in classes and functions exists, apply the fixer as |
paulb@57 | 39 | follows: |
paulb@46 | 40 | |
paulb@57 | 41 | fixer.process(module, builtins) |
paulb@31 | 42 | """ |
paulb@31 | 43 | |
paulb@31 | 44 | from simplified import * |
paulb@31 | 45 | |
paulb@31 | 46 | # Fixing of name-related operations. |
paulb@31 | 47 | |
paulb@31 | 48 | class Fixer(Visitor): |
paulb@31 | 49 | |
paulb@31 | 50 | """ |
paulb@47 | 51 | The name fixer which traverses the program nodes in a module, typically |
paulb@47 | 52 | depth-first, and maintains a record of name usage in the different |
paulb@47 | 53 | namespaces. As a consequence of various observations, some parts of the |
paulb@47 | 54 | program node tree are modified with different operations employed to those |
paulb@47 | 55 | originally defined. |
paulb@47 | 56 | |
paulb@47 | 57 | There are two kinds of subprograms in modules: functions/methods and |
paulb@47 | 58 | internal subprograms which support things like loops. The latter kind of |
paulb@47 | 59 | subprogram may acquire the locals from their callers and must therefore be |
paulb@47 | 60 | traversed with information from such callers. Thus, we choose the top-level |
paulb@47 | 61 | code and all functions/methods as roots for processing, following |
paulb@47 | 62 | invocations of internal subprograms in order to reach all subprograms that |
paulb@47 | 63 | are defined in each module. |
paulb@47 | 64 | |
paulb@47 | 65 | top-level |
paulb@47 | 66 | ... |
paulb@47 | 67 | invoke function |
paulb@47 | 68 | ... |
paulb@47 | 69 | invoke loop -> subprogram (internal) |
paulb@47 | 70 | ... |
paulb@47 | 71 | |
paulb@47 | 72 | subprogram (function) |
paulb@47 | 73 | ... |
paulb@47 | 74 | invoke loop -> subprogram (internal) |
paulb@47 | 75 | ... |
paulb@47 | 76 | |
paulb@47 | 77 | ... |
paulb@47 | 78 | |
paulb@47 | 79 | The above approach should guarantee that all subprograms are traversed and |
paulb@47 | 80 | that all name lookups are correctly categorised. |
paulb@31 | 81 | """ |
paulb@31 | 82 | |
paulb@31 | 83 | def __init__(self): |
paulb@45 | 84 | |
paulb@45 | 85 | "Initialise the name fixer." |
paulb@45 | 86 | |
paulb@31 | 87 | Visitor.__init__(self) |
paulb@31 | 88 | |
paulb@31 | 89 | # Satisfy visitor issues. |
paulb@31 | 90 | |
paulb@31 | 91 | self.visitor = self |
paulb@31 | 92 | |
paulb@57 | 93 | def process(self, module, builtins=None): |
paulb@45 | 94 | |
paulb@46 | 95 | """ |
paulb@57 | 96 | Process the given 'module' optionally using some 'builtins' to reference |
paulb@57 | 97 | built-in objects. |
paulb@46 | 98 | """ |
paulb@45 | 99 | |
paulb@47 | 100 | # The fixer maintains a list of transformed subprograms (added for each |
paulb@47 | 101 | # of the processing "roots" and also for each invoked internal |
paulb@47 | 102 | # subprogram), along with a list of current subprograms (used to avoid |
paulb@47 | 103 | # recursion issues) and a list of current namespaces (used to recall |
paulb@47 | 104 | # namespaces upon invoking internal subprograms). |
paulb@47 | 105 | |
paulb@45 | 106 | self.subprograms = [] |
paulb@45 | 107 | self.current_subprograms = [] |
paulb@45 | 108 | self.current_namespaces = [] |
paulb@45 | 109 | |
paulb@45 | 110 | # First, process the top-level code, finding out which names are |
paulb@45 | 111 | # defined at that level. |
paulb@45 | 112 | |
paulb@45 | 113 | self.global_namespace = None |
paulb@57 | 114 | self.module = module |
paulb@57 | 115 | self.builtins = builtins |
paulb@47 | 116 | |
paulb@57 | 117 | self.process_node(self.module) |
paulb@45 | 118 | |
paulb@45 | 119 | # Then, process all functions and methods, providing a global namespace. |
paulb@47 | 120 | # By setting a global namespace, we influence the resolution of names: |
paulb@47 | 121 | # those which are global to the top-level module (processed above) are |
paulb@47 | 122 | # considered as built-in names, whereas those which are global to a |
paulb@47 | 123 | # function or method are searched for in the global namespace. |
paulb@45 | 124 | |
paulb@45 | 125 | self.global_namespace = self.namespace |
paulb@45 | 126 | |
paulb@57 | 127 | for subprogram in self.module.simplifier.subprograms: |
paulb@45 | 128 | |
paulb@45 | 129 | # Internal subprograms are skipped here and processed specially via |
paulb@45 | 130 | # Invoke nodes. |
paulb@45 | 131 | |
paulb@112 | 132 | if not getattr(subprogram, "internal", 0): |
paulb@45 | 133 | self.subprograms.append(self.process_node(subprogram)) |
paulb@45 | 134 | |
paulb@47 | 135 | # Ultimately, we redefine the list of subprograms on the visitor. |
paulb@47 | 136 | |
paulb@57 | 137 | self.module.simplifier.subprograms = self.subprograms |
paulb@57 | 138 | return self.module |
paulb@31 | 139 | |
paulb@45 | 140 | def process_node(self, node, namespace=None): |
paulb@31 | 141 | |
paulb@31 | 142 | """ |
paulb@43 | 143 | Process a subprogram or module 'node', discovering from attributes on |
paulb@43 | 144 | 'node' any initial locals. Return a modified subprogram or module. |
paulb@31 | 145 | """ |
paulb@31 | 146 | |
paulb@45 | 147 | # Do not process subprograms already being processed. |
paulb@45 | 148 | |
paulb@45 | 149 | if node in self.current_subprograms: |
paulb@45 | 150 | return None |
paulb@45 | 151 | |
paulb@31 | 152 | # Obtain a namespace either based on locals or on a structure. |
paulb@31 | 153 | |
paulb@45 | 154 | structure = structure=getattr(node, "structure", None) |
paulb@45 | 155 | self.namespace = NameOrganiser(structure) |
paulb@45 | 156 | |
paulb@45 | 157 | # Record the current subprogram and namespace. |
paulb@45 | 158 | |
paulb@45 | 159 | self.current_subprograms.append(node) |
paulb@45 | 160 | self.current_namespaces.append(self.namespace) |
paulb@45 | 161 | |
paulb@45 | 162 | # If passed some namespace, merge its contents into this namespace. |
paulb@45 | 163 | |
paulb@45 | 164 | if namespace is not None: |
paulb@45 | 165 | self.namespace.merge_namespace(namespace) |
paulb@31 | 166 | |
paulb@47 | 167 | # Register the names of parameters in the namespace. |
paulb@43 | 168 | |
paulb@43 | 169 | if hasattr(node, "params"): |
paulb@52 | 170 | new_params = [] |
paulb@43 | 171 | for param, default in node.params: |
paulb@52 | 172 | new_params.append((param, self.dispatch(default))) |
paulb@43 | 173 | self.namespace.store(param) |
paulb@52 | 174 | node.params = new_params |
paulb@45 | 175 | if getattr(node, "star", None): |
paulb@45 | 176 | param, default = node.star |
paulb@43 | 177 | self.namespace.store(param) |
paulb@52 | 178 | node.star = param, self.dispatch(default) |
paulb@45 | 179 | if getattr(node, "dstar", None): |
paulb@45 | 180 | param, default = node.dstar |
paulb@43 | 181 | self.namespace.store(param) |
paulb@52 | 182 | node.dstar = param, self.dispatch(default) |
paulb@43 | 183 | |
paulb@31 | 184 | # Add namespace details to any structure involved. |
paulb@31 | 185 | |
paulb@31 | 186 | if hasattr(node, "structure") and node.structure is not None: |
paulb@31 | 187 | |
paulb@31 | 188 | # Initialise bases where appropriate. |
paulb@31 | 189 | |
paulb@31 | 190 | if hasattr(node.structure, "bases"): |
paulb@31 | 191 | bases = [] |
paulb@31 | 192 | for base in node.structure.bases: |
paulb@31 | 193 | bases.append(self.dispatch(base)) |
paulb@31 | 194 | node.structure.bases = bases |
paulb@31 | 195 | |
paulb@31 | 196 | # Dispatch to the code itself. |
paulb@31 | 197 | |
paulb@31 | 198 | result = self.dispatch(node) |
paulb@47 | 199 | result.organiser = self.namespace |
paulb@45 | 200 | |
paulb@45 | 201 | # Restore the previous subprogram and namespace. |
paulb@45 | 202 | |
paulb@45 | 203 | self.current_namespaces.pop() |
paulb@45 | 204 | if self.current_namespaces: |
paulb@45 | 205 | self.namespace = self.current_namespaces[-1] |
paulb@45 | 206 | self.current_subprograms.pop() |
paulb@45 | 207 | |
paulb@31 | 208 | return result |
paulb@31 | 209 | |
paulb@31 | 210 | # Visitor methods. |
paulb@31 | 211 | |
paulb@31 | 212 | def default(self, node): |
paulb@31 | 213 | |
paulb@31 | 214 | """ |
paulb@31 | 215 | Process the given 'node', given that it does not have a specific |
paulb@31 | 216 | handler. |
paulb@31 | 217 | """ |
paulb@31 | 218 | |
paulb@98 | 219 | for attr in ("pos_args",): |
paulb@31 | 220 | value = getattr(node, attr, None) |
paulb@31 | 221 | if value is not None: |
paulb@31 | 222 | setattr(node, attr, self.dispatches(value)) |
paulb@98 | 223 | for attr in ("kw_args",): |
paulb@98 | 224 | value = getattr(node, attr, None) |
paulb@98 | 225 | if value is not None: |
paulb@98 | 226 | setattr(node, attr, self.dispatch_dict(value)) |
paulb@36 | 227 | for attr in ("expr", "lvalue", "test", "star", "dstar"): |
paulb@31 | 228 | value = getattr(node, attr, None) |
paulb@31 | 229 | if value is not None: |
paulb@31 | 230 | setattr(node, attr, self.dispatch(value)) |
paulb@36 | 231 | for attr in ("body", "else_", "handler", "finally_", "code", "choices"): |
paulb@31 | 232 | value = getattr(node, attr, None) |
paulb@31 | 233 | if value is not None: |
paulb@31 | 234 | setattr(node, attr, self.dispatches(value)) |
paulb@31 | 235 | return node |
paulb@31 | 236 | |
paulb@31 | 237 | def dispatch(self, node, *args): |
paulb@31 | 238 | return Visitor.dispatch(self, node, *args) |
paulb@31 | 239 | |
paulb@31 | 240 | def visitGlobal(self, global_): |
paulb@31 | 241 | for name in global_.names: |
paulb@31 | 242 | self.namespace.make_global(name) |
paulb@31 | 243 | return global_ |
paulb@31 | 244 | |
paulb@31 | 245 | def visitLoadName(self, loadname): |
paulb@45 | 246 | |
paulb@45 | 247 | "Transform the 'loadname' node to a specific, scope-sensitive node." |
paulb@45 | 248 | |
paulb@47 | 249 | scope = self.namespace.find_for_load(loadname.name) |
paulb@45 | 250 | |
paulb@45 | 251 | # For structure namespaces, load an attribute. |
paulb@45 | 252 | |
paulb@31 | 253 | if scope == "structure": |
paulb@63 | 254 | result = self.dispatch( |
paulb@79 | 255 | LoadAttr(loadname.original, loadname.defining, |
paulb@63 | 256 | expr=LoadRef(loadname.original, |
paulb@63 | 257 | ref=self.namespace.structure), |
paulb@63 | 258 | name=loadname.name, |
paulb@63 | 259 | nstype="structure") |
paulb@63 | 260 | ) |
paulb@45 | 261 | |
paulb@45 | 262 | # For global accesses (ie. those outside the local namespace)... |
paulb@45 | 263 | |
paulb@31 | 264 | elif scope == "global": |
paulb@45 | 265 | |
paulb@45 | 266 | # Where a distinct global namespace exists, examine it. |
paulb@45 | 267 | |
paulb@45 | 268 | if self.global_namespace is not None: |
paulb@47 | 269 | scope = self.global_namespace.find_for_load(loadname.name) |
paulb@45 | 270 | |
paulb@45 | 271 | # Where the name is outside the global namespace, it must be a |
paulb@45 | 272 | # built-in. |
paulb@45 | 273 | |
paulb@45 | 274 | if scope == "global": |
paulb@63 | 275 | result = self.dispatch( |
paulb@79 | 276 | LoadAttr(loadname.original, loadname.defining, |
paulb@63 | 277 | expr=LoadRef(loadname.original, |
paulb@63 | 278 | ref=self.builtins), |
paulb@63 | 279 | name=loadname.name, |
paulb@63 | 280 | nstype="module") |
paulb@63 | 281 | ) |
paulb@45 | 282 | |
paulb@45 | 283 | # Otherwise, it is within the global namespace and must be a |
paulb@45 | 284 | # global. |
paulb@45 | 285 | |
paulb@45 | 286 | else: |
paulb@63 | 287 | result = self.dispatch( |
paulb@79 | 288 | LoadAttr(loadname.original, loadname.defining, |
paulb@63 | 289 | expr=LoadRef(loadname.original, |
paulb@63 | 290 | ref=self.module), |
paulb@63 | 291 | name=loadname.name, |
paulb@63 | 292 | nstype="module") |
paulb@63 | 293 | ) |
paulb@45 | 294 | |
paulb@45 | 295 | # Where no global namespace exists, we are at the module level and |
paulb@45 | 296 | # must be accessing a built-in. |
paulb@45 | 297 | |
paulb@45 | 298 | else: |
paulb@63 | 299 | result = self.dispatch( |
paulb@79 | 300 | LoadAttr(loadname.original, loadname.defining, |
paulb@63 | 301 | expr=LoadRef(loadname.original, |
paulb@63 | 302 | ref=self.builtins), |
paulb@63 | 303 | name=loadname.name, |
paulb@63 | 304 | nstype="module") |
paulb@63 | 305 | ) |
paulb@45 | 306 | |
paulb@45 | 307 | # For local accesses... |
paulb@45 | 308 | |
paulb@31 | 309 | else: |
paulb@45 | 310 | |
paulb@45 | 311 | # Where a distinct global namespace exists, it must be a local. |
paulb@45 | 312 | |
paulb@45 | 313 | if self.global_namespace is not None: |
paulb@45 | 314 | result = loadname |
paulb@45 | 315 | |
paulb@45 | 316 | # Otherwise, we must be accessing a global (which is local at the |
paulb@45 | 317 | # module level). |
paulb@45 | 318 | |
paulb@45 | 319 | else: |
paulb@63 | 320 | result = self.dispatch( |
paulb@79 | 321 | LoadAttr(loadname.original, loadname.defining, |
paulb@63 | 322 | expr=LoadRef(loadname.original, |
paulb@63 | 323 | ref=self.module), |
paulb@63 | 324 | name=loadname.name, |
paulb@63 | 325 | nstype="module") |
paulb@63 | 326 | ) |
paulb@45 | 327 | |
paulb@31 | 328 | return result |
paulb@31 | 329 | |
paulb@31 | 330 | def visitStoreName(self, storename): |
paulb@45 | 331 | |
paulb@45 | 332 | "Transform the 'storename' node to a specific, scope-sensitive node." |
paulb@45 | 333 | |
paulb@47 | 334 | scope = self.namespace.find_for_store(storename.name) |
paulb@45 | 335 | |
paulb@45 | 336 | # For structure namespaces, store an attribute. |
paulb@45 | 337 | |
paulb@31 | 338 | if scope == "structure": |
paulb@63 | 339 | return self.dispatch( |
paulb@79 | 340 | StoreAttr(storename.original, storename.defining, |
paulb@63 | 341 | lvalue=LoadRef(storename.original, |
paulb@63 | 342 | ref=self.namespace.structure), |
paulb@63 | 343 | name=storename.name, |
paulb@63 | 344 | expr=storename.expr, |
paulb@63 | 345 | nstype="structure") |
paulb@63 | 346 | ) |
paulb@45 | 347 | |
paulb@45 | 348 | # Where the name is outside the local namespace, disallow any built-in |
paulb@45 | 349 | # assignment and store the name globally. |
paulb@45 | 350 | |
paulb@31 | 351 | elif scope == "global": |
paulb@63 | 352 | return self.dispatch( |
paulb@79 | 353 | StoreAttr(storename.original, storename.defining, |
paulb@63 | 354 | lvalue=LoadRef(storename.original, |
paulb@63 | 355 | ref=self.module), |
paulb@63 | 356 | name=storename.name, |
paulb@63 | 357 | expr=storename.expr, |
paulb@63 | 358 | nstype="module") |
paulb@63 | 359 | ) |
paulb@45 | 360 | |
paulb@45 | 361 | # For local namespace accesses... |
paulb@45 | 362 | |
paulb@31 | 363 | else: |
paulb@31 | 364 | self.namespace.store(storename.name) |
paulb@45 | 365 | |
paulb@45 | 366 | # If a distinct global namespace exists, it must be a local access. |
paulb@45 | 367 | |
paulb@45 | 368 | if self.global_namespace is not None: |
paulb@45 | 369 | return storename |
paulb@45 | 370 | |
paulb@45 | 371 | # Otherwise, the name is being set at the module level and is |
paulb@45 | 372 | # considered global. |
paulb@45 | 373 | |
paulb@45 | 374 | else: |
paulb@63 | 375 | return self.dispatch( |
paulb@79 | 376 | StoreAttr(storename.original, storename.defining, |
paulb@63 | 377 | lvalue=LoadRef(storename.original, |
paulb@63 | 378 | ref=self.module), |
paulb@63 | 379 | name=storename.name, |
paulb@63 | 380 | expr=storename.expr, |
paulb@63 | 381 | nstype="module") |
paulb@63 | 382 | ) |
paulb@45 | 383 | |
paulb@57 | 384 | def visitInvokeFunction(self, invoke): |
paulb@57 | 385 | |
paulb@57 | 386 | "Transform the 'invoke' node, performing processing on subprograms." |
paulb@57 | 387 | |
paulb@57 | 388 | return self.default(invoke) |
paulb@57 | 389 | |
paulb@57 | 390 | def visitInvokeBlock(self, invoke): |
paulb@45 | 391 | |
paulb@45 | 392 | "Transform the 'invoke' node, performing processing on subprograms." |
paulb@45 | 393 | |
paulb@45 | 394 | # The special case of internal subprogram invocation is addressed by |
paulb@45 | 395 | # propagating namespace information to the subprogram and processing it. |
paulb@45 | 396 | |
paulb@57 | 397 | subprogram = self.process_node(invoke.expr.ref, self.namespace) |
paulb@57 | 398 | if subprogram is not None: |
paulb@57 | 399 | self.subprograms.append(subprogram) |
paulb@57 | 400 | return invoke |
paulb@31 | 401 | |
paulb@46 | 402 | class ScopeMismatch(Exception): |
paulb@46 | 403 | pass |
paulb@46 | 404 | |
paulb@34 | 405 | class NameOrganiser: |
paulb@32 | 406 | |
paulb@32 | 407 | """ |
paulb@32 | 408 | A local namespace which may either relate to a genuine set of function |
paulb@32 | 409 | locals or the initialisation of a structure. |
paulb@32 | 410 | """ |
paulb@32 | 411 | |
paulb@32 | 412 | def __init__(self, structure=None): |
paulb@46 | 413 | |
paulb@46 | 414 | "Initialise the namespace with an optional 'structure'." |
paulb@46 | 415 | |
paulb@32 | 416 | self.structure = structure |
paulb@32 | 417 | if structure is not None: |
paulb@32 | 418 | self.local = "structure" |
paulb@32 | 419 | else: |
paulb@32 | 420 | self.local = "local" |
paulb@46 | 421 | |
paulb@46 | 422 | # Names may be self.local or "global". |
paulb@46 | 423 | |
paulb@32 | 424 | self.names = {} |
paulb@32 | 425 | |
paulb@32 | 426 | def make_global(self, name): |
paulb@46 | 427 | if not self.names.has_key(name): |
paulb@46 | 428 | self.names[name] = "global" |
paulb@46 | 429 | elif self.names[name] == self.local: |
paulb@46 | 430 | raise ScopeMismatch, "Name '%s' already considered as %s." % (name, self.local) |
paulb@32 | 431 | |
paulb@47 | 432 | def find_for_load(self, name): |
paulb@46 | 433 | return self.names.get(name, "global") |
paulb@32 | 434 | |
paulb@47 | 435 | def find_for_store(self, name): |
paulb@47 | 436 | return self.names.get(name, self.local) |
paulb@47 | 437 | |
paulb@45 | 438 | def store(self, name): |
paulb@46 | 439 | if self.names.get(name) != "global": |
paulb@46 | 440 | self.names[name] = self.local |
paulb@32 | 441 | else: |
paulb@46 | 442 | raise ScopeMismatch, "Name '%s' already considered as global." % name |
paulb@32 | 443 | |
paulb@46 | 444 | def merge(self, name, scope): |
paulb@46 | 445 | if self.names.get(name) in (None, scope): |
paulb@46 | 446 | self.names[name] = scope |
paulb@32 | 447 | else: |
paulb@46 | 448 | raise ScopeMismatch, "Name '%s' already considered as %s." % (name, self.names[name]) |
paulb@45 | 449 | |
paulb@45 | 450 | def merge_namespace(self, namespace): |
paulb@46 | 451 | self.merge_items(namespace.names.items()) |
paulb@45 | 452 | |
paulb@46 | 453 | def merge_items(self, items): |
paulb@46 | 454 | for name, scope in items: |
paulb@46 | 455 | self.merge(name, scope) |
paulb@45 | 456 | |
paulb@43 | 457 | def __repr__(self): |
paulb@43 | 458 | return repr(self.names) |
paulb@43 | 459 | |
paulb@57 | 460 | # Convenience functions. |
paulb@57 | 461 | |
paulb@57 | 462 | def fix(module, builtins=None): |
paulb@57 | 463 | |
paulb@57 | 464 | """ |
paulb@57 | 465 | Fix the names in the given 'module', also employing the optional 'builtins' |
paulb@57 | 466 | module, if specified. |
paulb@57 | 467 | """ |
paulb@57 | 468 | |
paulb@57 | 469 | fixer = Fixer() |
paulb@57 | 470 | if builtins is not None: |
paulb@57 | 471 | fixer.process(module, builtins) |
paulb@57 | 472 | else: |
paulb@57 | 473 | fixer.process(module) |
paulb@57 | 474 | |
paulb@31 | 475 | # vim: tabstop=4 expandtab shiftwidth=4 |