diff options
author | Paul McGuire <ptmcg@austin.rr.com> | 2016-02-16 05:29:05 +0000 |
---|---|---|
committer | Paul McGuire <ptmcg@austin.rr.com> | 2016-02-16 05:29:05 +0000 |
commit | 45497862b01f903b2dd30f01438ba105db6e2755 (patch) | |
tree | 7ceb17e0ace7e3a8ff251235db75778e9ab56798 /src/pyparsing.py | |
parent | e00f2dadc147e459e3abce4d2a7792ddc5cc417b (diff) | |
download | pyparsing-git-45497862b01f903b2dd30f01438ba105db6e2755.tar.gz |
Removed use of partial in replaceWith, for PyPy compatibility. Removed no-longer-used method getTokensEndLoc (was part of keepOriginalText, previously deprecated and deleted).
Diffstat (limited to 'src/pyparsing.py')
-rw-r--r-- | src/pyparsing.py | 23 |
1 files changed, 2 insertions, 21 deletions
diff --git a/src/pyparsing.py b/src/pyparsing.py index e84f97f..9e086bc 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.1.1"
-__versionTime__ = "14 Feb 2016 18:34"
+__versionTime__ = "15 Feb 2016 23:22"
__author__ = "Paul McGuire <ptmcg@users.sourceforge.net>"
import string
@@ -3473,10 +3473,7 @@ def replaceWith(replStr): """Helper method for common parse actions that simply return a literal value. Especially
useful when used with C{L{transformString<ParserElement.transformString>}()}.
"""
- #def _replFunc(*args):
- # return [replStr]
- #return _replFunc
- return functools.partial(next, itertools.repeat([replStr]))
+ return lambda s,l,t: [replStr]
def removeQuotes(s,l,t):
"""Helper parse action for removing quotation marks from parsed quoted strings.
@@ -3493,22 +3490,6 @@ def downcaseTokens(s,l,t): """Helper parse action to convert tokens to lower case."""
return [ tt.lower() for tt in map(_ustr,t) ]
-def getTokensEndLoc():
- """Method to be called from within a parse action to determine the end
- location of the parsed tokens."""
- import inspect
- fstack = inspect.stack()
- try:
- # search up the stack (through intervening argument normalizers) for correct calling routine
- for f in fstack[2:]:
- if f[3] == "_parseNoCache":
- endloc = f[0].f_locals["loc"]
- return endloc
- else:
- raise ParseFatalException("incorrect usage of getTokensEndLoc - may only be called from within a parse action")
- finally:
- del fstack
-
def _makeTags(tagStr, xml):
"""Internal helper to construct opening and closing tag expressions, given a tag name"""
if isinstance(tagStr,basestring):
|