Hi Ben,
I'd had to see the grammar rule that generates this code to judge if
it is really an error, but I really doubt it is.
Although ANTLR tries to generate readable code, it will never come to
the level of (good) human written code. In this specific case, the
'true' might come from action/predicate code - ANTLR would have to
understand C# (and any other target language) in order to omit the
trailing else block. Even if it could optimize that block away, it's
probably not worth the effort because the compiler already does it.
So unless you're sure your grammar is correct, but the generate code
doesn't work as it should do (i.e. you're trying to debug a bug of the
code generator), it is save to disable such compiler warnings.
- (the other) Ben
On Sat, Nov 1, 2008 at 12:47 AM, Ben Gillis <[EMAIL PROTECTED]> wrote:
> why the unreachable code generation?
>
> ...
> else if ( (true) )
> {
> alt8 = 3;
> }
> else
> {
> if ( state.backtracking > 0 ) {state.failed = true; return retval;}
> NoViableAltException nvae_d8s1 =
> new NoViableAltException("", 8, 1, input);
> throw nvae_d8s1;
> }
>
> It seems fairly harmless to disable 0219 (unused variables), but disabling
> unreachable code warnings perhaps not.
>
> Regards,
> Ben
>
>
> List: http://www.antlr.org:8080/mailman/listinfo/antlr-interest
> Unsubscribe:
> http://www.antlr.org:8080/mailman/options/antlr-interest/your-email-address
>
>
>
List: http://www.antlr.org:8080/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org:8080/mailman/options/antlr-interest/your-email-address
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"il-antlr-interest" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/il-antlr-interest?hl=en
-~----------~----~----~----~------~----~------~--~---