Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
D
DHParser
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
badw-it
DHParser
Commits
09995eb3
Commit
09995eb3
authored
Jun 10, 2020
by
eckhart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
parse.py: ensure cache neutrality for retrieved values
parent
11cb5c7e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
3 deletions
+5
-3
DHParser/parse.py
DHParser/parse.py
+5
-3
No files found.
DHParser/parse.py
View file @
09995eb3
...
...
@@ -3024,13 +3024,15 @@ class Retrieve(UnaryParser):
def
_parse
(
self
,
text
:
StringView
)
->
Tuple
[
Optional
[
Node
],
StringView
]:
# auto-capture on first use if symbol was not captured before
# ("or"-clause needed, because Forward parsers do not have a pname)
self
.
grammar
.
last_rb__loc__
=
self
.
grammar
.
document_length__
-
text
.
_len
# set last_rb__loc__ to avoid caching of retrieved results
if
len
(
self
.
grammar
.
variables__
[
self
.
symbol_pname
])
==
0
:
node
,
text_
=
self
.
parser
(
text
)
# auto-capture value
if
node
is
None
:
# set last_rb__loc__ to avoid caching of retrieved results
self
.
grammar
.
push_rollback__
(
rollback_location
(
self
,
text
,
text_
),
lambda
:
None
)
return
None
,
text_
node
,
text_
=
self
.
retrieve_and_match
(
text
)
# set last_rb__loc__ to avoid caching of retrieved results
self
.
grammar
.
push_rollback__
(
rollback_location
(
self
,
text
,
text_
),
lambda
:
None
)
return
node
,
text_
def
__repr__
(
self
):
...
...
@@ -3100,7 +3102,7 @@ class Pop(Retrieve):
self
.
grammar
.
push_rollback__
(
rollback_location
(
self
,
text
,
text_
),
self
.
_rollback
)
else
:
# set last_rb__loc__ to avoid caching of retrieved results
self
.
grammar
.
last_rb__loc__
=
self
.
grammar
.
document_length__
-
text
.
_len
self
.
grammar
.
push_rollback__
(
rollback_location
(
self
,
text
,
text_
),
lambda
:
None
)
return
node
,
text_
def
__repr__
(
self
):
...
...
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