[antlr-interest] Java *_return Access Level

Randall R Schulz rschulz at sonic.net
Thu Oct 9 17:43:06 PDT 2008


On Thursday 09 October 2008 17:32, Terence Parr wrote:
> On Oct 9, 2008, at 5:29 PM, Randall R Schulz wrote:
> > Hi,
> >
> > Is there any reason the many *_return classes generated when a
> > grammar uses the "returns [ ... ]" construct (under Java) cannot be
> > declared "private" (or, at least, "protected")?
> >
> > This would have the salutary effect of excluding them from the
> > external JavaDoc HTML typically generated from ANTLR-generated
> > sources, which usually excludes private members.
> >
> >
> > Randall Schulz
>
> Hi. I had not thought of that. yes that is a problem, but you need to
> access the return structures to pull results from the start symbol
> like the tree.
> Ter

I think it's worth some elaboration of the design.

As I mentioned in a posting this morning, I channel all high-level 
parsing actions through an acceptor interface, an instance of which is 
always supplied to the (tree) parser. Thus I typically need never 
access to any of the "returns" classes generated and they're 100% 
clutter in the generated documentation.

So a couple of options suggest themselves right off:

1) (Crude) A single option that specifies the protection level of the 
generated parser code's returns classes (or structs or whatever they're 
called in other target languages).

2) (Refined) An option that enumerates which returns classes require 
public access.


Randall Schulz


More information about the antlr-interest mailing list