[antlr-interest] BUG (JAVA): Generics not permitted in Antlr rule parameter lists

Austin Hastings Austin_Hastings at Yahoo.com
Sun Nov 11 23:28:29 PST 2007


Gavin Lambert wrote:
> At 09:44 12/11/2007, Austin Hastings wrote:
> >      (tc=testCase[method1, method2, $tests]
>
> Interesting; it appears to be the use of the $ here that annoys it.  
> If you remove either the $ or the preceding , then it generates the 
> correct number of commas in the call.
>
> (My earlier test was passing a local variable, so didn't use the $.)
>
> Still probably a bug, but a weird one.  At least the workaround is 
> straightforward :)

Sadly, you can't cast generics. :( The workaround is functional, not 
lexical - return a value and perform the list insertion outside the 
rule. This goes somewhere down around #931 on the list of reasons why I 
hate Java generics. :-O

>
> >    : input '->' outputExpr
>
> It's probably not a good idea to call something "input", as that's a 
> member of the parser base class itself.
>
Thanks, I'll change it.

=Austin

>
>



More information about the antlr-interest mailing list