Skip to content

Commit

Permalink
Further fix pypy
Browse files Browse the repository at this point in the history
  • Loading branch information
evhub committed Oct 20, 2024
1 parent 160c037 commit f8b11d7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion coconut/compiler/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,12 @@ def cached_parse(
):
"""Version of parse that caches the result when it's a pure ComputationNode."""
if not CPYPARSING: # caching is only supported on cPyparsing
return (parse_where if scan_string else parse)(grammar, text, inner)
if scan_string:
for tokens, start, stop in all_matches(grammar, text, inner, eval_parse_tree=False):
return tokens, start, stop
return None, None, None
else:
return parse(grammar, text, inner)

# only iterate over keys, not items, so we don't mark everything as alive
for key in computation_graph_cache:
Expand Down

0 comments on commit f8b11d7

Please sign in to comment.