Skip to content

Step 3b: CSS parser — rules, declarations, and value types #68

@thomasnemer

Description

@thomasnemer

Parent: #22
Prerequisites: Step 3a

Goal

Parse CSS into structured rules with selectors and declarations. Define CSS value types and ~40 properties.

Implementation

  • Parse stylesheet into Stylesheet { rules }
  • Parse qualified rules: selector + declaration block
  • Parse declarations: property: value pairs with !important
  • Shorthand expansion: margin, padding, border, background, font, flex
  • Value types: Length (px/em/rem/%), Color (#hex, rgb(), named), keywords
  • PropertyId enum for all ~40 properties
  • Property inheritance classification
  • Initial values per property
  • calc() basic support

Tests

  • Parse simple/complex rules, shorthands, !important
  • Value parsing: colors, lengths, keywords
  • ~15 tests

Acceptance Criteria

  • cargo test -p ie-css passes
  • Clippy clean

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions