Fix 'gather' rules in the python parser generator (GH-22021)

Currently, empty sequences in gather rules make the conditional for
gather rules fail as empty sequences evaluate as "False". We need to
explicitly check for "None" (the failure condition) to avoid false
negatives.
This commit is contained in:
Pablo Galindo 2020-09-03 15:29:55 +01:00 committed by GitHub
parent 315a61f7a9
commit e55a0e971b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 1 deletions

View file

@ -217,6 +217,9 @@ class PythonParserGenerator(ParserGenerator, GrammarVisitor):
else:
self.print("and")
self.visit(item)
if is_gather:
self.print("is not None")
self.print("):")
with self.indent():
action = node.action