@@ -166,7 +166,7 @@ protected function consumeData()
166166 }
167167
168168 $ this ->text .= $ tok ;
169- $ this ->scanner ->next ();
169+ $ this ->scanner ->consume ();
170170 }
171171 }
172172 }
@@ -221,7 +221,7 @@ protected function text($tok)
221221 }
222222
223223 $ this ->buffer ($ tok );
224- $ this ->scanner ->next ();
224+ $ this ->scanner ->consume ();
225225
226226 return true ;
227227 }
@@ -317,8 +317,8 @@ protected function markupDeclaration($tok)
317317
318318 // Comment:
319319 if ('- ' == $ tok && '- ' == $ this ->scanner ->peek ()) {
320- $ this ->scanner ->next (); // Consume the other '-'
321- $ this -> scanner -> next (); // Next char.
320+ $ this ->scanner ->consume ( 2 );
321+
322322 return $ this ->comment ();
323323 } elseif ('D ' == $ tok || 'd ' == $ tok ) { // Doctype
324324 return $ this ->doctype ();
@@ -369,7 +369,7 @@ protected function endTag()
369369 }
370370
371371 $ this ->events ->endTag ($ name );
372- $ this ->scanner ->next ();
372+ $ this ->scanner ->consume ();
373373
374374 return true ;
375375 }
@@ -407,7 +407,7 @@ protected function tagName()
407407 $ this ->setTextMode ($ mode , $ name );
408408 }
409409
410- $ this ->scanner ->next ();
410+ $ this ->scanner ->consume ();
411411
412412 return true ;
413413 }
@@ -419,7 +419,7 @@ protected function isTagEnd(&$selfClose)
419419 {
420420 $ tok = $ this ->scanner ->current ();
421421 if ('/ ' == $ tok ) {
422- $ this ->scanner ->next ();
422+ $ this ->scanner ->consume ();
423423 $ this ->scanner ->whitespace ();
424424 $ tok = $ this ->scanner ->current ();
425425
@@ -484,7 +484,7 @@ protected function attribute(&$attributes)
484484 // Really, only '=' can be the char here. Everything else gets absorbed
485485 // under one rule or another.
486486 $ name = $ tok ;
487- $ this ->scanner ->next ();
487+ $ this ->scanner ->consume ();
488488 }
489489
490490 $ isValidAttribute = true ;
@@ -526,7 +526,7 @@ protected function attributeValue()
526526 if ('= ' != $ this ->scanner ->current ()) {
527527 return null ;
528528 }
529- $ this ->scanner ->next ();
529+ $ this ->scanner ->consume ();
530530 // 8.1.2.3
531531 $ this ->scanner ->whitespace ();
532532
@@ -540,7 +540,7 @@ protected function attributeValue()
540540 return null ;
541541 case '" ' :
542542 case "' " :
543- $ this ->scanner ->next ();
543+ $ this ->scanner ->consume ();
544544
545545 return $ this ->quotedAttributeValue ($ tok );
546546 case '> ' :
@@ -587,7 +587,7 @@ protected function quotedAttributeValue($quote)
587587 }
588588 break ;
589589 }
590- $ this ->scanner ->next ();
590+ $ this ->scanner ->consume ();
591591
592592 return $ val ;
593593 }
@@ -641,7 +641,7 @@ protected function bogusComment($leading = '')
641641
642642 $ this ->flushBuffer ();
643643 $ this ->events ->comment ($ comment );
644- $ this ->scanner ->next ();
644+ $ this ->scanner ->consume ();
645645
646646 return true ;
647647 }
@@ -662,7 +662,7 @@ protected function comment()
662662 // Parse error. Emit the comment token.
663663 $ this ->parseError ("Expected comment data, got '>' " );
664664 $ this ->events ->comment ('' );
665- $ this ->scanner ->next ();
665+ $ this ->scanner ->consume ();
666666
667667 return true ;
668668 }
@@ -677,7 +677,7 @@ protected function comment()
677677 }
678678
679679 $ this ->events ->comment ($ comment );
680- $ this ->scanner ->next ();
680+ $ this ->scanner ->consume ();
681681
682682 return true ;
683683 }
@@ -706,7 +706,7 @@ protected function isCommentEnd()
706706
707707 // Advance one, and test for '->'
708708 if ('- ' == $ this ->scanner ->next () && '> ' == $ this ->scanner ->peek ()) {
709- $ this ->scanner ->next (); // Consume the last '>'
709+ $ this ->scanner ->consume (); // Consume the last '>'
710710 return true ;
711711 }
712712 // Unread '-';
@@ -774,12 +774,12 @@ protected function doctype()
774774 if (0 == strlen ($ doctypeName )) {
775775 $ this ->parseError ('Expected a DOCTYPE name. Got nothing. ' );
776776 $ this ->events ->doctype ($ doctypeName , 0 , null , true );
777- $ this ->scanner ->next ();
777+ $ this ->scanner ->consume ();
778778
779779 return true ;
780780 }
781781 $ this ->events ->doctype ($ doctypeName );
782- $ this ->scanner ->next ();
782+ $ this ->scanner ->consume ();
783783
784784 return true ;
785785 }
@@ -811,7 +811,7 @@ protected function doctype()
811811 $ this ->scanner ->whitespace ();
812812 if ('> ' == $ this ->scanner ->current ()) {
813813 $ this ->events ->doctype ($ doctypeName , $ type , $ id , false );
814- $ this ->scanner ->next ();
814+ $ this ->scanner ->consume ();
815815
816816 return true ;
817817 }
@@ -821,7 +821,7 @@ protected function doctype()
821821 $ this ->scanner ->charsUntil ('> ' );
822822 $ this ->parseError ('Malformed DOCTYPE. ' );
823823 $ this ->events ->doctype ($ doctypeName , $ type , $ id , true );
824- $ this ->scanner ->next ();
824+ $ this ->scanner ->consume ();
825825
826826 return true ;
827827 }
@@ -832,7 +832,7 @@ protected function doctype()
832832
833833 $ this ->parseError ('Expected PUBLIC or SYSTEM. Got %s. ' , $ pub );
834834 $ this ->events ->doctype ($ doctypeName , 0 , null , true );
835- $ this ->scanner ->next ();
835+ $ this ->scanner ->consume ();
836836
837837 return true ;
838838 }
@@ -849,10 +849,10 @@ protected function quotedString($stopchars)
849849 {
850850 $ tok = $ this ->scanner ->current ();
851851 if ('" ' == $ tok || "' " == $ tok ) {
852- $ this ->scanner ->next ();
852+ $ this ->scanner ->consume ();
853853 $ ret = $ this ->scanner ->charsUntil ($ tok . $ stopchars );
854854 if ($ this ->scanner ->current () == $ tok ) {
855- $ this ->scanner ->next ();
855+ $ this ->scanner ->consume ();
856856 } else {
857857 // Parse error because no close quote.
858858 $ this ->parseError ('Expected %s, got %s ' , $ tok , $ this ->scanner ->current ());
@@ -875,7 +875,7 @@ protected function cdataSection()
875875 return false ;
876876 }
877877 $ cdata = '' ;
878- $ this ->scanner ->next ();
878+ $ this ->scanner ->consume ();
879879
880880 $ chars = $ this ->scanner ->charsWhile ('CDAT ' );
881881 if ('CDATA ' != $ chars || '[ ' != $ this ->scanner ->current ()) {
@@ -950,8 +950,7 @@ protected function processingInstruction()
950950 }
951951 }
952952
953- $ this ->scanner ->next (); // >
954- $ this ->scanner ->next (); // Next token.
953+ $ this ->scanner ->consume (2 ); // Consume the closing tag
955954 $ this ->events ->processingInstruction ($ procName , $ data );
956955
957956 return true ;
@@ -983,7 +982,7 @@ protected function readUntilSequence($sequence)
983982 return $ buffer ;
984983 }
985984 $ buffer .= $ this ->scanner ->current ();
986- $ this ->scanner ->next ();
985+ $ this ->scanner ->consume ();
987986 }
988987
989988 // If we get here, we hit the EOF.
@@ -1160,7 +1159,7 @@ protected function decodeCharacterReference($inAttribute = false)
11601159
11611160 // We have an entity. We're done here.
11621161 if ('; ' === $ tok ) {
1163- $ this ->scanner ->next ();
1162+ $ this ->scanner ->consume ();
11641163
11651164 return $ entity ;
11661165 }
0 commit comments