On May 1, 2008, at 10:02 AM, Johannes Luber wrote:

> Hi!
>
> I've noticed following new addition to the Token class:
>
> public static final Set legalOptions =
>                       new HashSet() {
>                               {
>                               add(defaultOption);
>                               }
>                       };
>
> Can someone explain me, what that code snippet actually does? It looks
> like that a new HashSet is created and that the variable defaultOption
> is added, but that's a guess as I have never seen such syntax  
> before. Am
> I right?
>

The {...} is a ctor for the unnamed anon inner class.  weird, eh?

Ter

_______________________________________________
antlr-dev mailing list
[email protected]
http://www.antlr.org:8080/mailman/listinfo/antlr-dev

Reply via email to