You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried to dig into it and found out that it is caused by this line: self.expr.try_parse(instring, anchor_loc, do_actions=doActions), specifically by do_actions=doActions.
I hotfixed it locally to do_actions=False (I would expect not to perform parse action when I am only trying to parse the block and will parse it again) and now, the output is as expected (by me :)) .
Is it truly a bug or (rather strange) feature?
Thanks for your answer in advance!
The text was updated successfully, but these errors were encountered:
You can also prevent double evaluation of the parse action by enabling packrat parsing.
ParserElement.enable_packrat()
This will cache the result of the try_parse lookahead, so that when it succeeds, the actual parse doesn't repeat the parsing and parse action, but just retuns the value from the packrat cache.
Sorry for opening another issue in a short time, but:
When the first element of
IndentedBlock
has a parse action (entry1
and itse1_action
in the example), it is performed twice:Expected result:
Actual result:
I tried to dig into it and found out that it is caused by this line:
self.expr.try_parse(instring, anchor_loc, do_actions=doActions)
, specifically bydo_actions=doActions
.I hotfixed it locally to
do_actions=False
(I would expect not to perform parse action when I am only trying to parse the block and will parse it again) and now, the output is as expected (by me :)) .Is it truly a bug or (rather strange) feature?
Thanks for your answer in advance!
The text was updated successfully, but these errors were encountered: