css-sanitizer
Classes to parse and sanitize CSS
|
Represent a match from a Matcher. More...
Public Member Functions | |
__construct (ComponentValueList $list, $start, $length, $name=null, array $capturedMatches=[]) | |
getValues () | |
The matched values. | |
getStart () | |
The starting position of this match within the original list of values. | |
getLength () | |
The length of this match. | |
getNext () | |
The position after this match, as in index into the original list of values. | |
getName () | |
The name of this match. | |
getCapturedMatches () | |
The captured submatches of this match. | |
getUniqueID () | |
Return a key for this matcher's state. | |
fixWhitespace (Token $old, Token $new) | |
Replace whitespace in the matched values For use by Matcher only. | |
__toString () | |
Protected Attributes | |
$start | |
$length | |
$values | |
$name = null | |
$capturedMatches = [] | |
Represent a match from a Matcher.
Wikimedia\CSS\Grammar\GrammarMatch::__construct | ( | ComponentValueList | $list, |
$start, | |||
$length, | |||
$name = null, | |||
array | $capturedMatches = [] ) |
ComponentValueList | $list | List containing the match |
int | $start | Starting index of the match. |
int | $length | Number of tokens in the match. |
string | null | $name | Give a name to this match. |
GrammarMatch[] | $capturedMatches | Captured submatches of this match. |
Replace whitespace in the matched values For use by Matcher only.
Token | $old | |
Token | $new |
Wikimedia\CSS\Grammar\GrammarMatch::getCapturedMatches | ( | ) |
The captured submatches of this match.
This returns the matches from capturing submatchers (see Matcher::capture()) that matched during the matching of the top-level matcher that returned this match. If capturing submatchers were nested, the GrammarMatch objects returned here will themselves have captured sub- matches to return.
To borrow PCRE regular expression syntax, if the "pattern" described by the Matchers resembled www(?<A>xxx(?<B>yyy)xxx)(?<C>zzz)*
then the top-level GrammarMatch's getCapturedMatches() would return a GrammarMatch named "A" (containing the "xxxyyyxxx" bit) and zero or more matches named "C" (for each "zzz"), and that "A" GrammarMatch's getCapturedMatches() would return a GrammarMatch named "B" (containing just the "yyy").
Note that the start and end positions reported by captured matches may be relative to a containing SimpleBlock or CSSFunction's value rather than to the ComponentValueList passed to the top-level Matcher.
Wikimedia\CSS\Grammar\GrammarMatch::getLength | ( | ) |
The length of this match.
Wikimedia\CSS\Grammar\GrammarMatch::getName | ( | ) |
The name of this match.
Wikimedia\CSS\Grammar\GrammarMatch::getNext | ( | ) |
The position after this match, as in index into the original list of values.
Wikimedia\CSS\Grammar\GrammarMatch::getStart | ( | ) |
The starting position of this match within the original list of values.
Wikimedia\CSS\Grammar\GrammarMatch::getUniqueID | ( | ) |
Return a key for this matcher's state.
Wikimedia\CSS\Grammar\GrammarMatch::getValues | ( | ) |
The matched values.