File tree Expand file tree Collapse file tree 2 files changed +18
-6
lines changed
Expand file tree Collapse file tree 2 files changed +18
-6
lines changed Original file line number Diff line number Diff line change @@ -712,18 +712,24 @@ protected function isCommentEnd()
712712 return true ;
713713 }
714714
715- // If it doesn't start with - , not the end.
716- if ('- ' != $ tok ) {
715+ // If next two tokens are not '--' , not the end.
716+ if ('- ' != $ tok || ' - ' != $ this -> scanner -> peek () ) {
717717 return false ;
718718 }
719719
720- // Advance one, and test for '->'
721- if ('- ' == $ this ->scanner ->next () && '> ' == $ this ->scanner ->peek ()) {
720+ $ this ->scanner ->consume (2 ); // Consume '-' and one of '!' or '>'
721+
722+ // Test for '>'
723+ if ('> ' == $ this ->scanner ->current ()) {
724+ return true ;
725+ }
726+ // Test for '!>'
727+ if ('! ' == $ this ->scanner ->current () && '> ' == $ this ->scanner ->peek ()) {
722728 $ this ->scanner ->consume (); // Consume the last '>'
723729 return true ;
724730 }
725- // Unread '-';
726- $ this ->scanner ->unconsume (1 );
731+ // Unread '-' and one of '!' or '>' ;
732+ $ this ->scanner ->unconsume (2 );
727733
728734 return false ;
729735 }
Original file line number Diff line number Diff line change @@ -197,11 +197,17 @@ public function testComment()
197197 {
198198 $ good = array (
199199 '<!--easy--> ' => 'easy ' ,
200+ '<!--easy--!> ' => 'easy ' ,
200201 '<!-- 1 > 0 --> ' => ' 1 > 0 ' ,
202+ '<!-- 1 > 0 --!> ' => ' 1 > 0 ' ,
201203 '<!-- --$i --> ' => ' --$i ' ,
204+ '<!-- --$i --!> ' => ' --$i ' ,
202205 '<!----$i--> ' => '--$i ' ,
206+ '<!----$i--!> ' => '--$i ' ,
203207 "<!-- \nHello World. \na--> " => "\nHello World. \na " ,
208+ "<!-- \nHello World. \na--!> " => "\nHello World. \na " ,
204209 '<!-- <!-- --> ' => ' <!-- ' ,
210+ '<!-- <!-- --!> ' => ' <!-- ' ,
205211 );
206212 foreach ($ good as $ test => $ expected ) {
207213 $ events = $ this ->parse ($ test );
You can’t perform that action at this time.
0 commit comments