RemexHtml/Tokenizer/Tokenizer.php
protected function interpretCommentMatches( $m ) {
		$outerStart = $m[0][1];
		$outerLength = strlen( $m[0][0] );
		$innerStart = $outerStart + strlen( '<!--' );
		$innerLength = isset( $m[self::MD_COMMENT_INNER] ) ? strlen( $m[self::MD_COMMENT_INNER][0] ) : 0;
		$contents = $innerLength ? $m[self::MD_COMMENT_INNER][0] : '';

		if ( $m[0][0] === '<!-->' || $m[0][0] === '<!--->' ) {
			// These are special cases in the comment start state
			$this->error( 'not enough dashes in empty comment', $outerStart );
			$this->listener->comment( '', $outerStart, $outerLength );
			return;
		}

		if ( !$this->ignoreNulls ) {
			$contents = $this->handleNulls( $contents, $innerStart );
		}
		$close = $m[self::MD_COMMENT_END][0];
		$closePos = $m[self::MD_COMMENT_END][1];

		if ( !$this->ignoreErrors ) {
			if ( $close === '--!>' ) {
				$this->error( 'invalid comment end bang', $closePos );
			} elseif ( $close === '-' || $close === '--' || $close === '--!' ) {
				$this->error( 'EOF part way through comment close', $closePos );
			} elseif ( $close === '' ) {
				$this->error( 'EOF in comment', $closePos );
			}

			$dashSearchLength = $innerLength;
			while ( $dashSearchLength > 0 && $contents[$dashSearchLength - 1] === '-' ) {
				$this->error( 'invalid extra dash at comment end',
					$innerStart + $dashSearchLength - 1 );
				$dashSearchLength--;
			}

			$offset = 0;
			while ( $offset !== false && $offset < $dashSearchLength ) {
				$offset = strpos( $contents, '--', $offset );
				if ( $offset !== false ) {
					$this->error( 'bare "--" found in comment', $innerStart + $offset );
					$offset += 2;
				}
			}
		}

		$this->listener->comment( $contents, $outerStart, $outerLength );
	}
protected function interpretCommentMatches( $m ) {
		$outerStart = $m[0][1];
		$outerLength = strlen( $m[0][0] );
		$innerStart = $outerStart + strlen( '<!--' );
		$innerLength = isset( $m[self::MD_COMMENT_INNER] ) ? strlen( $m[self::MD_COMMENT_INNER][0] ) : 0;
		$contents = $innerLength ? $m[self::MD_COMMENT_INNER][0] : '';

		if ( $m[0][0] === '<!-->' || $m[0][0] === '<!--->' ) {
			// These are special cases in the comment start state
			$this->error( 'not enough dashes in empty comment', $outerStart );
			$this->listener->comment( '', $outerStart, $outerLength );
			return;
		}

		if ( !$this->ignoreNulls ) {
			$contents = $this->handleNulls( $contents, $innerStart );
		}
		$close = $m[self::MD_COMMENT_END][0];
		$closePos = $m[self::MD_COMMENT_END][1];

		if ( !$this->ignoreErrors ) {
			if ( $close === '--!>' ) {
				$this->error( 'invalid comment end bang', $closePos );
			} elseif ( $close === '-' || $close === '--' || $close === '--!' ) {
				$this->error( 'EOF part way through comment close', $closePos );
			} elseif ( $close === '' ) {
				$this->error( 'EOF in comment', $closePos );
			}

			$dashSearchLength = $innerLength;
			while ( $dashSearchLength > 0 && $contents[$dashSearchLength - 1] === '-' ) {
				$this->error( 'invalid extra dash at comment end',
					$innerStart + $dashSearchLength - 1 );
				$dashSearchLength--;
			}

			$offset = 0;
			while ( $offset !== false && $offset < $dashSearchLength ) {
				$offset = strpos( $contents, '--', $offset );
				if ( $offset !== false ) {
					$this->error( 'bare "--" found in comment', $innerStart + $offset );
					$offset += 2;
				}
			}
		}

		$this->listener->comment( $contents, $outerStart, $outerLength );
	}
protected function interpretCommentMatches ( $ m ) { $ outerStart = $ m [ 0 ] [ 1 ] ; $ outerLength = strlen ( $ m [ 0 ] [ 0 ] ) ; $ innerStart = $ outerStart + strlen ( '<!--' ) ; $ innerLength = isset ( $ m [ self :: MD_COMMENT_INNER ] ) ? strlen ( $ m [ self :: MD_COMMENT_INNER ] [ 0 ] ) : 0 ; $ contents = $ innerLength ? $ m [ self :: MD_COMMENT_INNER ] [ 0 ] : '' ; if ( $ m [ 0 ] [ 0 ] === '<!-->' || $ m [ 0 ] [ 0 ] === '<!--->' ) { // These are special cases in the comment start state $ this -> error ( 'not enough dashes in empty comment' , $ outerStart ) ; $ this -> listener -> comment ( '' , $ outerStart , $ outerLength ) ; return ; } if ( ! $ this -> ignoreNulls ) { $ contents = $ this -> handleNulls ( $ contents , $ innerStart ) ; } $ close = $ m [ self :: MD_COMMENT_END ] [ 0 ] ; $ closePos = $ m [ self :: MD_COMMENT_END ] [ 1 ] ; if ( ! $ this -> ignoreErrors ) { if ( $ close === '--!>' ) { $ this -> error ( 'invalid comment end bang' , $ closePos ) ; } elseif ( $ close === '-' || $ close === '--' || $ close === '--!' ) { $ this -> error ( 'EOF part way through comment close' , $ closePos ) ; } elseif ( $ close === '' ) { $ this -> error ( 'EOF in comment' , $ closePos ) ; } $ dashSearchLength = $ innerLength ; while ( $ dashSearchLength > 0 && $ contents [ $ dashSearchLength - 1 ] === '-' ) { $ this -> error ( 'invalid extra dash at comment end' , $ innerStart + $ dashSearchLength - 1 ) ; $ dashSearchLength -- ; } $ offset = 0 ; while ( $ offset !== false && $ offset < $ dashSearchLength ) { $ offset = strpos ( $ contents , '--' , $ offset ) ; if ( $ offset !== false ) { $ this -> error ( 'bare "--" found in comment' , $ innerStart + $ offset ) ; $ offset += 2 ; } } } $ this -> listener -> comment ( $ contents , $ outerStart , $ outerLength ) ; }
Interpret the data state match results for a detected comment, and emit
events as appropriate.

@param array $m The match array
Interpret the data state match results for a detected comment and emit events as appropriate .