css-sanitizer
Classes to parse and sanitize CSS
Loading...
Searching...
No Matches
Wikimedia\CSS\Grammar\Quantifier Class Reference

Matcher that matches a sub-Matcher a certain number of times ("?", "*", "+", "#", "{A,B}" multipliers) More...

+ Inheritance diagram for Wikimedia\CSS\Grammar\Quantifier:
+ Collaboration diagram for Wikimedia\CSS\Grammar\Quantifier:

Public Member Functions

 __construct (Matcher $matcher, $min, $max, $commas)
 
- Public Member Functions inherited from Wikimedia\CSS\Grammar\Matcher
 capture ( $captureName)
 Return a copy of this matcher that will capture its matches.
 
 matchAgainst (ComponentValueList $values, array $options=[])
 Match against a list of ComponentValues.
 
 getDefaultOptions ()
 Fetch the default options for this Matcher.
 
 setDefaultOptions (array $options)
 Set the default options for this Matcher.
 

Static Public Member Functions

static optional (Matcher $matcher)
 Implements "?": 0 or 1 matches.
 
static star (Matcher $matcher)
 Implements "*": 0 or more matches.
 
static plus (Matcher $matcher)
 Implements "+": 1 or more matches.
 
static count (Matcher $matcher, $min, $max)
 Implements "{A,B}": Between A and B matches.
 
static hash (Matcher $matcher, $min=1, $max=INF)
 Implements "#" and "#{A,B}": Between A and B matches, comma-separated.
 
- Static Public Member Functions inherited from Wikimedia\CSS\Grammar\Matcher
static create (... $args)
 Create an instance.
 

Protected Attributes

 $matcher
 
 $min
 
 $max
 
 $commas
 
- Protected Attributes inherited from Wikimedia\CSS\Grammar\Matcher
 $captureName = null
 
 $defaultOptions
 

Additional Inherited Members

- Protected Member Functions inherited from Wikimedia\CSS\Grammar\Matcher
 next (ComponentValueList $values, $start, array $options)
 Find the next ComponentValue in the input, possibly skipping whitespace.
 
 makeMatch (ComponentValueList $list, $start, $end, GrammarMatch $submatch=null, array $stack=[])
 Create a GrammarMatch.
 
 generateMatches (ComponentValueList $values, $start, array $options)
 Match against a list of ComponentValues.
 

Detailed Description

Matcher that matches a sub-Matcher a certain number of times ("?", "*", "+", "#", "{A,B}" multipliers)

See also
https://www.w3.org/TR/2019/CR-css-values-3-20190606/#component-multipliers

Constructor & Destructor Documentation

◆ __construct()

Wikimedia\CSS\Grammar\Quantifier::__construct ( Matcher $matcher,
$min,
$max,
$commas )
Parameters
Matcher$matcher
int | float$minMinimum number of matches
int | float$maxMaximum number of matches
bool$commasWhether matches are comma-separated

Member Function Documentation

◆ count()

static Wikimedia\CSS\Grammar\Quantifier::count ( Matcher $matcher,
$min,
$max )
static

Implements "{A,B}": Between A and B matches.

See also
https://www.w3.org/TR/2019/CR-css-values-3-20190606/#mult-num-range
Parameters
Matcher$matcher
int | float$minMinimum number of matches
int | float$maxMaximum number of matches
Returns
static

◆ hash()

static Wikimedia\CSS\Grammar\Quantifier::hash ( Matcher $matcher,
$min = 1,
$max = INF )
static

Implements "#" and "#{A,B}": Between A and B matches, comma-separated.

See also
https://www.w3.org/TR/2019/CR-css-values-3-20190606/#mult-comma
Parameters
Matcher$matcher
int | float$minMinimum number of matches
int | float$maxMaximum number of matches
Returns
static

◆ optional()

static Wikimedia\CSS\Grammar\Quantifier::optional ( Matcher $matcher)
static

Implements "?": 0 or 1 matches.

See also
https://www.w3.org/TR/2019/CR-css-values-3-20190606/#mult-opt
Parameters
Matcher$matcher
Returns
static

◆ plus()

static Wikimedia\CSS\Grammar\Quantifier::plus ( Matcher $matcher)
static

Implements "+": 1 or more matches.

See also
https://www.w3.org/TR/2019/CR-css-values-3-20190606/#mult-one-plus
Parameters
Matcher$matcher
Returns
static

◆ star()

static Wikimedia\CSS\Grammar\Quantifier::star ( Matcher $matcher)
static

Implements "*": 0 or more matches.

See also
https://www.w3.org/TR/2019/CR-css-values-3-20190606/#mult-zero-plus
Parameters
Matcher$matcher
Returns
static

The documentation for this class was generated from the following file: