Re: Adding a "plugin" parser to ifile
Booker Bense <[email protected]> Thu, 06 Mar 2003 14:10:44 -0800 (PST)
| Newsgroups | gmane.mail.ifile.general |
|---|---|
| Message-ID | <[email protected]> |
On Thu, 6 Mar 2003, Jason Rennie wrote: > > [email protected] said: > > - I've been messing about with various ifile options "-h -w -k"[1] and > > I'm coming to the conclusion that it would be quite useful to > > customize the parser for ifile. While you can do this in front of > > ifile, I think as a first pass it would be convient to provide a > > "subprocess parser". > > Let me propose something here. How about we break ifile into two parts: > the parsing/lexing part and the classifier. To run ifile, you'd give the > message to the first program and pipe the output to the second program. > The first program could output one token per line. Then the lexing part > of the classifier would be exceedingly simple. Breaking it apart like > this would make it easier for people to experiment with different parsing/ > lexing styles; it would even make it possible to write prototype parsers/ > lexers in perl or some language that's easier to write. > > Thoughts? > - I think that would be great! After looking at the lexing code at bit I realize it's not quite as simple as I thought to plug in the kind of lexer/parser I'm thinking about. If there's anything I can do to help let me know. _ It seems to me that you could turn the current ifile into the second program quite trivially, and the first program would essentially be ifile_email_parser ? Perhaps a good first step in this direction would be just adding a "raw" parse mode to the current ifile. ifile -r ifile expects the tokens to appear one per line and does no special processing. Should be used with some preprocessor. Actually, this could already be done with the -w option. Hmm, this has given me some food for thought. - Booker C. Bense