Skip to main content

Crate muskitty_css_parser

Crate muskitty_css_parser 

Source
Expand description

MusKitty CSS Parser

Implements the parsing stage of the CSS Syntax Module Level 3 (§5 “Parser Algorithms”). Extracted from muskitty-css as a standalone crate for independent versioning and publication.

Re-exports Token / Tokenizer / CssTokenizer from muskitty-css-tokenizer so downstream crates (e.g. muskitty-selectors) can depend on this single crate to access the full CSS Syntax stack.

§Architecture

The parser follows the two-stage model described in CSS Syntax §3.1:

  1. Tokenization — handled by muskitty-css-tokenizer (re-exported here for convenience).
  2. Parsing — consumes tokens and produces CSS objects: stylesheets, rules, declarations, component values (§5, fully implemented).

§Top-level API

§References

Re-exports§

pub use algorithms::consume_a_block;
pub use algorithms::consume_a_blocks_contents;
pub use algorithms::consume_a_component_value;
pub use algorithms::consume_a_declaration;
pub use algorithms::consume_a_function;
pub use algorithms::consume_a_list_of_component_values;
pub use algorithms::consume_a_qualified_rule;
pub use algorithms::consume_a_simple_block;
pub use algorithms::consume_a_stylesheets_contents;
pub use algorithms::consume_a_unicode_range_value;
pub use algorithms::consume_an_at_rule;
pub use algorithms::consume_the_remnants_of_a_bad_declaration;
pub use algorithms::BlockContents;
pub use entry_points::parse_a_blocks_contents;
pub use entry_points::parse_a_comma_separated_list_of_component_values;
pub use entry_points::parse_a_component_value;
pub use entry_points::parse_a_declaration;
pub use entry_points::parse_a_list_of_component_values;
pub use entry_points::parse_a_rule;
pub use entry_points::parse_a_stylesheet;
pub use entry_points::parse_a_stylesheets_contents;
pub use grammar::parse_a_comma_separated_list_with_grammar;
pub use grammar::parse_a_grammar;
pub use grammar::Grammar;
pub use token_stream::TokenStream;
pub use types::AtRule;
pub use types::BlockKind;
pub use types::ComponentValue;
pub use types::Declaration;
pub use types::Function;
pub use types::ParseError;
pub use types::QualifiedRule;
pub use types::Rule;
pub use types::SimpleBlock;
pub use types::Stylesheet;

Modules§

algorithms
§5.5 Parser Algorithms.
entry_points
§5.4 Parser Entry Points.
grammar
§5.4.1 / §5.4.2 grammar-based parse entry points.
token_stream
Token stream (§5.3 L1722-1814).
types
CSS Parsing Results data structures (§5.2).

Structs§

CssTokenizer
The CSS tokenizer (§4.3).
Numeric
A numeric value carried by <number-token>, <percentage-token>, and <dimension-token> (§4.3.13).

Enums§

HashType
The type flag on a <hash-token> (§4.1, §4.3.4).
State
The current state of the CSS tokenizer.
Token
A CSS token (§4.1).

Traits§

Tokenizer
The CSS tokenizer.

Functions§

parse_comma_separated_list_of_component_values
Parse a CSS string into a comma-separated list of ComponentValue (§5.4.10).
parse_component_value
Parse a CSS string into a single ComponentValue (§5.4.8).
parse_declaration
Parse a CSS string into a single Declaration (§5.4.7).
parse_list_of_component_values
Parse a CSS string into a list of ComponentValue (§5.4.9).
parse_rule
Parse a CSS string into a single Rule (§5.4.6).
parse_stylesheet
Parse a CSS string into a Stylesheet (§5.4.3).
tokenize
Tokenize a CSS input string into a vector of tokens.