Re: [css-syntax] Ready for wide review, FPWD request coming soon

On Sun, May 19, 2013 at 5:04 PM, Zack Weinberg <zackw@panix.com> wrote:
> On 2013-05-18 6:27 PM, Zack Weinberg wrote:
>> On 2013-05-17 4:16 PM, Tab Atkins Jr. wrote:
>>> On Fri, May 17, 2013 at 11:12 AM, Zack Weinberg <zackw@panix.com> wrote:
>>>>
>>>> * Regarding recursive-descent-style tokenization and removal of
>>>>    pushback, you were skeptical that this would be easier to read.
>>>>    Would you be interested in me attempting to rewrite section 4 with
>>>>    those changes, to see how it goes?  It would be pretty major so I
>>>>    don't want to do it if you're not at least curious whether it would
>>>>    be better.
>>>
>>>
>>> A small section would suffice.  Could you just try rewriting the
>>> number/percentage/dimension parsing?  That's probably the most complex
>>> set of interlocking states.
>>
>> OK, I'll try that.
>
> Attached is an edited version of the 17 May draft with the
> number/percentage/dimension tokenization rewritten as I had in mind.  It
> could probably stand a little polish, but I think this should give you an
> idea of what it would be like.  This reflects about four hours' effort and I
> think that was more than half of the work required to convert the whole
> scanner to this style.  (CSS numbers are messy.)
>
> I wound up partially converting identifier scanning as well, because it was
> convenient to have a "consume a sequence of name characters" subroutine to
> handle DIMENSIONs, and once you have that, using it for IDENT, HASH and
> AT-KEYWORD as well is trivial.

Okay, I've just pushed a large commit that rewrites the tokenizer to
be recursive-descent.  I'd greatly appreciate review from you and
Simon; it looks all right to me, but my mind is fatigued now.

It does still use pushback in several places.  It's probably possible
to remove that; would it be useful for me to try and do so?

(Thanks a ton for the rewrite example, by the way - I rewrote
everything slightly from what you had, but still stuck pretty close to
your design.)

~TJ

Received on Friday, 31 May 2013 00:14:56 UTC