summaryrefslogtreecommitdiff
path: root/src/CHANGES
diff options
context:
space:
mode:
authorptmcg <ptmcg@9bf210a0-9d2d-494c-87cf-cfb32e7dff7b>2016-05-24 05:25:54 +0000
committerptmcg <ptmcg@9bf210a0-9d2d-494c-87cf-cfb32e7dff7b>2016-05-24 05:25:54 +0000
commite4d24d41d23ffbd97845d38f18d2c807e7142981 (patch)
tree5c863b9ccb9842b453cb50838067cd5fd63d1d53 /src/CHANGES
parentce69f78f782ef6e6b6212308666389f43145f2dc (diff)
downloadpyparsing-e4d24d41d23ffbd97845d38f18d2c807e7142981.tar.gz
Added tokenMap parse action helper; general code cleanup; renamed literalStringClass to _literalStringClass throughout
git-svn-id: svn://svn.code.sf.net/p/pyparsing/code/trunk@358 9bf210a0-9d2d-494c-87cf-cfb32e7dff7b
Diffstat (limited to 'src/CHANGES')
-rw-r--r--src/CHANGES31
1 files changed, 28 insertions, 3 deletions
diff --git a/src/CHANGES b/src/CHANGES
index aa0dcee..446e3b4 100644
--- a/src/CHANGES
+++ b/src/CHANGES
@@ -4,6 +4,31 @@ Change Log
Verison 2.1.5 -
------------------------------
+- Added a new parse action construction helper tokenMap, which will
+ apply a function and optional arguments to each element in a
+ ParseResults. So this parse action:
+
+ def lowercase_all(tokens):
+ return [str(t).lower() for t in tokens]
+ OneOrMore(Word(alphas)).setParseAction(lowercase_all)
+
+ can now be written:
+
+ OneOrMore(Word(alphas)).setParseAction(tokenMap(str.lower))
+
+ Also simplifies writing conversion parse actions like:
+
+ integer = Word(nums).setParseAction(lambda t: int(t[0]))
+
+ to just:
+
+ integer = Word(nums).setParseAction(tokenMap(int))
+
+ If additional arguments are necessary, they can be included in the
+ call to tokenMap, as in:
+
+ hex_integer = Word(hexnums).setParseAction(tokenMap(int, 16))
+
- Added more expressions to pyparsing_common:
. IPv4 and IPv6 addresses (including long, short, and mixed forms
of IPv6)
@@ -16,9 +41,9 @@ Verison 2.1.5 -
and an output list of each test and its output lines.
- Added failureTests argument (default=False) to runTests, so that
- tests can be run that are expected failures, and if all tests fail
- as expected, the runTests' success value will return True. Also,
- parseAll now default to True.
+ tests can be run that are expected failures, and runTests' success
+ value will return True only if all tests *fail* as expected. Also,
+ parseAll now defaults to True.
Version 2.1.4 - May, 2016