summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorptmcg <ptmcg@austin.rr.com>2020-03-29 19:51:27 -0500
committerptmcg <ptmcg@austin.rr.com>2020-03-29 19:51:27 -0500
commit6a844ee35ca5125490a28dbd6dd2d15b6498e605 (patch)
treef9ffffc05d9be6699bd8354f8d4afaa4d40749a8
parentefc700935cac7504d1ba533cccb699517fd9c4f1 (diff)
downloadpyparsing-git-6a844ee35ca5125490a28dbd6dd2d15b6498e605.tar.gz
Backport FutureWarning fix (regex with nested set), and runTests reformatpyparsing_2.4.7
-rw-r--r--CHANGES2
-rw-r--r--pyparsing.py8
2 files changed, 6 insertions, 4 deletions
diff --git a/CHANGES b/CHANGES
index 0efa43d..4a637f9 100644
--- a/CHANGES
+++ b/CHANGES
@@ -10,6 +10,8 @@ Version 2.4.7 - March, 2020
. Traceback abbreviation
. Bug in delta_time example
. Fix regexen in pyparsing_common.real and .sci_real
+ . Avoid FutureWarning on Python 3.7 or later
+ . Cleanup output in runTests if comments are embedded in test string
Version 2.4.6 - December, 2019
diff --git a/pyparsing.py b/pyparsing.py
index 2e5534a..581d5bb 100644
--- a/pyparsing.py
+++ b/pyparsing.py
@@ -96,7 +96,7 @@ classes inherit from. Use the docstrings for examples of how to:
"""
__version__ = "2.4.7"
-__versionTime__ = "04 Mar 2020 02:48 UTC"
+__versionTime__ = "30 Mar 2020 00:43 UTC"
__author__ = "Paul McGuire <ptmcg@users.sourceforge.net>"
import string
@@ -2740,7 +2740,7 @@ class ParserElement(object):
continue
if not t:
continue
- out = ['\n'.join(comments), t]
+ out = ['\n' + '\n'.join(comments) if comments else '', t]
comments = []
try:
# convert newline marks to actual newlines, and strip leading BOM if present
@@ -5452,8 +5452,8 @@ def matchPreviousExpr(expr):
return rep
def _escapeRegexRangeChars(s):
- # ~ escape these chars: ^-]
- for c in r"\^-]":
+ # ~ escape these chars: ^-[]
+ for c in r"\^-[]":
s = s.replace(c, _bslash + c)
s = s.replace("\n", r"\n")
s = s.replace("\t", r"\t")