mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2024-11-27 15:10:55 +00:00
Add reduce check for aug_assign1
This commit is contained in:
parent
815ae2c5cd
commit
5079164db2
@ -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"
|
||||
|
@ -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 *
|
||||
|
10
uncompyle6/parsers/reducecheck/aug_assign.py
Normal file
10
uncompyle6/parsers/reducecheck/aug_assign.py
Normal 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
|
Loading…
Reference in New Issue
Block a user