summaryrefslogtreecommitdiff
path: root/pyparsing.py
diff options
context:
space:
mode:
authorPaul McGuire <ptmcg@austin.rr.com>2019-04-07 13:29:09 -0500
committerPaul McGuire <ptmcg@austin.rr.com>2019-04-07 13:29:09 -0500
commit2a81eb83ff5450e85bd22bd2ed35e43938c18208 (patch)
tree8f493ce0cbe5002434461402d723bf89cce77a41 /pyparsing.py
parent2e1caf23bd59c3fc97facf27757c671bcef84dba (diff)
downloadpyparsing-git-2a81eb83ff5450e85bd22bd2ed35e43938c18208.tar.gz
Additional useful kwargs for Char (passthru to Word)
Diffstat (limited to 'pyparsing.py')
-rw-r--r--pyparsing.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/pyparsing.py b/pyparsing.py
index 093d346..5b5897f 100644
--- a/pyparsing.py
+++ b/pyparsing.py
@@ -94,7 +94,7 @@ classes inherit from. Use the docstrings for examples of how to:
"""
__version__ = "2.4.0"
-__versionTime__ = "07 Apr 2019 12:40 UTC"
+__versionTime__ = "07 Apr 2019 18:28 UTC"
__author__ = "Paul McGuire <ptmcg@users.sourceforge.net>"
import string
@@ -2876,6 +2876,7 @@ class Word(Token):
def __init__( self, initChars, bodyChars=None, min=1, max=0, exact=0, asKeyword=False, excludeChars=None ):
super(Word,self).__init__()
if excludeChars:
+ excludeChars = set(excludeChars)
initChars = ''.join(c for c in initChars if c not in excludeChars)
if bodyChars:
bodyChars = ''.join(c for c in bodyChars if c not in excludeChars)
@@ -2990,8 +2991,8 @@ class Char(Word):
when defining a match of any single character in a string of
characters.
"""
- def __init__(self, charset):
- super(Char, self).__init__(charset, exact=1)
+ def __init__(self, charset, asKeyword=False, excludeChars=None):
+ super(Char, self).__init__(charset, exact=1, asKeyword=asKeyword, excludeChars=excludeChars)
self.reString = "[%s]" % _escapeRegexRangeChars(self.initCharsOrig)
self.re = re.compile( self.reString )