src/FS/File/CSS/Parser.php
static public function parseString( $string ){
		if( substr_count( $string, "{" ) !== substr_count( $string, "}" ) )							//  
			throw Exception( 'Invalid paranthesis' );
		$string	= preg_replace( '/\/\*.+\*\//sU', '', $string );
		$string	= preg_replace( '/(\t|\r|\n)/s', '', $string );
		$state	= (int) ( $buffer = $key = '' );
		$sheet	= new ADT_CSS_Sheet();
		for( $i=0; $i<strlen( $string ); $i++ ){
			$char = $string[$i];
			if( !$state && $char == '{' ){
				$state	= (boolean) ( $key = trim( $buffer ) );
				$buffer	= '';
			}
			else if( $state && $char == '}' ){
				$properties	= self::parseProperties( $buffer );
				foreach( explode( ',', $key ) as $selector )
					$sheet->addRule( new ADT_CSS_Rule( $selector, $properties ) );
				$state	= (boolean) ($buffer = '');
			}
			else
				$buffer	.= $char;
		}
		return $sheet;
	}
static public function parseString( $string ){
		if( substr_count( $string, "{" ) !== substr_count( $string, "}" ) )							//  
			throw Exception( 'Invalid paranthesis' );
		$string	= preg_replace( '/\/\*.+\*\//sU', '', $string );
		$string	= preg_replace( '/(\t|\r|\n)/s', '', $string );
		$state	= (int) ( $buffer = $key = '' );
		$sheet	= new ADT_CSS_Sheet();
		for( $i=0; $i<strlen( $string ); $i++ ){
			$char = $string[$i];
			if( !$state && $char == '{' ){
				$state	= (boolean) ( $key = trim( $buffer ) );
				$buffer	= '';
			}
			else if( $state && $char == '}' ){
				$properties	= self::parseProperties( $buffer );
				foreach( explode( ',', $key ) as $selector )
					$sheet->addRule( new ADT_CSS_Rule( $selector, $properties ) );
				$state	= (boolean) ($buffer = '');
			}
			else
				$buffer	.= $char;
		}
		return $sheet;
	}
static public function parseString ( $ string ) { if ( substr_count ( $ string , "{" ) !== substr_count ( $ string , "}" ) ) //   throw Exception ( 'Invalid paranthesis' ) ; $ string = preg_replace ( '/\/\*.+\*\//sU' , '' , $ string ) ; $ string = preg_replace ( '/(\t|\r|\n)/s' , '' , $ string ) ; $ state = ( int ) ( $ buffer = $ key = '' ) ; $ sheet = new ADT_CSS_Sheet ( ) ; for ( $ i = 0 ; $ i < strlen ( $ string ) ; $ i ++ ) { $ char = $ string [ $ i ] ; if ( ! $ state && $ char == '{' ) { $ state = ( boolean ) ( $ key = trim ( $ buffer ) ) ; $ buffer = '' ; } else if ( $ state && $ char == '}' ) { $ properties = self :: parseProperties ( $ buffer ) ; foreach ( explode ( ',' , $ key ) as $ selector ) $ sheet -> addRule ( new ADT_CSS_Rule ( $ selector , $ properties ) ) ; $ state = ( boolean ) ( $ buffer = '' ) ; } else $ buffer .= $ char ; } return $ sheet ; }
Parses a CSS string and returns sheet structure statically.
@access		public
@param		string			$string		CSS string
@return		ADT_CSS_Sheet
Parses a CSS string and returns sheet structure statically .