W3C home > Mailing lists > Public > www-style@w3.org > February 2013

Re: [css3-syntax] Parser rewritten as recursive-descent, review requested

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Tue, 12 Feb 2013 20:57:11 -0800
Message-ID: <CAAWBYDAy=_79h5nm2GhSo4eEVwG2NOz6dAXeY96cer3cMRS5xA@mail.gmail.com>
To: Simon Sapin <simon.sapin@kozea.fr>
Cc: www-style list <www-style@w3.org>
On Tue, Feb 12, 2013 at 7:34 PM, Simon Sapin <simon.sapin@kozea.fr> wrote:
> Le 12/02/2013 12:41, Tab Atkins Jr. a écrit :
>> Per discussion at the last f2f, I've rewritten the parser section of
>> Syntax to be a recursive-descent parser instead of a state machine.
>>
>> It surprised me just how much simpler this strategy made it, as nearly
>> all error-handling is now automatic in the structure of the parser and
>> much more intuitive.  The parser itself is much shorter and easier to
>> read now, too.  Finally, the parser entry points now work *correctly*
>> - they were subtly wrong when I tried to just hack them on top of the
>> state machine.
>>
>> Please review and let me know if anything looks wrong.
>
>
> Hi,
>
> I notice three changes from the previous draft:
>
> 1. Invalid declarations (after the initial ident token) are ignored
> silently. They should trigger a parse error.

Fixed.

> 2. "! important" (with whitespace in-between) is no longer a priority
> marker.

Yes it is - note that I explicitly look for the last two
*non-whitespace* tokens.

> 3. A delim(!) token in a declaration not followed by "important" is no
> longer a parse error.

That's on purpose - we've discussed doing more things with bang-tokens
before, so I figured I should go ahead and allow the possibility in
the parser while I was at it.  It was more convenient to allow it than
to disallow it now (before, it was the opposite).

> Other than that, looks fine after a first pass.

Thanks!

~TJ
Received on Wednesday, 13 February 2013 04:57:58 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:21:05 GMT