Skip to content

Commit e014816

Browse files
committed
handle the new-style entities
--HG-- extra : convert_revision : svn%3Aacbfec75-9323-0410-a652-858a13e371e0/trunk%40763
1 parent 61d9c8d commit e014816

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

src/tokenizer.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,9 @@ def consumeNumberEntity(self, isHex):
176176
def consumeEntity(self):
177177
char = None
178178
charStack = [self.stream.char()]
179-
if charStack[0] == u"#":
179+
if charStack[0] in spaceCharacters or charStack[0] in (EOF, "<", "&"):
180+
self.stream.queue.extend(charStack)
181+
elif charStack[0] == u"#":
180182
# We might have a number entity here.
181183
charStack.extend([self.stream.char(), self.stream.char()])
182184
if EOF in charStack:
@@ -202,9 +204,6 @@ def consumeEntity(self):
202204
self.tokenQueue.append({"type": "ParseError", "data":
203205
_("Numeric entity expected but none found.")})
204206
# Break out if we reach the end of the file
205-
elif charStack[0] == EOF:
206-
self.tokenQueue.append({"type": "ParseError", "data":
207-
_("Entity expected. Got end of file instead.")})
208207
else:
209208
# At this point in the process might have named entity. Entities
210209
# are stored in the global variable "entities".

0 commit comments

Comments
 (0)