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
3c889f95
Commit
3c889f95
authored
Jun 10, 2020
by
eckhart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
parser.py: comments added for further work
parent
791302e6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
DHParser/parse.py
DHParser/parse.py
+4
-3
tests/test_parse.py
tests/test_parse.py
+0
-1
No files found.
DHParser/parse.py
View file @
3c889f95
...
...
@@ -507,7 +507,7 @@ class Parser:
and
not
grammar
.
returning_from_recursion__
# variable-manipulating parsers will not be entered into the cache,
# because caching would interfere with changes of variable state
and
location
>
grammar
.
last_rb__loc__
):
# + int(len(text) == int(len(rest))
and
location
>
grammar
.
last_rb__loc__
+
int
(
text
.
_len
==
rest
.
_len
)):
visited
[
location
]
=
(
node
,
rest
)
if
not
grammar
.
returning_from_recursion__
:
...
...
@@ -3218,7 +3218,7 @@ class Forward(UnaryParser):
http://www.vpri.org/pdf/tr2007002_packrat.pdf
"""
grammar
=
self
.
grammar
if
True
or
not
grammar
.
left_recursion__
:
# TODO: add a static check and flag: self.left_recursive__!
if
not
grammar
.
left_recursion__
:
# TODO: add a static check and flag: self.left_recursive__!
return
self
.
parser
(
text
)
location
=
grammar
.
document_length__
-
text
.
_len
...
...
@@ -3279,7 +3279,8 @@ class Forward(UnaryParser):
break
result
=
next_result
depth
+=
1
if
grammar
.
memoization__
and
location
>
grammar
.
last_rb__loc__
:
# + int(len(text) == int(len(result[1]))
if
(
grammar
.
memoization__
and
location
>
grammar
.
last_rb__loc__
+
int
(
text
.
_len
==
result
[
1
].
_len
)):
visited
[
location
]
=
result
grammar
.
returning_from_recursion__
=
recursion_state
return
result
...
...
tests/test_parse.py
View file @
3c889f95
...
...
@@ -868,7 +868,6 @@ class TestPopRetrieve:
case
=
'AXA!'
st
=
gr
(
case
)
assert
not
st
.
errors
case
=
'AXX!'
set_config_value
(
'history_tracking'
,
True
)
start_logging
(
'LOGS'
)
...
...
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