diff options
author | ptmcg <ptmcg@austin.rr.com> | 2021-10-24 10:12:45 -0500 |
---|---|---|
committer | ptmcg <ptmcg@austin.rr.com> | 2021-10-24 10:12:45 -0500 |
commit | 121a2394ec99f67a641a0d114c31f6f48482031f (patch) | |
tree | 146d8ff5904e1ce245dd6640b90c436582dff24d /pyparsing | |
parent | a80951bdb0d75c2d7f81a7cd2fda31f7f02d045b (diff) | |
download | pyparsing-git-121a2394ec99f67a641a0d114c31f6f48482031f.tar.gz |
Fixed bug in Word with max argument (#314)
Diffstat (limited to 'pyparsing')
-rw-r--r-- | pyparsing/__init__.py | 2 | ||||
-rw-r--r-- | pyparsing/core.py | 6 |
2 files changed, 6 insertions, 2 deletions
diff --git a/pyparsing/__init__.py b/pyparsing/__init__.py index 686d99f..cfbf5bc 100644 --- a/pyparsing/__init__.py +++ b/pyparsing/__init__.py @@ -105,7 +105,7 @@ __version__ = "{}.{}.{}".format(*__version_info__[:3]) + ( ), "", )[__version_info__.release_level == "final"] -__version_time__ = "24 October 2021 12:59 UTC" +__version_time__ = "24 October 2021 15:09 UTC" __versionTime__ = __version_time__ __author__ = "Paul McGuire <ptmcg.gm+pyparsing@gmail.com>" diff --git a/pyparsing/core.py b/pyparsing/core.py index 26aedd4..960f6fc 100644 --- a/pyparsing/core.py +++ b/pyparsing/core.py @@ -2680,6 +2680,7 @@ class Word(Token): self.mayIndexError = False self.asKeyword = asKeyword + # see if we can make a regex for this Word if " " not in self.initChars | self.bodyChars and (min == 1 and exact == 0): if self.bodyChars == self.initChars: if max == 0: @@ -2687,7 +2688,10 @@ class Word(Token): elif max == 1: repeat = "" else: - repeat = "{{{}}}".format(max) + repeat = "{{{},{}}}".format( + self.minLen, + "" if self.maxLen == _MAX_INT else self.maxLen + ) self.reString = "[{}]{}".format( _collapseStringToRanges(self.initChars), repeat, |