This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author terry.reedy
Recipients David E. Franco G., terry.reedy, yselivanov
Date 2017-03-03.06:19:42
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1488521983.25.0.686290702115.issue29706@psf.upfronthosting.co.za>
In-reply-to
Content
I presume you would like 'async' and 'await' highlighted as keywords.  However, IDLE takes its definition of 'keyword' from keyword.kwlist.  'Async' and 'await' are currently not on that list as they are not yet keywords.

>>> async = 1
>>> await = 2

According to https://www.python.org/dev/peps/pep-0492/#transition-plan, the intention was (is?) to make them keywords in 3.7.  As of Feb 11, that had not happened yet.  If and when it does, this issue will be taken care of.

I may consider adding a special context sensitive case for 3.6, if the colorizer code makes it easily possible.  Care is needed since it would be a mistake to mark them as keywords in the above statements.

The difficulty is that colorizer uses regexes and a bit of context sensitive code, while python is using a full grammar parse.  I believe that either at the beginning of a line and 'async' followed by 'for' or 'with' or 'await' not followed by certain punctuation ('.', ',', or '=') should be treated as a keyword.

Yury, does the rule above look about right?  'Await' seems trickier than 'async'.

I think it may be possible to add regexes that are not literal words to the kwlist.  If so, adding 'async +def ', 'async +for ', 'async +with ', and 'await +[^.,=]' and not worrying about 'beginning or line' or tabs  (instead of spaces) between would be easy and probably good enough.
History
Date User Action Args
2017-03-03 06:19:43terry.reedysetrecipients: + terry.reedy, yselivanov, David E. Franco G.
2017-03-03 06:19:43terry.reedysetmessageid: <1488521983.25.0.686290702115.issue29706@psf.upfronthosting.co.za>
2017-03-03 06:19:43terry.reedylinkissue29706 messages
2017-03-03 06:19:42terry.reedycreate