diff options
author | ptmcg <ptmcg@9bf210a0-9d2d-494c-87cf-cfb32e7dff7b> | 2015-12-17 10:12:34 +0000 |
---|---|---|
committer | ptmcg <ptmcg@9bf210a0-9d2d-494c-87cf-cfb32e7dff7b> | 2015-12-17 10:12:34 +0000 |
commit | 9e48c8e161bb093ae13de45dd8bcc9947be583c1 (patch) | |
tree | de5b841c3f7b021454fbbcd898d339f8a3da3d1e | |
parent | 7855d2ca9c3f3c323c73f7ba958fd54863ba8cb8 (diff) | |
download | pyparsing-9e48c8e161bb093ae13de45dd8bcc9947be583c1.tar.gz |
Fixed bug in ignore() (introduced in pyparsing 1.5.3) that would not accept a string literal as the ignore expression.
git-svn-id: svn://svn.code.sf.net/p/pyparsing/code/trunk@306 9bf210a0-9d2d-494c-87cf-cfb32e7dff7b
-rw-r--r-- | src/CHANGES | 3 | ||||
-rw-r--r-- | src/pyparsing.py | 7 |
2 files changed, 8 insertions, 2 deletions
diff --git a/src/CHANGES b/src/CHANGES index fbae5d7..e7956b1 100644 --- a/src/CHANGES +++ b/src/CHANGES @@ -16,6 +16,9 @@ Version 2.0.7 - - Fixed implementation of dir() for ParseResults - was leaving out all the
defined methods and just adding the custom results names.
+- Fixed bug in ignore() that was introduced in pyparsing 1.5.3, that would
+ not accept a string literal as the ignore expression.
+
Version 2.0.6 -
---------------------------
diff --git a/src/pyparsing.py b/src/pyparsing.py index 9d697dd..2fee683 100644 --- a/src/pyparsing.py +++ b/src/pyparsing.py @@ -58,7 +58,7 @@ The pyparsing module handles some of the problems that are typically vexing when """
__version__ = "2.0.7"
-__versionTime__ = "13 Dec 2015 13:09"
+__versionTime__ = "17 Dec 2015 04:11"
__author__ = "Paul McGuire <ptmcg@users.sourceforge.net>"
import string
@@ -1452,9 +1452,12 @@ class ParserElement(object): matching; may be called repeatedly, to define multiple comment or other
ignorable patterns.
"""
+ if isinstance(other, basestring):
+ other = Suppress(other)
+
if isinstance( other, Suppress ):
if other not in self.ignoreExprs:
- self.ignoreExprs.append( other.copy() )
+ self.ignoreExprs.append(other)
else:
self.ignoreExprs.append( Suppress( other.copy() ) )
return self
|