Expand description
Port of src/validation/match.ts (match is a rust keyword: the module is match_).
Matches value tokens of the arena against the parsed value definition syntaxes.
- a
Contextis a shared mutable cursor (Rc<RefCell<..>>, like the typescript context objects that are passed around and advanced in place).slice()shares the token buffer (offset), it does not copy the tokens - syntax identity (typescript object identity) is the
Rcaddress; the stacks keep the syntaxes alive
Re-exports§
pub use super::match_syntax::match_syntax;pub use super::match_syntax::peek_feature_tokens;
Structs§
- Compiled
Stats - the number of values validated by the compiled matchers, see
compiled_stats - Context
Data - cursor over the tokens being validated
- MFValue
- result of
is_mf_value - Validation
Match - result of a match (
ValidationMatch)
Constants§
Traits§
- Context
Ext - context helpers on the shared handle
Functions§
- compiled_
stats - the number of values validated by the compiled matchers on this thread, and the disagreements with the interpreter
(verified mode, see
set_compiled_validation) - create_
validation_ context - create a validation context: the comments are removed, the whitespace and
!importantare trimmed - declaration_
validations - number of declaration values validated on this thread: an identical value is validated once
- drop_
error - a “drop” error of a token, with its location
- get_
mf_ info ValidationMediaFeature- is_
css_ wide_ keyword - true if the value is a css wide keyword, ignoring the case
- is_
func_ type funcTypes: the function token types- is_
mf_ value - validate a media feature value
- is_
valid_ declaration_ value - validate the value tokens of a declaration node. the validations are cached
- match_
all_ syntaxes - match all the syntaxes: the tokens must be consumed
- match_
declaration_ syntax - validate the value of a declaration. the successful and the failed validations are cached by value encoding
- match_
selector_ syntax - match a selector: the tokens are checked and normalized in place (combinators, whitespace)
- match_
simple_ selector - match a selector made of simple selectors (see [
is_simple_selector_token]), separated by whitespace (the descendant combinator) and by commas:.a:hover,.a .b,.a, #b. such a selector is valid: the whitespace around the commas is removed, the tokens are the tokens produced bymatch_selector_syntax. the tokens of another selector are not changed. returns true if the selector is made of simple selectors - set_
compiled_ validation - use the compiled matchers (see
crate::validation::compiled): 0 not used, 1 used, 2 verified by the interpreter (seecompiled_stats) - token_
location [file, line, column]of a token- token_
type_ name EnumToken[type]- trim_
array - trim leading and trailing whitespace