aboutsummaryrefslogtreecommitdiff
path: root/pycparser
diff options
context:
space:
mode:
authorEli Bendersky <eliben@gmail.com>2013-09-25 06:00:00 -0700
committerEli Bendersky <eliben@gmail.com>2013-09-25 06:00:00 -0700
commit50395a985fc03b977795da2c9a39e82ad58ae1c8 (patch)
treed99e0fcd7773fb21011908517adba24d5371debc /pycparser
parent36332196f7c9b5d8501b496f3ee4d44350e71edc (diff)
downloadpycparser-50395a985fc03b977795da2c9a39e82ad58ae1c8.tar.gz
cleanups
Diffstat (limited to 'pycparser')
-rw-r--r--pycparser/_ast_gen.py6
-rw-r--r--pycparser/ast_transforms.py2
-rw-r--r--pycparser/c_ast.py52
3 files changed, 30 insertions, 30 deletions
diff --git a/pycparser/_ast_gen.py b/pycparser/_ast_gen.py
index 25c40b7..307ece5 100644
--- a/pycparser/_ast_gen.py
+++ b/pycparser/_ast_gen.py
@@ -2,12 +2,12 @@
# _ast_gen.py
#
# Generates the AST Node classes from a specification given in
-# a .yaml file
+# a configuration file
#
# The design of this module was inspired by astgen.py from the
# Python 2.5 code-base.
#
-# Copyright (C) 2008-2012, Eli Bendersky
+# Copyright (C) 2008-2013, Eli Bendersky
# License: BSD
#-----------------------------------------------------------------
import pprint
@@ -146,7 +146,7 @@ r'''#-----------------------------------------------------------------
#
# AST Node classes.
#
-# Copyright (C) 2008-2012, Eli Bendersky
+# Copyright (C) 2008-2013, Eli Bendersky
# License: BSD
#-----------------------------------------------------------------
diff --git a/pycparser/ast_transforms.py b/pycparser/ast_transforms.py
index b30ae3c..55b1608 100644
--- a/pycparser/ast_transforms.py
+++ b/pycparser/ast_transforms.py
@@ -84,7 +84,7 @@ def fix_switch_cases(switch_node):
_extract_nested_case(child, new_compound.block_items)
last_case = new_compound.block_items[-1]
else:
- # Other statements are added as childrent to the last case, if it
+ # Other statements are added as children to the last case, if it
# exists.
if last_case is None:
new_compound.block_items.append(child)
diff --git a/pycparser/c_ast.py b/pycparser/c_ast.py
index 2b9b00a..699cbdf 100644
--- a/pycparser/c_ast.py
+++ b/pycparser/c_ast.py
@@ -1,7 +1,7 @@
#-----------------------------------------------------------------
# ** ATTENTION **
# This code was automatically generated from the file:
-# _c_ast.cfg
+# _c_ast.cfg
#
# Do not modify it directly. Modify the configuration file and
# run the generator again.
@@ -30,21 +30,21 @@ class Node(object):
def show(self, buf=sys.stdout, offset=0, attrnames=False, nodenames=False, showcoord=False, _my_node_name=None):
""" Pretty print the Node and all its attributes and
children (recursively) to a buffer.
-
- buf:
+
+ buf:
Open IO buffer into which the Node is printed.
-
- offset:
- Initial offset (amount of leading spaces)
-
+
+ offset:
+ Initial offset (amount of leading spaces)
+
attrnames:
True if you want to see the attribute names in
name=value pairs. False to only see the values.
-
+
nodenames:
- True if you want to see the actual node names
+ True if you want to see the actual node names
within their parents.
-
+
showcoord:
Do you want the coordinates of each Node to be
displayed.
@@ -79,47 +79,47 @@ class Node(object):
class NodeVisitor(object):
- """ A base NodeVisitor class for visiting c_ast nodes.
+ """ A base NodeVisitor class for visiting c_ast nodes.
Subclass it and define your own visit_XXX methods, where
- XXX is the class name you want to visit with these
+ XXX is the class name you want to visit with these
methods.
-
+
For example:
-
+
class ConstantVisitor(NodeVisitor):
def __init__(self):
self.values = []
-
+
def visit_Constant(self, node):
self.values.append(node.value)
- Creates a list of values of all the constant nodes
+ Creates a list of values of all the constant nodes
encountered below the given node. To use it:
-
+
cv = ConstantVisitor()
cv.visit(node)
-
+
Notes:
-
- * generic_visit() will be called for AST nodes for which
- no visit_XXX method was defined.
- * The children of nodes for which a visit_XXX was
+
+ * generic_visit() will be called for AST nodes for which
+ no visit_XXX method was defined.
+ * The children of nodes for which a visit_XXX was
defined will not be visited - if you need this, call
- generic_visit() on the node.
+ generic_visit() on the node.
You can use:
NodeVisitor.generic_visit(self, node)
* Modeled after Python's own AST visiting facilities
(the ast module of Python 3.0)
"""
def visit(self, node):
- """ Visit a node.
+ """ Visit a node.
"""
method = 'visit_' + node.__class__.__name__
visitor = getattr(self, method, self.generic_visit)
return visitor(node)
-
+
def generic_visit(self, node):
- """ Called if no explicit visitor function exists for a
+ """ Called if no explicit visitor function exists for a
node. Implements preorder visiting of the node.
"""
for c_name, c in node.children():