[antlr-interest] parsing Java 5... bug?

Putrycz, Erik Erik.Putrycz at nrc-cnrc.gc.ca
Thu Aug 3 12:54:23 PDT 2006


I've been trying 
"Java 1.5 + Java preprocessor
Luca Colombi Fri May 12, 2006 10:46
The grammar submitted by Michael Studman and revised by Scott
Wisniewski, adapted to compile without error also in eclipse with antlr
plugin and jdk 1.5, and the java preprocessor ported in Java as a
subclass of Reader."

This is weird... This grammar throws errors even with an empty class.

Erik Putrycz, Ph.D - Research Associate / erik.putrycz at nrc-cnrc.gc.ca /
(613) 990 0681
Institute for Information Technology - Software Engineering Group
National Research Council, Canada - Building M-50, 1200 Montreal Road
Ottawa, Ontario, CANADA K1A 0R6


-----Original Message-----
From: Dieter Frej [mailto:dieter_frej at gmx.net] 
Sent: August 3, 2006 3:20
To: Putrycz, Erik
Cc: antlr-interest at antlr.org
Subject: Re: [antlr-interest] parsing Java 5... bug?


which grammar are you using?

- Didi



Putrycz, Erik wrote:
> I've been running into some strange issues while trying to parse java 
> 5...
> I tried the most recent version that comes with a java preprocessor
> 
> Character.isLetter(LA(1))
> 
>             at nrc.uml2.antlr.JavaLexer.mID_START(JavaLexer.java:1390)
> 
>             at nrc.uml2.antlr.JavaLexer.mIDENT(JavaLexer.java:1449)
> 
>             at nrc.uml2.antlr.JavaLexer.nextToken(JavaLexer.java:368)
> 
>             at antlr.TokenBuffer.fill(TokenBuffer.java:69)
> 
>             at antlr.TokenBuffer.LA(TokenBuffer.java:80)
> 
>             at antlr.LLkParser.LA(LLkParser.java:52)
> 
>             at
> nrc.uml2.antlr.JavaRecognizer.compilationUnit(JavaRecognizer.java:296)
> 
> ...
> 
>  
> 
> My input is very simple:
> 
> package simple;
> 
>  
> 
> public class BR {
> 
>  
> 
>             public void runMe() {
> 
>                         int result = 1;
> 
>                         for (int il = 0;il < 100;il++) {
> 
>                                     result = result + il;
> 
>                         }
> 
>                         if (result > 5)
> 
>                                     System.out.println("check");
> 
>             }
> 
> }
> 
>  
> 
> Is this a bug in the grammar or something else?
> 
>  
> 
> **Erik Putrycz, Ph.D - Research Associate /
> ****erik.putrycz at nrc-cnrc.gc.ca** 
> <mailto:erik.putrycz at nrc-cnrc.gc.ca>** / (613) 990 0681**
> 
> Institute for Information Technology - Software Engineering Group
> 
> National Research Council, Canada - Building M-50, 1200 Montreal Road
> 
> Ottawa, Ontario, CANADA K1A 0R6
> 
>  
> 



More information about the antlr-interest mailing list