Skip to main content

Module parse

Module parse 

Source
Expand description

Port of src/parser/parse.ts.

doParse() / doParseSync(): see parse_main.rs. this module holds the statement parsers (parseNode(), parseAtRule()), the token parsers (parseString(), parseTokens()) and their helpers.

Re-exports§

pub use super::parse_main::*;

Structs§

ParseResultStats
ParseResultStats

Functions§

allocate_token
allocate the current tokenizer token in the arena
allocate_whitespace
allocate a whitespace token
arena_capacity
initial arena capacity: one node for every 4 bytes of css
create_at_rule_node
allocate an at-rule node from an at-rule token
create_comment_node
allocate a comment node from a comment token
drop_invalid_nodes
detach the invalid nodes. the unknown nodes are kept in lenient mode
get_key_name
transform the case of a key name (getKeyName())
is_bad_token
bad comment, cdo, url or string token
is_definition_block
true if the node is an at-rule whose block is kept when it is empty: @apply, @mixin, @function
is_statement_end
true if the token ends a statement or a block: the whitespace that precedes it is not significant
parse_at_rule
parse an at-rule
parse_declarations
parse a string as declaration nodes (detached). a new arena is created when none is given
parse_node
parse a statement: an at-rule, a rule or a declaration
parse_rule_content
parse a string as the content of a style rule (detached nodes, the comments are dropped)
parse_string
parse a css string into tokens (parseString(arena, src) with { parseColor: true })
parse_string_with
parse a css string into tokens. options: src and parseColor; None is null (the colors are parsed)
parse_tokens
parse the function, parentheses and attribute tokens of a token list (in place). None options: { parseColor: true }
recycle_statement_tokens
recycle the tokens of a statement that were not attached to the tree
render_tokens
render tokens (renderTokens())