lexer header/body

Matthias Andree matthias.andree at gmx.de
Wed Apr 7 15:10:43 CEST 2004


On Wed, 07 Apr 2004, Boris 'pi' Piwinger wrote:

> If so, wouldn't it work (and be maybe faster) to have a
> clear HEADER state (instead of using INITIAL all the time)
> to deal with those things? Once we leave the header, those
> rules would never be used again.
> 
> Let me give one example:
> <INITIAL>(file)?name=\"?			/* ignore */
> <INITIAL>\n?[[:blank:]]id\ {ID}			/* ignore */
> 
> Those seem to work in header and body. I believe this is
> intended to capture MIME headers in multipart messages as
> well. But it is not precise (won't probably no harm,
> though). It would capture this anywhere in the body. Right?
> 
> If I would use something like
> <INITIAL>^Status:.* /* ignore */
> this would also do too much (and probably also do no harm).
> 
> Are my thoughts correct?

I haven't looked at the lexer code in a long time. Anyways, the angle
brackets contain a "state" - the lexer bogofilter uses is a state
machine to some extent, the state is changed by the BEGIN(newstate)
statements. <INITIAL> should be the state where we parse headers, and a
blank line should switch the lexer to some kind of body mode, away from
INITIAL. But, as said initially, I haven't looked at the code in a long
time, if the description doesn't make sense with the current lexer_v3.l,
I may be wrong.

-- 
Matthias Andree

Encrypt your mail: my GnuPG key ID is 0x052E7D95




More information about the bogofilter-dev mailing list