[antlr-interest] Looking for a simple answer. :)

Dan Stanger dan.stanger at ieee.org
Mon May 27 07:26:37 PDT 2002

Adding a seperate lexer is not as hard as it looks.   I had to do this kind
of thing also,
and it really makes it easy to do.

ooobles wrote:

> Hi..
> I've been working with ANTLR for a few weeks now and have had my head
> mashed a couple of times over trying to comprehend what it can't do.
> So far.. it didn't make me breakfast.. thats about all. :)  That is
> to say.. great job!
> I'm working on trying to parse some syslog entries like..
> httpd[13748]: 121 Statistics: duration=0.47 id=HI5l sent=586 rcvd=699
> srcif=eth0 src= svsrc= dstif=eth1
> dst= op=GET arg=http://hg1.hitbox.com/HG?
> hc=w147&l=y&hb=WQ500202CFDV94EN0&cd=1&n=ProdAd result="302 Moved
> Temporarily" proto=http rule=4
> The problem is in the value of various statistics.  For instance the
> arg value is a http request value.  Its value has the potential to
> contain all the nasty characters like = that completely destroys
> otherwise nicely formated line.
> Ideally I'd like my grammer to be:
> (ID ASSIGN VALUE)+       // for each name value pair.
> The problem is how do I make the VALUE in the lexer match everything
> including the = up to the first WS character but not have VALUE match
> against everything else?
> After reading much of the documents the best answer I could find was
> to create a seperate lexer, but this seems like overkill for a single
> rule???  Any other ideas?
> Thanks,
> David.
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/


Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 

More information about the antlr-interest mailing list