summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Bendersky <eliben@gmail.com>2020-04-15 15:07:22 -0700
committerEli Bendersky <eliben@gmail.com>2020-04-15 15:07:22 -0700
commit66fc2434c804867707392b704c3cd13923118476 (patch)
treee6ffa9b7476f832fe656af8734fc00e2efc55eeb
parent7b893b86bb185ff1262f6a524e92b8ad592acaa3 (diff)
downloadpycparser-66fc2434c804867707392b704c3cd13923118476.tar.gz
Clean up whitespace in generated AST code
-rw-r--r--pycparser/_ast_gen.py10
-rw-r--r--pycparser/c_ast.py10
2 files changed, 10 insertions, 10 deletions
diff --git a/pycparser/_ast_gen.py b/pycparser/_ast_gen.py
index 5ec2d3d..ba03d90 100644
--- a/pycparser/_ast_gen.py
+++ b/pycparser/_ast_gen.py
@@ -196,7 +196,7 @@ def _repr(obj):
if isinstance(obj, list):
return '[' + (',\n '.join((_repr(e).replace('\n', '\n ') for e in obj))) + '\n]'
else:
- return repr(obj)
+ return repr(obj)
class Node(object):
__slots__ = ()
@@ -206,19 +206,19 @@ class Node(object):
""" Generates a python representation of the current node
"""
result = self.__class__.__name__ + '('
-
+
indent = ''
separator = ''
for name in self.__slots__[:-2]:
result += separator
result += indent
result += name + '=' + (_repr(getattr(self, name)).replace('\n', '\n ' + (' ' * (len(name) + len(self.__class__.__name__)))))
-
+
separator = ','
indent = '\n ' + (' ' * len(self.__class__.__name__))
-
+
result += indent + ')'
-
+
return result
def children(self):
diff --git a/pycparser/c_ast.py b/pycparser/c_ast.py
index b7bbbee..0ce8fef 100644
--- a/pycparser/c_ast.py
+++ b/pycparser/c_ast.py
@@ -25,7 +25,7 @@ def _repr(obj):
if isinstance(obj, list):
return '[' + (',\n '.join((_repr(e).replace('\n', '\n ') for e in obj))) + '\n]'
else:
- return repr(obj)
+ return repr(obj)
class Node(object):
__slots__ = ()
@@ -35,19 +35,19 @@ class Node(object):
""" Generates a python representation of the current node
"""
result = self.__class__.__name__ + '('
-
+
indent = ''
separator = ''
for name in self.__slots__[:-2]:
result += separator
result += indent
result += name + '=' + (_repr(getattr(self, name)).replace('\n', '\n ' + (' ' * (len(name) + len(self.__class__.__name__)))))
-
+
separator = ','
indent = '\n ' + (' ' * len(self.__class__.__name__))
-
+
result += indent + ')'
-
+
return result
def children(self):