diff options
Diffstat (limited to 'pyparsing/helpers.py')
-rw-r--r-- | pyparsing/helpers.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/pyparsing/helpers.py b/pyparsing/helpers.py index d710d78..97e5943 100644 --- a/pyparsing/helpers.py +++ b/pyparsing/helpers.py @@ -55,8 +55,9 @@ def countedArray(expr, intExpr=None): def countFieldParseAction(s, l, t): n = t[0] - arrayExpr << (n and Group(And([expr] * n)) or Group(empty)) - return [] + arrayExpr << (And([expr] * n) if n else empty) + # clear list contents, but keep any named results + del t[:] if intExpr is None: intExpr = Word(nums).setParseAction(lambda t: int(t[0])) |