diff options
author | Bu Sun Kim <8822365+busunkim96@users.noreply.github.com> | 2021-10-28 22:58:11 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-28 23:58:11 -0500 |
commit | 8bbc83e50ec9ca488c984466ecf8e242060916e1 (patch) | |
tree | 5b9de85f83455f689e2fbb5e1c457d1660492d4a /pyparsing/core.py | |
parent | 958d055040cae3eeafd23f2fe05e04cf035a04b8 (diff) | |
download | pyparsing-git-8bbc83e50ec9ca488c984466ecf8e242060916e1.tar.gz |
Wrap tokenlist in list if `self.resultsName` is present (#324)
* Wrap tokenlist in list if self.ResulstName is present for Dict
* Use as_dict instead of asDict
Diffstat (limited to 'pyparsing/core.py')
-rw-r--r-- | pyparsing/core.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/pyparsing/core.py b/pyparsing/core.py index b477083..c815468 100644 --- a/pyparsing/core.py +++ b/pyparsing/core.py @@ -5413,7 +5413,10 @@ class Dict(TokenConverter): else: tokenlist[ikey] = _ParseResultsWithOffset(dictvalue[0], i) - return tokenlist if not self._asPythonDict else tokenlist.as_dict() + if self._asPythonDict: + return tokenlist.as_dict() + else: + return [tokenlist] if self.resultsName else tokenlist class Suppress(TokenConverter): |