File tree Expand file tree Collapse file tree 3 files changed +15
-2
lines changed Expand file tree Collapse file tree 3 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -112,12 +112,15 @@ public function parseCharacter($bIsForIdentifier) {
112112		return  null ;
113113	}
114114
115- 	public  function  consumeWhiteSpace () {
115+ 	public  function  consumeWhiteSpace ($ consumeComments  =  true ) {
116116		$ comments  = array ();
117117		do  {
118118			while  (preg_match ('/ \\s/isSu ' , $ this  ->peek ()) === 1 ) {
119119				$ this  ->consume (1 );
120120			}
121+ 			if  (!$ consumeComments ) {
122+ 				return ;
123+ 			}
121124			if ($ this  ->oParserSettings ->bLenientParsing ) {
122125				try  {
123126					$ oComment  = $ this  ->consumeComment ();
Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ public static function parse(ParserState $oParserState) {
5656		while  ($ oParserState ->comes ('; ' )) {
5757			$ oParserState ->consume ('; ' );
5858		}
59- 		$ oParserState ->consumeWhiteSpace ();
59+ 		$ oParserState ->consumeWhiteSpace (false );
6060
6161		return  $ oRule ;
6262	}
Original file line number Diff line number Diff line change @@ -733,6 +733,16 @@ function testFlatCommentExtracting() {
733733		$ this  ->assertEquals ("Find Me! " , $ comments [0 ]->getComment ());
734734	}
735735
736+ 	function  testInnerCommentExtracting () {
737+ 		$ parser  = new  Parser ('div {left:10px;/*Find Me!*/text-align:left;} ' );
738+ 		$ doc  = $ parser ->parse ();
739+ 		$ contents  = $ doc ->getContents ();
740+ 		$ divRules  = $ contents [0 ]->getRules ();
741+ 		$ comments  = $ divRules [1 ]->getComments ();
742+ 		$ this  ->assertCount (1 , $ comments );
743+ 		$ this  ->assertEquals ("Find Me! " , $ comments [0 ]->getComment ());
744+ 	}
745+ 
736746	function  testTopLevelCommentExtracting () {
737747		$ parser  = new  Parser ('/*Find Me!*/div {left:10px; text-align:left;} ' );
738748		$ doc  = $ parser ->parse ();
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments