[csswg-drafts] [css-syntax] CSS3 parsing procedure, where does parsing Declarations go? (#3592)

tabatkins has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-syntax] CSS3 parsing procedure, where does parsing Declarations go? ==
(migrated from the mailing list)

**Hai Thanh Nguyen said:**

> I have a question about http://dev.w3.org/csswg/css-syntax.
> It's written in the document that inside Simple Block are declarations. There's actually instruction on how to parse Declarations. However it doesn't seem to be anywhere in the overall procedure:
> Stylesheet -> Qualified Rule -> Simple Block -> Component Values
> 
> There's no path from the Stylesheet that leads to a Declaration, they just don't belong anywhere in the AST tree that's supposed to be parsed.
> Am I missing something? Why is it that way? Like, where am I supposed to call the "ParseDeclarations" function in my parser? Does it have to be parsed separately, away from the AST according to the standard? That's super weird.

--------------

**Tab Atkins said:**

> Correct, there's nothing in the Syntax spec that leads *directly*
> there.  This is because the CSS syntax is generic, and arbitrary
> blocks can contain either declaration or qualified rules (and
> at-rules, for both types.  Which parsing algo to use is determined by
> context-specific grammar, not the generic CSS syntax.
> 
> In particular, top-level qualified rules are style rules, which are
> defined as containing declarations.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/3592 using your GitHub account

Received on Friday, 1 February 2019 23:48:03 UTC