summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorptmcg <ptmcg@9bf210a0-9d2d-494c-87cf-cfb32e7dff7b>2016-08-05 19:38:41 +0000
committerptmcg <ptmcg@9bf210a0-9d2d-494c-87cf-cfb32e7dff7b>2016-08-05 19:38:41 +0000
commit71211524f1e8e2b33015ae6d00541f2dec18acf6 (patch)
treea9982e271a5420bb4cf7f3d5ca21c8c3c3ebaa6e
parent1e38ca42c51f546527b33e0065d16ab24c36ce89 (diff)
downloadpyparsing-71211524f1e8e2b33015ae6d00541f2dec18acf6.tar.gz
Fixed bug in upcaseTokens and downcaseTokens introduced in 2.1.5, when the parse action was used in conjunction with results names
git-svn-id: svn://svn.code.sf.net/p/pyparsing/code/trunk@388 9bf210a0-9d2d-494c-87cf-cfb32e7dff7b
-rw-r--r--src/CHANGES11
-rw-r--r--src/pyparsing.py4
-rw-r--r--src/unitTests.py5
3 files changed, 15 insertions, 5 deletions
diff --git a/src/CHANGES b/src/CHANGES
index 6cc9934..0e48b21 100644
--- a/src/CHANGES
+++ b/src/CHANGES
@@ -20,7 +20,14 @@ Version 2.1.6 -
respectively. I hope the "f" prefix of "fnumber" will be a better
indicator of its internal conversion of parsed values to floats,
while the generic "number" is similar to the flexible number syntax
- in other languages.
+ in other languages. Also fixed a bug in pyparsing_common.numeric
+ (now renamed to pyparsing_common.number), integers were parsed and
+ returned as floats instead of being retained as ints.
+
+- Fixed bug in upcaseTokens and downcaseTokens introduced in 2.1.5,
+ when the parse action was used in conjunction with results names.
+ Reported by Steven Arcangeli from the dql project, thanks for your
+ patience, Steven!
- Major change to docs! After seeing some comments on reddit about
general issue with docs of Python modules, and thinking that I'm a
@@ -55,8 +62,6 @@ Version 2.1.6 -
For tracing tokens in and out of parse actions, the more complete
repr form provides important information when debugging parse actions.
-
-- Fixed bug in pyparsing_common.numeric, integers were parsed as floats.
Verison 2.1.5 - June, 2016
diff --git a/src/pyparsing.py b/src/pyparsing.py
index 29c9d14..088cf26 100644
--- a/src/pyparsing.py
+++ b/src/pyparsing.py
@@ -58,7 +58,7 @@ The pyparsing module handles some of the problems that are typically vexing when
"""
__version__ = "2.1.6"
-__versionTime__ = "05 Aug 2016 18:11 UTC"
+__versionTime__ = "05 Aug 2016 19:32 UTC"
__author__ = "Paul McGuire <ptmcg@users.sourceforge.net>"
import string
@@ -3729,7 +3729,7 @@ def tokenMap(func, *args):
parsed data to an integer using base 16.
"""
def pa(s,l,t):
- t[:] = [func(tokn, *args) for tokn in t]
+ return [func(tokn, *args) for tokn in t]
try:
func_name = getattr(func, '__name__',
diff --git a/src/unitTests.py b/src/unitTests.py
index cddcaf1..a4c651f 100644
--- a/src/unitTests.py
+++ b/src/unitTests.py
@@ -1464,6 +1464,11 @@ class UpcaseDowncaseUnicode(ParseTestCase):
uword = pp.Word(ualphas).setParseAction(pp.downcaseTokens)
print_(uword.searchString(a))
+
+ kw = pp.Keyword('mykey', caseless=True).setParseAction(pp.upcaseTokens).setResultsName('rname')
+ ret = kw.parseString('mykey')
+ print(ret.rname)
+ assert ret.rname=='MYKEY', "failed to upcase with named result"
if not IRON_PYTHON_ENV:
#test html data