New submission from Terry J. Reedy <tjre...@udel.edu>:

Lib\idlelib\colorizer.py, line 25, is:
  stringprefix = r"(?i:\br|u|f|fr|rf|b|br|rb)?"

The r prefix, but only the r prefix, must be preceded by a non-word character.

On pydev thread "IDLE colorizer", MRAB noted: "The \b will apply only to the 
first choice. Shouldn't it be more like:
  stringprefix = r"(?:\b(?i:r|u|f|fr|rf|b|br|rb))?"

I think the \b should be removed instead.  Currently uf'a' gets f'a' colored, 
while ur'a' only gets  'a' colored.  (Tim Peters pointed out the difference 
with a different example.) I prefer coloring the maximal legal string rather 
than the minimum.    I think the contrast between two chars legal by 
themselves, but differently colored when put together, makes the bug more 
obvious.

----------
assignee: terry.reedy
components: IDLE
messages: 314793
nosy: terry.reedy
priority: normal
severity: normal
stage: test needed
status: open
title: IDLE: remove \b from colorizer string prefix
type: behavior
versions: Python 3.6, Python 3.7, Python 3.8

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue33204>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to