summaryrefslogtreecommitdiffstats
path: root/Lib/markupbase.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2006-03-09 13:27:14 (GMT)
committerGeorg Brandl <georg@python.org>2006-03-09 13:27:14 (GMT)
commitd09def36d52af3e087433eb67c49da633436c602 (patch)
treef9498fe321b3156583d269362e26ef6523b18ec0 /Lib/markupbase.py
parent8f4b4db676c10239543dd4bbdf99dacdd6468bd4 (diff)
downloadcpython-d09def36d52af3e087433eb67c49da633436c602.zip
cpython-d09def36d52af3e087433eb67c49da633436c602.tar.gz
cpython-d09def36d52af3e087433eb67c49da633436c602.tar.bz2
Bug #1442874: handle "<!>", the empty SGML comment
Diffstat (limited to 'Lib/markupbase.py')
-rw-r--r--Lib/markupbase.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/markupbase.py b/Lib/markupbase.py
index 3d00a74..85b07a2 100644
--- a/Lib/markupbase.py
+++ b/Lib/markupbase.py
@@ -76,13 +76,16 @@ class ParserBase:
rawdata = self.rawdata
j = i + 2
assert rawdata[i:j] == "<!", "unexpected call to parse_declaration"
+ if rawdata[j:j+1] == ">":
+ # the empty comment <!>
+ return j + 1
if rawdata[j:j+1] in ("-", ""):
# Start of comment followed by buffer boundary,
# or just a buffer boundary.
return -1
# A simple, practical version could look like: ((name|stringlit) S*) + '>'
n = len(rawdata)
- if rawdata[j:j+1] == '--': #comment
+ if rawdata[j:j+2] == '--': #comment
# Locate --.*-- as the body of the comment
return self.parse_comment(i)
elif rawdata[j] == '[': #marked section