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

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.

I suspect the table of contents and index are mangled.  Are they 
autogenerated somehow?

zw

Received on Monday, 20 May 2013 00:05:18 UTC