Skip to main content

Module runtime

Module runtime 

Source
Expand description

Port of src/validation/compiled/runtime.ts: the matching engine of the compiled syntaxes.

The syntaxes of the validation data are compiled at build time (npm run syntax-compile, scripts/compile_syntax.rs) into a static table of Nodes (super::syntaxes). A node matches the tokens of a value from a position and returns the position after the matched tokens, or FAIL. The positions are indexes in the significant tokens of the value (the whitespace and the comments are skipped, like the interpreter does). Err(Bail) aborts the match: the interpreter validates the value.

A compiled matcher mirrors the syntax tree matched by the interpreter (crate::validation::match_). Its “valid” answer is final, its “invalid” answer is not: the interpreter validates the value again and reports the errors.

Structs§

Bail
the value must be validated by the interpreter

Enums§

Node
a syntax node. the children are indexes in NODES, the definitions indexes in ROOTS

Constants§

FAIL
no match

Functions§

compiled_definition
the compiled definition of a key (declarations/width), None if it is not compiled
leaf_kind
the fast path of the numeric types: the tokens that are neither idents (a css wide keyword is accepted by the types) nor math functions are matched without match_property(). 0: no fast path
match_compiled
match the tokens of a value with a compiled definition