Work around grammar remove rule bug...

And reinstate source to a current 3.3 bug (which we don't detect).
But at least it is noted for future work.
This commit is contained in:
rocky
2017-11-26 08:05:38 -05:00
parent ad755b27a3
commit a5e3d01dd3
5 changed files with 29 additions and 0 deletions

View File

@@ -20,6 +20,7 @@ def test_grammar():
unused_rhs = set(['build_list', 'call_function', 'mkfunc',
'mklambda',
'unpack',])
expect_right_recursive = frozenset([('designList',
('designator', 'DUP_TOP', 'designList'))])
if PYTHON3:
@@ -35,6 +36,13 @@ def test_grammar():
pass
else:
expect_lhs.add('kwarg')
# FIXME: grammar remove_rule on
# kv3 ::= expr expr STORE_MAP
# doesn't currently work in grammar, so we have this extraneous kv3 around.
if 3.3 <= PYTHON_VERSION <= 3.4:
expect_lhs.add('kv3')
assert expect_lhs == set(lhs)
assert unused_rhs == set(rhs)
assert expect_right_recursive == right_recursive

Binary file not shown.

View File

@@ -0,0 +1,3 @@
# Test of building map via kv rules
aa = 'aa'
dict0 = {'a': 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa','b': 1234,'d': aa,aa: aa}

View File

@@ -0,0 +1,18 @@
# From 3.4 mailbox.py
# Bug is not not getting control structure right
# specifically the 2nd elif not line
def _generate_toc(line):
while 1:
if line.startswith('2'):
line = 5
while 1:
if line:
line = 6
break
elif not line:
line = 7
break
elif not line:
break
return 1