Skip to content

Commit 9308489

Browse files
committed
'simplify' the tokenizer (no tests regressed, fwiw)
--HG-- extra : convert_revision : svn%3Aacbfec75-9323-0410-a652-858a13e371e0/trunk%40220
1 parent bfb048d commit 9308489

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

tokenizer.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,6 @@ def emitCurrentToken(self):
317317
# If an end tag has attributes it's a parse error.
318318
if token.attributes:
319319
self.parser.parseError()
320-
self.contentModelFlag = contentModelFlags["PCDATA"]
321320
self.parser.processEndTag(token.name)
322321
elif isinstance(token, CommentToken):
323322
self.parser.processComment(token.data)
@@ -438,9 +437,11 @@ def closeTagOpenState(self):
438437
# XXX need to check if this can be done differently. Perhaps
439438
# integrate switching the content model flag here instead of when
440439
# we emit the token as well...
441-
if not self.currentToken.name == "".join(charStack[:-1]).lower() \
442-
or charStack[-1] not in (spaceCharacters |
440+
if self.currentToken.name == "".join(charStack[:-1]).lower() \
441+
and charStack[-1] in (spaceCharacters |
443442
frozenset((u">", u"/", u"<", EOF))):
443+
self.contentModelFlag = contentModelFlags["PCDATA"]
444+
else:
444445
self.parser.parseError()
445446
self.parser.processCharacter(u"<")
446447
self.parser.processCharacter(u"/")
@@ -450,7 +451,7 @@ def closeTagOpenState(self):
450451
# method to be walked through.
451452
return True
452453

453-
if self.contentModelFlag != contentModelFlags["PLAINTEXT"]:
454+
if self.contentModelFlag == contentModelFlags["PCDATA"]:
454455
data = self.consumeChar()
455456
if data in asciiLetters:
456457
self.currentToken = EndTagToken(data)

0 commit comments

Comments
 (0)