Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
trs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Taddeüs Kroes
trs
Commits
7ecb7c78
Commit
7ecb7c78
authored
13 years ago
by
Sander Mathijs van Veen
Browse files
Options
Downloads
Patches
Plain Diff
Print modifications done by hook_read_after() only once.
parent
80657ead
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/parser.py
+8
-5
8 additions, 5 deletions
src/parser.py
with
8 additions
and
5 deletions
src/parser.py
+
8
−
5
View file @
7ecb7c78
...
...
@@ -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
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment