Skip to content
Snippets Groups Projects
Commit 7ecb7c78 authored by Sander Mathijs van Veen's avatar Sander Mathijs van Veen
Browse files

Print modifications done by hook_read_after() only once.

parent 80657ead
No related branches found
No related tags found
No related merge requests found
......@@ -175,6 +175,9 @@ class Parser(BisonParser):
# match: ab | abc | abcd (where left = "a")
return '*'.join([left] + list(right))
if self.verbose: # pragma: nocover
data_before = data
# Iteratively replace all matches.
while True:
data_after = re.sub(pattern, preprocess_data, data)
......@@ -182,13 +185,13 @@ class Parser(BisonParser):
if data == data_after:
break
if self.verbose: # pragma: nocover
print 'hook_read_after() modified the input data:'
print 'before:', data.replace('\n', '\\n')
print 'after :', data_after.replace('\n', '\\n')
data = data_after
if self.verbose and data_before != data_after: # pragma: nocover
print 'hook_read_after() modified the input data:'
print 'before:', repr(data_before)
print 'after :', repr(data_after)
return data
def hook_handler(self, target, option, names, values, retval):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment