Skip to content

Commit fab78c9

Browse files
committed
feat(ie-css): implement CSS parser with rules, declarations, and value types #68
CSS parser consuming tokens from CssTokenizer: - Stylesheet/Rule/Declaration types with PropertyId enum (~55 properties) - parse_stylesheet() and parse_declarations() public API - Qualified rule parsing: raw selector strings + declaration blocks - Declaration parsing: property:value with !important detection - Value types: CssValue (Length, Percentage, Number, Color, keywords, Auto, Inherit, Initial, None) - Color parsing: #hex (3/4/6/8 digit), rgb()/rgba(), 16 named colors - Length units: px, em, rem, %, vw, vh, vmin, vmax, ch, ex, pt - Shorthand expansion: margin, padding, border, border-width/style/color - Property inheritance classification, initial values - At-rule skipping (@import, @media consumed but not processed) - 14 parser tests + 26 tokenizer tests = 40 total
1 parent a9b8bba commit fab78c9

4 files changed

Lines changed: 1150 additions & 48 deletions

File tree

crates/ie-css/src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ pub mod parser;
77
pub mod selector;
88
pub mod style;
99
pub mod tokenizer;
10+
pub mod values;
1011

11-
pub use parser::parse_stylesheet;
12+
pub use parser::{Declaration, Rule, Stylesheet, parse_declarations, parse_stylesheet};
1213
pub use style::ComputedStyle;
1314
pub use tokenizer::{CssToken, CssTokenizer};
15+
pub use values::{CssColor, CssValue, LengthUnit, PropertyId};

0 commit comments

Comments
 (0)