W3C home > Mailing lists > Public > www-style@w3.org > June 2015

Re: (Question) CSS3 parsing procedure, where does parsing Declarations go?

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Fri, 26 Jun 2015 09:09:47 -0700
Message-ID: <CAAWBYDCJfo4iLvvHFmg1h8OphqVqCTUZ=Mf0EaR4VBjOOrGS3w@mail.gmail.com>
To: Hai Thanh Nguyen <phaikawl@gmail.com>
Cc: www-style list <www-style@w3.org>
On Thu, Jun 25, 2015 at 8:20 PM, Hai Thanh Nguyen <phaikawl@gmail.com> wrote:
> 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.

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.

Received on Friday, 26 June 2015 16:10:34 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:55 UTC