@@ -133,13 +133,19 @@ protected function consumeData()
133133
134134 $ tok = $ this ->scanner ->next ();
135135
136- $ this ->markupDeclaration ($ tok )
137- || $ this ->endTag ()
138- || $ this ->processingInstruction ()
139- || $ this ->tagName ()
140- // This always returns false.
141- || $ this ->parseError ('Illegal tag opening ' )
142- || $ this ->characterData ();
136+ if ('! ' === $ tok ) {
137+ $ this ->markupDeclaration ();
138+ } elseif ('/ ' === $ tok ) {
139+ $ this ->endTag ();
140+ } elseif ('? ' === $ tok ) {
141+ $ this ->processingInstruction ();
142+ } elseif (ctype_alpha ($ tok )) {
143+ $ this ->tagName ();
144+ } else {
145+ $ this ->parseError ('Illegal tag opening ' );
146+ // TODO is this necessary ?
147+ $ this ->characterData ();
148+ }
143149
144150 $ tok = $ this ->scanner ->current ();
145151 }
@@ -301,12 +307,8 @@ protected function eof()
301307 /**
302308 * Look for markup.
303309 */
304- protected function markupDeclaration ($ tok )
310+ protected function markupDeclaration ()
305311 {
306- if ('! ' != $ tok ) {
307- return false ;
308- }
309-
310312 $ tok = $ this ->scanner ->next ();
311313
312314 // Comment:
@@ -373,11 +375,6 @@ protected function endTag()
373375 */
374376 protected function tagName ()
375377 {
376- $ tok = $ this ->scanner ->current ();
377- if (!ctype_alpha ($ tok )) {
378- return false ;
379- }
380-
381378 // We know this is at least one char.
382379 $ name = $ this ->scanner ->charsWhile (':_-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ' );
383380 $ name = self ::CONFORMANT_XML === $ this ->mode ? $ name : strtolower ($ name );
@@ -790,7 +787,7 @@ protected function doctype()
790787 if (false === $ id ) {
791788 $ this ->events ->doctype ($ doctypeName , $ type , $ pub , false );
792789
793- return false ;
790+ return true ;
794791 }
795792
796793 // Premature EOF.
0 commit comments