[antlr-interest] Bounded Closures?

Wincent Colaiuta win at wincent.com
Tue Jun 26 13:59:32 PDT 2007


El 26/6/2007, a las 22:51, Johannes Luber escribió:

> Wincent Colaiuta wrote:
>> If the += construct is used in a parser rule instead, then ANTLR does
>> indeed generate code for updating list_foo upon each match:
>>
>>             if (list_foo==null) list_foo=new ArrayList();
>>             list_foo.add(foo);
>
> Hmm. Thinking over the alternatives I'd say that ANTLR should still
> check that in lexer rules. Maybe it should generate temporary  
> tokens for
> that bit. I don't know a better place to check for such things and I
> don't want to have generate more tokens than I actually need.

Yes, I agree... given that all parsers, lexers and tree parser all  
inherit from a base recognizer class, I would like to see more  
behaviour (like this one) shared across them.  The shared behaviour  
that is already there is already a bit of a selling-point for ANTLR,  
anyway.

Cheers,
Wincent



More information about the antlr-interest mailing list