summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorptmcg <ptmcg@9bf210a0-9d2d-494c-87cf-cfb32e7dff7b>2008-12-05 16:46:40 +0000
committerptmcg <ptmcg@9bf210a0-9d2d-494c-87cf-cfb32e7dff7b>2008-12-05 16:46:40 +0000
commit8034c224cd41d2e681ca91d4df859786a2f7d20c (patch)
tree86547f1f58ef943f38757b7d5d3a85f5dcb64648
parent5116e14c8f5e78444f4fe9609fb875db75250530 (diff)
downloadpyparsing-8034c224cd41d2e681ca91d4df859786a2f7d20c.tar.gz
Make generator expr handling tolerant of getting non-iterables
git-svn-id: svn://svn.code.sf.net/p/pyparsing/code/src@175 9bf210a0-9d2d-494c-87cf-cfb32e7dff7b
-rw-r--r--pyparsing.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/pyparsing.py b/pyparsing.py
index 92fb76e..17e3b9e 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.2"
-__versionTime__ = "8 November 2008 05:36"
+__versionTime__ = "5 December 2008 10:27"
__author__ = "Paul McGuire <ptmcg@users.sourceforge.net>"
import string
@@ -2208,7 +2208,10 @@ class ParseExpression(ParserElement):
elif isinstance( exprs, basestring ):
self.exprs = [ Literal( exprs ) ]
else:
- self.exprs = list( exprs )
+ try:
+ self.exprs = list( exprs )
+ except TypeError:
+ self.exprs = [ exprs ]
self.callPreparse = False
def __getitem__( self, i ):
@@ -3195,7 +3198,7 @@ def oneOf( strs, caseless=False, useRegex=True ):
parseElementClass = Literal
if isinstance(strs,(list,tuple)):
- symbols = strs[:]
+ symbols = list(strs[:])
elif isinstance(strs,basestring):
symbols = strs.split()
else: