Commit a8c00788 authored by di68kap's avatar di68kap
Browse files

slow down for memoization with FixedEBNF fixed

parent 65dada02
...@@ -3930,7 +3930,7 @@ class Forward(UnaryParser): ...@@ -3930,7 +3930,7 @@ class Forward(UnaryParser):
result = self.parser(text) result = self.parser(text)
self.recursion_counter[location] = depth # allow moving back and forth self.recursion_counter[location] = depth # allow moving back and forth
else: else:
recursion_state = grammar.suspend_memoization__ memoization_state = grammar.suspend_memoization__
self.recursion_counter[location] = 0 # fail on the first recursion self.recursion_counter[location] = 0 # fail on the first recursion
grammar.suspend_memoization__ = False grammar.suspend_memoization__ = False
result = self.parser(text) result = self.parser(text)
...@@ -3967,9 +3967,9 @@ class Forward(UnaryParser): ...@@ -3967,9 +3967,9 @@ class Forward(UnaryParser):
break break
result = next_result result = next_result
depth += 1 depth += 1
grammar.suspend_memoization__ = recursion_state \ # grammar.suspend_memoization__ = recursion_state \
or location <= (grammar.last_rb__loc__ + int(text._len == result[1]._len)) # or location <= (grammar.last_rb__loc__ + int(text._len == result[1]._len))
# grammar.suspend_memoization__ = recursion_state grammar.suspend_memoization__ = memoization_state
if not grammar.suspend_memoization__: if not grammar.suspend_memoization__:
visited[location] = result visited[location] = result
return result return result
......
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