pep-0492: Reword tokenization algorithm description.
This commit is contained in:
parent
c28890fb42
commit
08ceef7eeb
16
pep-0492.txt
16
pep-0492.txt
|
@ -781,14 +781,16 @@ To avoid backwards compatibility issues with ``async`` and ``await``
|
|||
keywords, it was decided to modify ``tokenizer.c`` in such a way, that
|
||||
it:
|
||||
|
||||
* recognizes ``async def`` name tokens combination (start of a
|
||||
native coroutine);
|
||||
* recognizes ``async def`` ``NAME`` tokens combination;
|
||||
|
||||
* keeps track of regular functions and native coroutines;
|
||||
* keeps track of regular ``def`` and ``async def`` indented blocks;
|
||||
|
||||
* replaces ``'async'`` token with ``ASYNC`` and ``'await'`` token with
|
||||
``AWAIT`` when in the process of yielding tokens for native
|
||||
coroutines.
|
||||
* while tokenizing ``async def`` block, it replaces ``'async'``
|
||||
``NAME`` token with ``ASYNC``, and ``'await'`` ``NAME`` token with
|
||||
``AWAIT``;
|
||||
|
||||
* while tokenizing ``def`` block, it yields ``'async'`` and ``'await'``
|
||||
``NAME`` tokens as is.
|
||||
|
||||
This approach allows for seamless combination of new syntax features
|
||||
(all of them available only in ``async`` functions) with any existing
|
||||
|
@ -843,7 +845,7 @@ syntax.
|
|||
Grammar Updates
|
||||
---------------
|
||||
|
||||
Grammar changes are also fairly minimal::
|
||||
Grammar changes are fairly minimal::
|
||||
|
||||
decorated: decorators (classdef | funcdef | async_funcdef)
|
||||
async_funcdef: ASYNC funcdef
|
||||
|
|
Loading…
Reference in New Issue