summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul McGuire <ptmcg@austin.rr.com>2015-12-17 10:12:34 +0000
committerPaul McGuire <ptmcg@austin.rr.com>2015-12-17 10:12:34 +0000
commitbb85a2668d57429c69dd489cdd42d4641654e1a8 (patch)
treede5b841c3f7b021454fbbcd898d339f8a3da3d1e
parent019fffcc5de6954cc74f42449ceb16bf9ed572f2 (diff)
downloadpyparsing-git-bb85a2668d57429c69dd489cdd42d4641654e1a8.tar.gz
Fixed bug in ignore() (introduced in pyparsing 1.5.3) that would not accept a string literal as the ignore expression.
-rw-r--r--src/CHANGES3
-rw-r--r--src/pyparsing.py7
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