[antlr-interest] java grammar problems

Terence Parr parrt at cs.usfca.edu
Fri Oct 17 12:58:58 PDT 2003


On Friday, September 26, 2003, at 04:36 PM, Ray Waldin wrote:

> Charles Zhang wrote:
>
> The interfaceBlock rule of the java.tree.g does not
> contain a typedefinition. It shouldn't anyways. It
> should just contain a interfaceDefinition.

Fixed in the depot.

Terence

>
>
> Hi Charles,
>
> According to  
> http://java.sun.com/docs/books/jls/second_edition/html/ 
> interfaces.doc.html#236431 an interface can contain both interface and  
> class declarations, as in:
>
> interface foo {
>     class bar { }
>     interface baz { }
> }
>
> But I'm not
> a grammar expert and scared of making changes. Could
> you show me how to solve this problem?
>
>
>
> To fix the java.tree.g grammar, just add typeDefinition to the  
> interfaceBlock production so it looks like this:
>
> interfaceBlock
>     :    #(    OBJBLOCK
>             (    methodDecl
>             |    variableDef
>             |    typeDefinition
>             )*
>         )
>     ;
>
> Hope that helps.
>
> - Ray
>
> Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
--
Professor Comp. Sci., University of San Francisco
Creator, ANTLR Parser Generator, http://www.antlr.org
Co-founder, http://www.jguru.com
Co-founder, http://www.knowspam.net enjoy email again!
Co-founder, http://www.peerscope.com pure link sharing




 

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




More information about the antlr-interest mailing list