Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
trs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Taddeüs Kroes
trs
Commits
d6682c57
Commit
d6682c57
authored
Dec 12, 2011
by
Sander Mathijs van Veen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implemented hook_read_{after,before} handlers.
parent
1c6c77ed
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
10 deletions
+8
-10
external/pybison
external/pybison
+1
-1
src/parser.py
src/parser.py
+7
-9
No files found.
pybison
@
8ec21981
Subproject commit
282beeb275a9dde703523670a77c4449ce1decf8
Subproject commit
8ec21981dc8afac97b06f737b50209e2b318037d
src/parser.py
View file @
d6682c57
...
...
@@ -87,7 +87,12 @@ class Parser(BisonParser):
except
EOFError
:
return
''
def
hook_read
(
self
,
data
):
def
hook_read_before
(
self
):
if
self
.
interactive
and
self
.
possibilities
:
print
'possibilities:'
print
self
.
possibilities
def
hook_read_after
(
self
,
data
):
"""
This hook will be called when the read() method returned. The data
argument points to the data read by the read() method. This hook
...
...
@@ -138,19 +143,12 @@ class Parser(BisonParser):
break
if
self
.
verbose
:
print
'hook_read() modified the input data:'
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
.
interactive
:
if
not
self
.
possibilities
:
print
'possibilities: None'
else
:
print
'possibilities:'
print
self
.
possibilities
return
data
def
hook_handler
(
self
,
target
,
option
,
names
,
values
,
retval
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment