@@ -114,11 +114,19 @@ def processSolidusInTag(self):
114114 an EmptyTag
115115 """
116116
117+ rv = False
118+
117119# We need to consume another character to make sure it's a ">"
118120data = self .stream .char ()
119121
120122if self .currentToken ["type" ]== "StartTag" and data == u">" :
121123self .currentToken ["type" ]= "EmptyTag"
124+ elif data == EOF :
125+ self .tokenQueue .append ({"type" :"ParseError" ,"data" :
126+ "EOF following solidus" })
127+ self .state = self .states ["data" ]
128+ self .emitCurrentToken ()
129+ rv = True
122130else :
123131self .tokenQueue .append ({"type" :"ParseError" ,"data" :
124132"incorrectly-placed-solidus" })
@@ -127,6 +135,8 @@ def processSolidusInTag(self):
127135# doesn't get lost...
128136self .stream .unget (data )
129137
138+ return rv
139+
130140def consumeNumberEntity (self ,isHex ):
131141"""This function returns either U+FFFD or the character based on the
132142 decimal or hexadecimal representation. It also discards ";" if present.
@@ -524,8 +534,8 @@ def attributeNameState(self):
524534elif data in spaceCharacters :
525535self .state = self .states ["afterAttributeName" ]
526536elif data == u"/" :
527- self .processSolidusInTag ()
528- self .state = self .states ["beforeAttributeName" ]
537+ if not self .processSolidusInTag ():
538+ self .state = self .states ["beforeAttributeName" ]
529539elif data == u"'" or data == u'"' :
530540self .tokenQueue .append ({"type" :"ParseError" ,"data" :
531541"invalid-character-in-attribute-name" })
@@ -569,8 +579,8 @@ def afterAttributeNameState(self):
569579self .currentToken ["data" ].append ([data ,"" ])
570580self .state = self .states ["attributeName" ]
571581elif data == u"/" :
572- self .processSolidusInTag ()
573- self .state = self .states ["beforeAttributeName" ]
582+ if not self .processSolidusInTag ():
583+ self .state = self .states ["beforeAttributeName" ]
574584elif data == EOF :
575585self .tokenQueue .append ({"type" :"ParseError" ,"data" :
576586"expected-end-of-tag-but-got-eof" })
@@ -666,8 +676,14 @@ def afterAttributeValueState(self):
666676self .emitCurrentToken ()
667677self .state = self .states ["data" ]
668678elif data == u"/" :
669- self .processSolidusInTag ()
670- self .state = self .states ["beforeAttributeName" ]
679+ if not self .processSolidusInTag ():
680+ self .state = self .states ["beforeAttributeName" ]
681+ elif data == EOF :
682+ self .tokenQueue .append ({"type" :"ParseError" ,"data" :
683+ "unexpected-EOF-after-attribute-value" })
684+ self .emitCurrentToken ()
685+ self .stream .unget (data )
686+ self .state = self .states ["data" ]
671687else :
672688self .tokenQueue .append ({"type" :"ParseError" ,"data" :
673689"unexpected-character-after-attribute-value" })