[antlr-interest] java stacktrace grammar

Luca Dall'Olio luca.dallolio at gmail.com
Sun Feb 17 12:25:14 PST 2008


Hello to everybody,
I am trying to use antlr to parse a logged java stacktrace, such as this 
input:

"java.lang.ExceptionInInitializerError
at 
com.x.tests.hibernate.BasicTankerSetupTest.beforeClass(BasicTankerSetupTest.java:16) 

Caused by: java.lang.RuntimeException
at com.x.tests.hibernate.HibernateUtil.clinit(HibernateUtil.java:20)"

This is my first antlr grammar and I understand I don't know much about 
them (I am learning from the java 1.5 grammar); the grammar attached 
seems to be able to cope with that input, but I am having problems when 
adding the exception message.
If I write the following rules and try them in AntlrWorks 1.1.7 I get a 
MismatchedTokenException(0!=0) in the first rule, could you please give 
me any hint about this?

messageLine
   :   (qualifiedClass ':' message?)+
    ;

qualifiedClass
   :    packagePath Identifier
   ;

packagePath      :    (Identifier '.')+
   ;

message
   :    MessagePart+
   ;

MessagePart       :    Letter*
   ;

Thank you in advance,
Luca
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: StackTraceText.g
Url: http://www.antlr.org/pipermail/antlr-interest/attachments/20080217/226f4830/attachment.pl 


More information about the antlr-interest mailing list