summaryrefslogtreecommitdiff
path: root/pyparsing/core.py
diff options
context:
space:
mode:
authorBu Sun Kim <8822365+busunkim96@users.noreply.github.com>2021-10-28 22:58:11 -0600
committerGitHub <noreply@github.com>2021-10-28 23:58:11 -0500
commit8bbc83e50ec9ca488c984466ecf8e242060916e1 (patch)
tree5b9de85f83455f689e2fbb5e1c457d1660492d4a /pyparsing/core.py
parent958d055040cae3eeafd23f2fe05e04cf035a04b8 (diff)
downloadpyparsing-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.py5
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):