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

ooobles oobles at hotmail.com
Sun May 26 20:10:30 PDT 2002



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=192.168.42.232/3399 svsrc=10.0.0.2/2444 dstif=eth1 
dst=64.154.80.50/80 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/ 



More information about the antlr-interest mailing list