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
|
keywords, it was decided to modify ``tokenizer.c`` in such a way, that
|
||||||
it:
|
it:
|
||||||
|
|
||||||
* recognizes ``async def`` name tokens combination (start of a
|
* recognizes ``async def`` ``NAME`` tokens combination;
|
||||||
native coroutine);
|
|
||||||
|
|
||||||
* 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
|
* while tokenizing ``async def`` block, it replaces ``'async'``
|
||||||
``AWAIT`` when in the process of yielding tokens for native
|
``NAME`` token with ``ASYNC``, and ``'await'`` ``NAME`` token with
|
||||||
coroutines.
|
``AWAIT``;
|
||||||
|
|
||||||
|
* while tokenizing ``def`` block, it yields ``'async'`` and ``'await'``
|
||||||
|
``NAME`` tokens as is.
|
||||||
|
|
||||||
This approach allows for seamless combination of new syntax features
|
This approach allows for seamless combination of new syntax features
|
||||||
(all of them available only in ``async`` functions) with any existing
|
(all of them available only in ``async`` functions) with any existing
|
||||||
|
@ -843,7 +845,7 @@ syntax.
|
||||||
Grammar Updates
|
Grammar Updates
|
||||||
---------------
|
---------------
|
||||||
|
|
||||||
Grammar changes are also fairly minimal::
|
Grammar changes are fairly minimal::
|
||||||
|
|
||||||
decorated: decorators (classdef | funcdef | async_funcdef)
|
decorated: decorators (classdef | funcdef | async_funcdef)
|
||||||
async_funcdef: ASYNC funcdef
|
async_funcdef: ASYNC funcdef
|
||||||
|
|
Loading…
Reference in New Issue