summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul McGuire <ptmcg@austin.rr.com>2018-12-22 09:35:02 -0600
committerPaul McGuire <ptmcg@austin.rr.com>2018-12-22 09:35:02 -0600
commitdf1bf408c5709478a6e30186a9ce70d55e4f2488 (patch)
treee3c31363226e15c1c628eac69924bcc640f9c51f
parentaf436afac04288222cfc5539888d3f2a462070a1 (diff)
downloadpyparsing-git-df1bf408c5709478a6e30186a9ce70d55e4f2488.tar.gz
Fix runTests to strip leading BOM added for some unicode strings after splitlines(); fix typo in CHANGES when I renamed post_parse to postParse
-rw-r--r--CHANGES2
-rw-r--r--pyparsing.py5
2 files changed, 4 insertions, 3 deletions
diff --git a/CHANGES b/CHANGES
index e577840..1cd7263 100644
--- a/CHANGES
+++ b/CHANGES
@@ -21,7 +21,7 @@ Version 2.3.1 -
- Expanded the whitespace characters recognized by the White class to include
all unicode defined spaces. Suggested in Issue #51 by rtkjbillo.
-- Added optional post_parse argument to ParserElement.runTests() to add a
+- Added optional postParse argument to ParserElement.runTests() to add a
custom callback to be called for test strings that parse successfully. Useful
for running tests that do additional validation or processing on the parsed
results.
diff --git a/pyparsing.py b/pyparsing.py
index 59735a0..44773be 100644
--- a/pyparsing.py
+++ b/pyparsing.py
@@ -94,7 +94,7 @@ classes inherit from. Use the docstrings for examples of how to:
"""
__version__ = "2.3.1"
-__versionTime__ = "21 Dec 2018 06:14 UTC"
+__versionTime__ = "22 Dec 2018 15:31 UTC"
__author__ = "Paul McGuire <ptmcg@users.sourceforge.net>"
import string
@@ -2449,7 +2449,8 @@ class ParserElement(object):
out = ['\n'.join(comments), t]
comments = []
try:
- t = t.replace(r'\n','\n')
+ # convert newline marks to actual newlines, and strip leading BOM if present
+ t = t.replace(r'\n','\n').lstrip('\ufeff')
result = self.parseString(t, parseAll=parseAll)
out.append(result.dump(full=fullDump))
success = success and not failureTests