Commit 897ffc2a authored by eckhart's avatar eckhart

parse.py: small optimization

parent 1215f1f6
......@@ -504,15 +504,13 @@ class Parser:
if node is not None:
node._pos = location
if (grammar.memoization__
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.
# See `_rollback_location()` for the added compensation term.
and location > grammar.last_rb__loc__ + int(text._len == rest._len)):
visited[location] = (node, rest)
if not grammar.returning_from_recursion__:
if (grammar.memoization__
# Variable-manipulating parsers will not be entered into the cache,
# because caching would interfere with changes of variable state.
# See `_rollback_location()` for the added compensation term.
and location > grammar.last_rb__loc__ + int(text._len == rest._len)):
visited[location] = (node, rest)
grammar.returning_from_recursion__ = recursion_state
except RecursionError:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment