develooper Front page | perl.perl5.porters | Postings from September 2012

Re: Newline legacy (Was: fixing smartmatch just hard enough (andwhen, too))

Thread Previous | Thread Next
From:
Aaron Crane
Date:
September 1, 2012 08:34
Subject:
Re: Newline legacy (Was: fixing smartmatch just hard enough (andwhen, too))
Message ID:
CACmk_ttJ=hV0pZZrDotpJ71QL6KTMM9HPst8RT+30Gm7on74LQ@mail.gmail.com
Bo Lindbergh <2bfjdsla52kztwejndzdstsxl9athp@gmail.com> wrote:
> I myself blathered:
>> Just in case the Unicode Consortium ever invents more whitespace,
>> here's a DFA table generator.
>
> And of course I realised the need for an extra sort step _after_ sending that.
> Corrected version attached.

Thanks, that's great!

By the time I saw your generator, I'd changed my hand-built automaton
to share the MATCH_C2 node with the tail of MATCH_80E2_OR_C2.  So
here's a reworked version of your program which automatically applies
the same optimisation wherever it can.  (Well, it may miss some
optimisation opportunities in particularly complex automata, because
it just does a single right-to-left pass over the nodes.  But it does
catch this case.)

I've also removed the output comments for node-internal edges, on the
grounds that they're only helpful when you're writing the automaton by
hand.

-- 
Aaron Crane ** http://aaroncrane.co.uk/

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About