summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorptmcg <ptmcg@9bf210a0-9d2d-494c-87cf-cfb32e7dff7b>2008-08-04 18:12:43 +0000
committerptmcg <ptmcg@9bf210a0-9d2d-494c-87cf-cfb32e7dff7b>2008-08-04 18:12:43 +0000
commitf5f1b612b4853eea1f4b5289c3b5116932c1a9cc (patch)
treef1dc45cd43e8c89300b9dfbcfd44d9c254e35b0b
parent3cc36e8c8ffc628342c71e882a61d6d2c1536107 (diff)
downloadpyparsing-f5f1b612b4853eea1f4b5289c3b5116932c1a9cc.tar.gz
Removed generator expression for compatibility with older Python versions
git-svn-id: svn://svn.code.sf.net/p/pyparsing/code/src@162 9bf210a0-9d2d-494c-87cf-cfb32e7dff7b
-rw-r--r--CHANGES14
-rw-r--r--pyparsing.py11
2 files changed, 15 insertions, 10 deletions
diff --git a/CHANGES b/CHANGES
index 2ae2109..12e0c80 100644
--- a/CHANGES
+++ b/CHANGES
@@ -31,8 +31,8 @@ Version 1.5.1 - ???, 2008
- Removed dependency on xml.sax.saxutils.escape, and included
internal implementation instead - proposed by Mike Droettboom on
the pyparsing mailing list, thanks Mike! Also fixed erroneous
- mapping in replaceHTMLEntity of &quot to ', now correctly maps
- to ".
+ mapping in replaceHTMLEntity of &quot; to ', now correctly maps
+ to ". (Also added support for mapping &apos; to '.)
- Fixed typo in ParseResults.insert, found by Alejandro Dubrovsky,
good catch!
@@ -44,12 +44,16 @@ Version 1.5.1 - ???, 2008
defined.
- Fixed bug in ParseResults.asXML(), in which the first named
- item within a ParseResults gets reported with an <ITEM> tag instead
- of with the correct results name.
+ item within a ParseResults gets reported with an <ITEM> tag
+ instead of with the correct results name.
-- Fixed bug in '-' error stop, when '-' operator used inside a
+- Fixed bug in '-' error stop, when '-' operator is used inside a
Combine expression.
+- Reverted generator expression to use list comprehension, for
+ better compatibility with old versions of Python. Reported by
+ jester/artixdesign on the SourceForge pyparsing discussion list.
+
Version 1.5.0 - June, 2008
--------------------------
diff --git a/pyparsing.py b/pyparsing.py
index 1b7b89c..47be47c 100644
--- a/pyparsing.py
+++ b/pyparsing.py
@@ -59,7 +59,7 @@ The pyparsing module handles some of the problems that are typically vexing when
"""
__version__ = "1.5.1"
-__versionTime__ = "27 July 2008 02:11"
+__versionTime__ = "4 August 2008 12:21"
__author__ = "Paul McGuire <ptmcg@users.sourceforge.net>"
import string
@@ -129,17 +129,18 @@ if not _PY3K:
# ...
else:
_ustr = str
+ unichr = chr
def _str2dict(strg):
return dict( [(c,0) for c in strg] )
#~ return set( [c for c in strg] )
def _xml_escape(data):
- """Escape &, <, >, ', etc. in a string of data."""
+ """Escape &, <, >, ", ', etc. in a string of data."""
# ampersand must be replaced first
- from_symbols = '&><"'
- to_symbols = ['&'+s+';' for s in "amp gt lt quot".split()]
+ from_symbols = '&><"\''
+ to_symbols = ['&'+s+';' for s in "amp gt lt quot apos".split()]
for from_,to_ in zip(from_symbols, to_symbols):
data = data.replace(from_, to_)
return data
@@ -2523,7 +2524,7 @@ class Each(ParseExpression):
raise ParseException(instring,loc,"Missing one or more required elements (%s)" % missing )
# add any unmatched Optionals, in case they have default values defined
- matchOrder += list(e for e in self.exprs if isinstance(e,Optional) and e.expr in tmpOpt)
+ matchOrder += [ e for e in self.exprs if isinstance(e,Optional) and e.expr in tmpOpt ]
resultlist = []
for e in matchOrder: