[issue41388] IDLE fails to detect corresponding opening parenthesis

Terry J. Reedy report at bugs.python.org
Sun Jul 26 00:43:53 EDT 2020


Terry J. Reedy <tjreedy at udel.edu> added the comment:

As I at least hinted above, I would rather add the missing line starts than delete more.  I am quite sure that their absence degrades overall performance in some sense.  A much bigger match problem that this one is that ^0 always half fails when the cursor is not on the line with the closer.  See #21756, which already has a patch, though not one I was completely happy with last time I looked.

I cannot help but think that a proper solution might fix both issues.

I once wrote a fence matcher in C, initially for C, based on a deterministic finite state machine but with a push-down stack so it could match indefinite nesting.  I am thinking that I should try to rewrite in python and see if it will solve both issues.  Find good parse start is not really the right tool, because what we want to do with ^0 is to move both back and forward, find the first unmatched fence in each direction, and flash them, and add a beep if unmatched.  BOF and EOF (begin/end of file) are the backup fences.

Another possible solution might be to use a depleted _synchre for matching and an augmented one for any other use where that is better.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue41388>
_______________________________________


More information about the Python-bugs-list mailing list