3.6-3.8 "async for" handling...

And add an if_stmt rule for 3.8. My want to extend it back to
other versions.
This commit is contained in:
rocky
2019-04-13 18:31:40 -04:00
parent 44edf1d7db
commit 5d91e96358
9 changed files with 114 additions and 6 deletions

View File

@@ -516,6 +516,10 @@ def customize_for_version3(self, version):
'tryfinally_return_stmt':
( '%|try:\n%+%c%-%|finally:\n%+%|return%-\n\n', 1 ),
'async_for_stmt36': (
'%|async for %c in %c:\n%+%c%-%-\n\n',
(9, 'store'), (1, 'expr'), (18, 'for_block') ),
'call_ex' : (
'%c(%p)',
(0, 'expr'), (1, 100)),
@@ -917,10 +921,10 @@ def customize_for_version3(self, version):
'attribute37': ( '%c.%[1]{pattr}', 0 ),
'async_forelse_stmt': (
'%|async for %c in %c:\n%+%c%-%|else:\n%+%c%-\n\n',
7, 1, 17, (25, 'else_suite') ),
(7, 'store'), (1, 'expr'), (17, 'for_block'), (25, 'else_suite') ),
'async_for_stmt': (
'%|async for %c in %c:\n%+%c%-%-\n\n',
7, 1, 17),
(7, 'store'), (1, 'expr'), (17, 'for_block')),
'compare_chained1a_37': ( ' %[3]{pattr.replace("-", " ")} %p %p',
(0, 19),
(-4, 19)),
@@ -931,6 +935,9 @@ def customize_for_version3(self, version):
'compare_chained2b_37': ( '%[1]{pattr.replace("-", " ")} %p', (0, 19)),
'async_for_stmt37': (
'%|async for %c in %c:\n%+%c%-%-\n\n',
(7, 'store'), (1, 'expr'), (16, 'for_block') ),
})
if version >= 3.8:
########################
@@ -943,6 +950,10 @@ def customize_for_version3(self, version):
# del TABLE_DIRECT[lhs]
TABLE_DIRECT.update({
'async_for_stmt38': (
'%|async for %c in %c:\n%+%c%-%-\n\n',
(0, 'expr'), (7, 'store'), (8, 'for_block') ),
'for38': (
'%|for %c in %c:\n%+%c%-\n\n',
(2, 'store'),