Re: [csswg-drafts] [css-syntax] Review requested of new Parsing text (#8834)

  > > [*The "parse" algorithms do not expect high level objects as input*]
  >
  > Correct, but I'm not sure why that's relevant. [...]

I thought that the "parse [a CSS]" algos could be used recursively. This is no longer possible with the unified model, because nested contents are already consumed. 

You also cannot use *parse something according to a CSS grammar* with a `<block-contents>` subproduction anymore, because this entry point consume a list of component values, which consumes simple blocks, whereas *consume a block's contents* expect tokens and consumes lists of rules and declarations.

---

  > every top-level rule that starts like `div:hover` would consume the entire rest of the stylesheet as a declaration, then the parser would realize it contains a {}-block in the wrong place

In my comment, I suggested to stop consuming a list of component values (for a non-custom property value) when encoutering the `{` following `hover` in the declaration value. However, I was wrong about consuming the remnants of the (bad) declaration: the algo would just return nothing, and *consume a block's contents* would backtrack to `div` and parse a rule.

---

But for both of these concerns, the current spec is fine with me. I understand that this is not a detailed implementation guide. When you try to conform to it as closely as possible, it can just be tricky to put pieces together sometimes.

Thank you for your clarifications.

-- 
GitHub Notification of comment by cdoublev
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/8834#issuecomment-1878627215 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Friday, 5 January 2024 13:00:38 UTC