<?php

/**
 * @package   FastCache/regextokenizer
 * @copyright Copyright (c) 2025-2026 FastCache
 * @copyright Copyright (c) 2025-2026 FastCache
 * @license   GNU/GPLv3, or later. See LICENSE file
 *
 * If LICENSE file missing, see <http://www.gnu.org/licenses/>.
 */

namespace FastCache\RegexTokenizer;

trait Css
{
        use Base;

        //language=RegExp
        public static function CSS_IDENT()
        {
                return '(?:\\\\.|[a-z0-9_-]++\s++)';
        }

        //language=RegExp
        public static function CSS_URL_CP( $bCV = false )
        {
                $sCssUrl = '(?:url\(|(?<=url)\()(?:\s*+[\'"])?<<' . self::CSS_URL_VALUE() . '>>(?:[\'"]\s*+)?\)';

                return self::prepare( $sCssUrl, $bCV );
        }

        //language=RegExp
        public static function CSS_URL_VALUE()
        {
                return '(?:' . self::STRING_VALUE() . '|' . self::CSS_URL_VALUE_UNQUOTED() . ')';
        }

        //language=RegExp
        public static function CSS_URL_VALUE_UNQUOTED()
        {
                return '(?<=url\()(?>\s*+(?:\\\\.)?[^\\\\()\s\'"]*+)++';
        }

}

