summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--earlpy/earlpy.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/earlpy/earlpy.py b/earlpy/earlpy.py
index 5a1cb52..63e15e9 100644
--- a/earlpy/earlpy.py
+++ b/earlpy/earlpy.py
@@ -367,13 +367,14 @@ class Node:
def file_name(self):
return self.contents[-1].file_name()
- def pprint(self):
+ def pprint(self, flat=False):
def pprint(other):
if isinstance(other, Node):
- return other.pprint()
- return other.pprint()
+ return other.pprint(flat)
+ return other.pprint(flat)
if len(self.contents) == 1:
return pprint(self.contents[0])
+ if flat: return ' '.join(map(pprint, self.contents))
return '(' + ' '.join(map(pprint, self.contents)) + ')'
def print_tree(self, depth=0):
@@ -428,7 +429,7 @@ class Token:
self.line_number = line_number
self.file_name_ = file_name
- def pprint(self):
+ def pprint(self, flat=None):
return self.string
def line_numbers(self):
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback