[antlr-interest] setTreeAdaptor and delegates

Terence Parr parrt at cs.usfca.edu
Fri Jun 20 13:58:23 PDT 2008


On Jun 20, 2008, at 9:53 PM, Dimitrios Kolovos wrote:

> Since you asked :) there is another thing related to reuse that may  
> (or may) not need be improved.
>
> I need to collect all parse errors generated during parsing  
> (instead of just printing them which is the default behaviour). To  
> do that I've added a @rulecatch in my top-level grammar and an  
> ArrayList in the @members. Again, I'd expect that the @rulecatch  
> would propagate to the imported grammars (which is not the case).

Hmm...well you could want it to be different.  Hm....what about all  
the other action names and any future ones?  Is there a general way  
we could handle this?  Maybe:

@delegates::header {...}
@delegates::rulecatch {...}

??

> Also I hoped that the delegate would have a standard-name field  
> e.g. parentParser which I could use to add the errors caught in sub- 
> grammars to the ArrayList of the parent parser. I can still do this  
> (again via reflection) but it would help if the parent parser had a  
> fixed name in the delegate.

A good point.  added:

http://www.antlr.org:8888/browse/ANTLR-303

Ter
PS	signing off from Galway, Ireland...10pm my time.  I'm traveling  
over next 3 days (ugh) to get home to San Francisco.


More information about the antlr-interest mailing list