summaryrefslogtreecommitdiff
path: root/src/pyparsing.py
diff options
context:
space:
mode:
authorPaul McGuire <ptmcg@austin.rr.com>2013-09-14 12:23:46 +0000
committerPaul McGuire <ptmcg@austin.rr.com>2013-09-14 12:23:46 +0000
commit06dd93096e7a43169cc83db740a122da29f6f38d (patch)
tree5a452920670ff5851e653a248875261051aa83ea /src/pyparsing.py
parentcaeaf5fc631794b845897c848a2483823b33050a (diff)
downloadpyparsing-git-06dd93096e7a43169cc83db740a122da29f6f38d.tar.gz
Move _expanded to inside soope of srange, since it is not used anywhere else
Diffstat (limited to 'src/pyparsing.py')
-rw-r--r--src/pyparsing.py3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/pyparsing.py b/src/pyparsing.py
index 1d76bbd..f96a0fb 100644
--- a/src/pyparsing.py
+++ b/src/pyparsing.py
@@ -3264,8 +3264,6 @@ _singleChar = _escapedPunc | _escapedHexChar | _escapedOctChar | Word(printables
_charRange = Group(_singleChar + Suppress("-") + _singleChar)
_reBracketExpr = Literal("[") + Optional("^").setResultsName("negate") + Group( OneOrMore( _charRange | _singleChar ) ).setResultsName("body") + "]"
-_expanded = lambda p: (isinstance(p,ParseResults) and ''.join(unichr(c) for c in range(ord(p[0]),ord(p[1])+1)) or p)
-
def srange(s):
r"""Helper to easily define string ranges for use in Word construction. Borrows
syntax from regexp '[]' string range definitions::
@@ -3283,6 +3281,7 @@ def srange(s):
a range of any of the above, separated by a dash ('a-z', etc.)
any combination of the above ('aeiouy', 'a-zA-Z0-9_$', etc.)
"""
+ _expanded = lambda p: p if not isinstance(p,ParseResults) else ''.join(unichr(c) for c in range(ord(p[0]),ord(p[1])+1))
try:
return "".join(_expanded(part) for part in _reBracketExpr.parseString(s).body)
except: