Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(263108)

#24619: async/await parser issues

Can't Edit
Can't Publish+Mail
Start Review
Created:
4 years, 1 month ago by stefan
Modified:
4 years, 1 month ago
Reviewers:
CC:
gvanrossum, Nick Coghlan, haypo, Benjamin Peterson, skrah, devnull_psf.upfronthosting.co.za, Martin Panter, Yury Selivanov
Visibility:
Public.

Patch Set 1 #

Patch Set 2 #

Patch Set 3 #

Patch Set 4 #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats Patch
Lib/lib2to3/pgen2/tokenize.py View 1 2 3 5 chunks +19 lines, -14 lines 0 comments Download
Lib/lib2to3/tests/test_parser.py View 1 2 3 1 chunk +22 lines, -0 lines 0 comments Download
Lib/test/test_tokenize.py View 1 2 3 1 chunk +73 lines, -0 lines 0 comments Download
Lib/tokenize.py View 1 2 3 5 chunks +23 lines, -16 lines 0 comments Download
Parser/tokenizer.c View 1 2 3 9 chunks +34 lines, -80 lines 2 comments Download
Parser/tokenizer.h View 1 2 3 1 chunk +6 lines, -15 lines 0 comments Download

Messages

Total messages: 1
skrah
4 years, 1 month ago #1
http://bugs.python.org/review/24619/diff/15262/Parser/tokenizer.c
File Parser/tokenizer.c (right):

http://bugs.python.org/review/24619/diff/15262/Parser/tokenizer.c#newcode1452
Parser/tokenizer.c:1452: if (tok->async_def
I think it might be possible to replace this block at the expense of an extra
lookahead right where NEWLINE is returned (see the other comment) ...

http://bugs.python.org/review/24619/diff/15262/Parser/tokenizer.c#newcode1559
Parser/tokenizer.c:1559: tok->async_def_nl = 1;
... so here I mean it would be possible to check if the lookahead is INDENT,
largely because we have:

  ASYNC DEF NAME parameters ['->' test] ':' suite

And suite is either

  NEWLINE INDENT stmt+ DEDENT

or

  small_stmt ... NEWLINE


I'm not completely sure if it adds clarity, but it's
closer to the grammar and you have to keep less state in
your head.
Sign in to reply to this message.

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+