localize 2 and 3 argument BUILD_SLICE...

Nontermninal name matches AST anme now. Add test.
This commit is contained in:
rocky
2017-11-25 21:07:43 -05:00
parent 3d7b160e30
commit b7003914c9
10 changed files with 53 additions and 17 deletions

View File

@@ -738,6 +738,18 @@ class Python3Parser(PythonParser):
self.custom_classfunc_rule(opname, token, customize,
seen_LOAD_BUILD_CLASS,
seen_GET_AWAITABLE_YIELD_FROM)
elif opname_base == 'BUILD_SLICE':
if token.attr == 2:
self.add_unique_rules([
'expr ::= slice2',
'slice2 ::= expr expr BUILD_SLICE_2'
], customize)
else:
assert token.attr == 3, "BUILD_SLICE value must be 2 or 3; is %s" % v
self.add_unique_rules([
'expr ::= slice3',
'slice3 ::= expr expr expr BUILD_SLICE_3',
], customize)
elif opname_base == 'CALL_METHOD':
# PyPy only - DRY with parse2