Message374274
So it looks like `pyparse.Parser.find_good_parse_start` is responsible for truncating the code to only look for the matching bracket in the current statement, which uses _synchre.
Testing it out, it sometimes will go to the most recent match of _synchre, but will sometimes go back to an even earlier match in the code, which is why something like
```
else
(
else)
```
manages to match without an issue. The `find_good_parse_start` will truncate at the first `else` in this case, instead at the second one.
Removing `else` from the _synchre regex did solve this problem for me though, as `find_good_parse_start` will then try to truncate even earlier when looking for the start of the statement, which will be before the opener. Although, I haven't checked what else would be affected by this change. I am not sure why this worked for me and did not work for you Terry.
Also, even with this fix it seems like 'find_good_parse_start` goes back further than it needs to. Fixing that may not change much, but would offer a slight performance increase. |
|
Date |
User |
Action |
Args |
2020-07-25 18:30:34 | Lewis Ball | set | recipients:
+ Lewis Ball, terry.reedy, taleinat, Alexey Burdin |
2020-07-25 18:30:34 | Lewis Ball | set | messageid: <1595701834.13.0.397134416072.issue41388@roundup.psfhosted.org> |
2020-07-25 18:30:34 | Lewis Ball | link | issue41388 messages |
2020-07-25 18:30:33 | Lewis Ball | create | |
|