challenge [was: unfolding header lines]
David Relson
relson at osagesoftware.com
Fri Sep 5 05:08:12 CEST 2003
Michael,
By jove, I think you've got it :-) Now to transfer the changes to
lexer_v3.l and lexer.c which is the "real" code and see what happens.
David
On 05 Sep 2003 12:05:53 +1000
michael at optusnet.com.au wrote:
> David Relson <relson at osagesoftware.com> writes:
> [..]
> > The simple grammar does about 99% of what's needed for unfolding
> > header lines. Tests #1 and #2 work fine. Test #3 is a couple of
> > characters shorter than #2 (some whitespace and an 'x') and fails.
> >
> > The challenge is to modify lexer.l so that all 3 tests pass :-)
>
> Where's lexer.h ?? :)
>
> > If I've setup the test properly, the modified lexer.l will merge
> > easily into the official bogofilter lexer and bogofilter will handle
> > unfolded header lines properly. If I don't have it right, there
> > will need to be a second challenge round.
>
> Done. Get rid of the clr_tag() calls from main.c and use
> a lexer like....
>
> <INITIAL>\n[ \t] { lineno += 1; } /* unfold
> lines */<INITIAL>^\n { BEGIN TEXT;
> printf("*** BEGIN
> TEXT***\n");;
> return(EMPTY);
> }
> {TOKEN} { return TOKEN;}
> boundary={MIME_BOUNDARY} { got_mime_boundary();
> }^--{MIME_BOUNDARY}(--)?$ {
> mime_boundary_set(); BEGIN INITIAL; return BOUNDARY; }.
> ; /* ignore
> character */
> \n { lineno += 1;
> clr_tag(); }
>
>
> Ta-dah!! :) Note the change to the '\n' pattern.
>
> Michael.
>
> PS. I know the whitespace isn't precisely right, but who cares.
>
> ---------------------------------------------------------------------
> FAQ: http://bogofilter.sourceforge.net/bogofilter-faq.html
> To unsubscribe, e-mail: bogofilter-dev-unsubscribe at aotto.com
> For summary digest subscription:
> bogofilter-dev-digest-subscribe at aotto.com For more commands, e-mail:
> bogofilter-dev-help at aotto.com
--
David Relson Osage Software Systems, Inc.
relson at osagesoftware.com Ann Arbor, MI 48103
www.osagesoftware.com tel: 734.821.8800
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lexer.h
Type: application/octet-stream
Size: 179 bytes
Desc: not available
URL: <https://www.bogofilter.org/pipermail/bogofilter-dev/attachments/20030904/42196db0/attachment.obj>
More information about the bogofilter-dev
mailing list