1<?php 2/** 3* An abstract class providing token regex pattern for repeated usage. 4* 5* @license http://www.opensource.org/licenses/mit-license.php The MIT License 6* @copyright Copyright 2010-2014 PhpCss Team 7*/ 8 9namespace PhpCss\Scanner { 10 /** 11 * An abstract class providing token regex pattern for repeated usage. 12 */ 13 abstract class Patterns { 14 15 public const WHITESPACE = '([\r\n\t ]+)S'; 16 public const NUMBER = '(-?[\d]+)S'; 17 public const IDENTIFIER = '( 18 ( 19 ( # namespace ncname 20 [A-Z_a-z\\x{C0}-\\x{D6}\\x{D8}-\\x{F6}\\x{F8}-\\x{2FF}\\x{370}-\\x{37D}\\x{37F}-\\x{1FFF}\\x{200C}-\\x{200D}\\x{2070}-\\x{218F}\\x{2C00}-\\x{2FEF}\\x{3001}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFFD}\\x{10000}-\\x{EFFFF}] 21 [-A-Z_a-z0-9\\x{C0}-\\x{D6}\\x{D8}-\\x{F6}\\x{F8}-\\x{2FF}\\x{370}-\\x{37D}\\x{37F}-\\x{1FFF}\\x{200C}-\\x{200D}\\x{2070}-\\x{218F}\\x{2C00}-\\x{2FEF}\\x{3001}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFFD}\\x{10000}-\\x{EFFFF}\\x{B7}\\x{300}-\\x{36F}\\x{203F}-\\x{2040}]* 22 | 23 \\* # the * is a joker for any namespace 24 ) 25 \\| # a pipe separates namespace from element 26 )? 27 ( # element ncname 28 [A-Z_a-z\\x{C0}-\\x{D6}\\x{D8}-\\x{F6}\\x{F8}-\\x{2FF}\\x{370}-\\x{37D}\\x{37F}-\\x{1FFF}\\x{200C}-\\x{200D}\\x{2070}-\\x{218F}\\x{2C00}-\\x{2FEF}\\x{3001}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFFD}\\x{10000}-\\x{EFFFF}] 29 [-A-Z_a-z0-9\\x{C0}-\\x{D6}\\x{D8}-\\x{F6}\\x{F8}-\\x{2FF}\\x{370}-\\x{37D}\\x{37F}-\\x{1FFF}\\x{200C}-\\x{200D}\\x{2070}-\\x{218F}\\x{2C00}-\\x{2FEF}\\x{3001}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFFD}\\x{10000}-\\x{EFFFF}\\x{B7}\\x{300}-\\x{36F}\\x{203F}-\\x{2040}]* 30 | 31 \\* # the * is a joker for any element 32 ) 33 )uxS'; 34 35 public const COMBINATOR = '(\s*[>+~]\s*)S'; 36 37 public const CLASS_SELECTOR = '(\.[^\r\n\t >+~.,#:()[\\]\\\'"]+)S'; 38 public const ID_SELECTOR = '(#[^\r\n\t >+~.,#:()[\\]\\\'"]+)S'; 39 public const PSEUDO_CLASS = '(:[^\r\n\t >+~.,#:()[\\]\\\'"]+)S'; 40 public const PSEUDO_ELEMENT = '(::[^\r\n\t .,#:()[\\]\\\'"]+)S'; 41 42 public const ATTRIBUTE_OPERATOR = '([~^$*|]?=)S'; 43 public const PSEUDO_CLASS_POSITION = '(\s*(([-+]?(\\d+)?n\\s*[-+]\\s*\\d+)|\\d+n)\s*)'; 44 } 45} 46