Add reduce check for aug_assign1

This commit is contained in:
rocky 2020-07-07 08:20:09 -04:00
parent 815ae2c5cd
commit 5079164db2
3 changed files with 14 additions and 0 deletions

View File

@ -7,6 +7,7 @@ from xdis import next_offset
from uncompyle6.parser import PythonParserSingle, nop_func
from uncompyle6.parsers.parse2 import Python2Parser
from uncompyle6.parsers.reducecheck import (
aug_assign1_check,
or_check,
tryelsestmt,
except_handler,
@ -231,6 +232,7 @@ class Python27Parser(Python2Parser):
# FIXME: Put more in this table
self.reduce_check_table = {
# "ifelsestmt": ifelsestmt,
"aug_assign1": aug_assign1_check,
"except_handler": except_handler,
"or": or_check,
"tryelsestmt": tryelsestmt,
@ -238,6 +240,7 @@ class Python27Parser(Python2Parser):
}
self.check_reduce["and"] = "AST"
self.check_reduce["aug_assign1"] = "AST"
self.check_reduce["if_exp"] = "AST"
self.check_reduce["except_handler"] = "tokens"

View File

@ -1,4 +1,5 @@
from uncompyle6.parsers.reducecheck.and_check import *
from uncompyle6.parsers.reducecheck.aug_assign import *
from uncompyle6.parsers.reducecheck.except_handler import *
from uncompyle6.parsers.reducecheck.except_handler_else import *
from uncompyle6.parsers.reducecheck.ifelsestmt import *

View File

@ -0,0 +1,10 @@
# Copyright (c) 2020 Rocky Bernstein
def aug_assign1_check(self, lhs, n, rule, ast, tokens, first, last):
# print("XXX", first, last, rule)
# for t in range(first, last): print(tokens[t])
# print("="*40)
expr = ast[0]
return expr == "expr" and expr[0] == "or"
return False