diff options
author | Paul McGuire <ptmcg@austin.rr.com> | 2015-10-29 05:57:09 +0000 |
---|---|---|
committer | Paul McGuire <ptmcg@austin.rr.com> | 2015-10-29 05:57:09 +0000 |
commit | 0208700c5e61efeccf89208562ebefb9b93cbce4 (patch) | |
tree | 0b485a4b566bd0b112beedc96728ed4642740895 /src/pyparsing.py | |
parent | 59278a1d1569c9ef720e3db591bc3feaa52c4b05 (diff) | |
download | pyparsing-git-0208700c5e61efeccf89208562ebefb9b93cbce4.tar.gz |
Redo withClass; fix typo in Word, remove Token.setName() that does nothing significant (suggested by williamzjc)
Diffstat (limited to 'src/pyparsing.py')
-rw-r--r-- | src/pyparsing.py | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/src/pyparsing.py b/src/pyparsing.py index bbcebe6..81c82ce 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.4"
-__versionTime__ = "24 Oct 2015 16:26"
+__versionTime__ = "28 Oct 2015 21:50"
__author__ = "Paul McGuire <ptmcg@users.sourceforge.net>"
import string
@@ -1572,11 +1572,6 @@ class Token(ParserElement): def __init__( self ):
super(Token,self).__init__( savelist=False )
- def setName(self, name):
- s = super(Token,self).setName(name)
- self.errmsg = "Expected " + self.name
- return s
-
class Empty(Token):
"""An empty token, will always match."""
@@ -1763,7 +1758,7 @@ class Word(Token): if ' ' not in self.initCharsOrig+self.bodyCharsOrig and (min==1 and max==0 and exact==0):
if self.bodyCharsOrig == self.initCharsOrig:
self.reString = "[%s]+" % _escapeRegexRangeChars(self.initCharsOrig)
- elif len(self.bodyCharsOrig) == 1:
+ elif len(self.initCharsOrig) == 1:
self.reString = "%s[%s]*" % \
(re.escape(self.initCharsOrig),
_escapeRegexRangeChars(self.bodyCharsOrig),)
@@ -3548,11 +3543,8 @@ def withClass(classname, namespace=''): """Simplified version of C{L{withAttribute}} when matching on a div class - made
difficult because C{class} is a reserved word in Python.
"""
- if namespace:
- key = "%s:class" % namespace
- else:
- key = "class"
- return withAttribute(**{key : classname})
+ classattr = "%s:class" % namespace if namespace else "class"
+ return withAttribute(**{classattr : classname})
opAssoc = _Constants()
opAssoc.LEFT = object()
|