Thank you to anyone who has already donated - your generous donations helped make three months of treatment possible.

My brother Nate continues to fight stage IV Hodgkin's lymphoma. He's just 31, with a wife and baby girl. They have no active income (since he's been unable to return to work), no insurance, and cannot afford the treatment he needs. Nate and his family need your help. Please consider a donation, every dollar helps. Thanks.



			
--- pyparsing.orig	2008-04-08 09:31:16.515625000 -0600
+++ pyparsing.py	2008-04-08 09:26:36.656250000 -0600
@@ -82,6 +82,9 @@
     __MAX_INT__ = sys.maxint
     __BASE_STRING__ = basestring

+# Global used for recording furthest parse:
+LastParseLoc = 0
+
 def _ustr(obj):
     """Drop-in replacement for str(obj) that tries to be Unicode friendly. It first tries
        str(obj). If that fails with a UnicodeEncodeError, then it tries unicode(obj). It
@@ -826,6 +829,7 @@

     #~ @profile
     def _parseNoCache( self, instring, loc, doActions=True, callPreParse=True ):
+        global LastParseLoc
         debugging = ( self.debug ) #and doActions )

         if debugging or self.failAction:
@@ -866,6 +870,8 @@
         tokens = self.postParse( instring, loc, tokens )

         retTokens = ParseResults( tokens, self.resultsName, asList=self.saveAsList, modal=self.modalResults )
+        if loc > LastParseLoc:
+            LastParseLoc = loc
         if self.parseAction and (doActions or self.callDuringTry):
             if debugging:
                 try:
@@ -923,7 +929,9 @@
     # argument cache for optimizing repeated calls when backtracking through recursive expressions
     _exprArgCache = {}
     def resetCache():
+        global LastParseLoc
         ParserElement._exprArgCache.clear()
+        LastParseLoc = 0
     resetCache = staticmethod(resetCache)

     _packratEnabled = False