From c8d15e7654477ce29a25e81813a9e77adea61f56 Mon Sep 17 00:00:00 2001 From: rocky Date: Mon, 2 Oct 2017 03:09:28 -0400 Subject: [PATCH] spark-parser induced changes... reduce rules can be called without token streams. --- uncompyle6/parsers/parse2.py | 2 ++ uncompyle6/parsers/parse3.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/uncompyle6/parsers/parse2.py b/uncompyle6/parsers/parse2.py index 56ba9713..75eec18d 100644 --- a/uncompyle6/parsers/parse2.py +++ b/uncompyle6/parsers/parse2.py @@ -397,6 +397,8 @@ class Python2Parser(PythonParser): return def reduce_is_invalid(self, rule, ast, tokens, first, last): + if not tokens: + return lhs = rule[0] if lhs in ('augassign1', 'augassign2') and ast[0][0] == 'and': return True diff --git a/uncompyle6/parsers/parse3.py b/uncompyle6/parsers/parse3.py index 91cc304a..d5e20775 100644 --- a/uncompyle6/parsers/parse3.py +++ b/uncompyle6/parsers/parse3.py @@ -884,6 +884,8 @@ class Python3Parser(PythonParser): return def reduce_is_invalid(self, rule, ast, tokens, first, last): + if not tokens: + return lhs = rule[0] if lhs in ('augassign1', 'augassign2') and ast[0][0] == 'and': return True