summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorptmcg <ptmcg@9bf210a0-9d2d-494c-87cf-cfb32e7dff7b>2008-11-06 18:32:39 +0000
committerptmcg <ptmcg@9bf210a0-9d2d-494c-87cf-cfb32e7dff7b>2008-11-06 18:32:39 +0000
commit84c458be8666d4b2c8ea54b3dd704d8f5eee811b (patch)
tree5a67c18f7eb43c9e6c5fd2b038d5723d3c9bf9ae
parent9707144cb337693f9fcb1db33c8ce879669762e2 (diff)
downloadpyparsing-84c458be8666d4b2c8ea54b3dd704d8f5eee811b.tar.gz
Fix ignoreExpr handling in SkipTo
git-svn-id: svn://svn.code.sf.net/p/pyparsing/code/src@168 9bf210a0-9d2d-494c-87cf-cfb32e7dff7b
-rw-r--r--pyparsing.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/pyparsing.py b/pyparsing.py
index 5404758..1d67533 100644
--- a/pyparsing.py
+++ b/pyparsing.py
@@ -58,8 +58,8 @@ The pyparsing module handles some of the problems that are typically vexing when
- embedded comments
"""
-__version__ = "1.5.1"
-__versionTime__ = "2 October 2008 00:44"
+__version__ = "1.5.2"
+__versionTime__ = "6 November 2008 12:30"
__author__ = "Paul McGuire <ptmcg@users.sourceforge.net>"
import string
@@ -2823,8 +2823,13 @@ class SkipTo(ParseElementEnhance):
while loc <= instrlen:
try:
if self.failOn:
+ try:
+ self.failOn.tryParse(instring, loc)
+ except ParseBaseException:
+ pass
+ else:
failParse = True
- self.failOn.tryParse(instring, loc)
+ raise ParseException(instring, loc, "Found expression " + str(self.failOn))
failParse = False
loc = expr._skipIgnorables( instring, loc )
expr._parse( instring, loc, doActions=False, callPreParse=False )
@@ -3605,7 +3610,7 @@ alphas8bit = srange(r"[\0xc0-\0xd6\0xd8-\0xf6\0xf8-\0xff]")
punc8bit = srange(r"[\0xa1-\0xbf\0xd7\0xf7]")
anyOpenTag,anyCloseTag = makeHTMLTags(Word(alphas,alphanums+"_:"))
-commonHTMLEntity = Combine(_L("&") + oneOf("gt lt amp nbsp quot").setResultsName("entity") +";")
+commonHTMLEntity = Combine(_L("&") + oneOf("gt lt amp nbsp quot").setResultsName("entity") +";").streamline()
_htmlEntityMap = dict(zip("gt lt amp nbsp quot".split(),'><& "'))
replaceHTMLEntity = lambda t : t.entity in _htmlEntityMap and _htmlEntityMap[t.entity] or None