@@ -745,9 +745,11 @@ def cached_parse(
745745 cache_prefixes = False ,
746746):
747747 """Version of parse that caches the result when it's a pure ComputationNode."""
748+ if not include_tokens :
749+ eval_parse_tree = False
748750 if not CPYPARSING : # caching is only supported on cPyparsing
749751 if scan_string :
750- for tokens , start , stop in all_matches (grammar , text , inner , eval_parse_tree = False ):
752+ for tokens , start , stop in all_matches (grammar , text , inner , eval_parse_tree ):
751753 return tokens , start , stop
752754 return None , None , None
753755 else :
@@ -841,7 +843,7 @@ def does_parse(grammar, text, inner=None):
841843
842844def cached_does_parse (cache , grammar , text , inner = None , ** kwargs ):
843845 """Cached version of does_parse."""
844- return cached_try_parse (cache , grammar , text , inner , eval_parse_tree = False , include_tokens = False , ** kwargs )
846+ return cached_try_parse (cache , grammar , text , inner , include_tokens = False , ** kwargs )
845847
846848
847849def parse_where (grammar , text , inner = None ):
@@ -853,7 +855,7 @@ def parse_where(grammar, text, inner=None):
853855
854856def cached_parse_where (cache , grammar , text , inner = None , ** kwargs ):
855857 """Cached version of parse_where."""
856- tokens , start , stop = cached_parse (cache , grammar , text , inner , scan_string = True , eval_parse_tree = False , include_tokens = False , ** kwargs )
858+ tokens , start , stop = cached_parse (cache , grammar , text , inner , scan_string = True , include_tokens = False , ** kwargs )
857859 return start , stop
858860
859861
0 commit comments