On May 14, 2009, at 2:21 PM, Warren Falk wrote:

> This has been asked on here before, but the answers no longer appear
> to be correct using the latest version (3.1.3).
>
> The output of the  following combined grammar, TestParser.java, fails
> to compile with "Unreachable catch block" in the token rule (despite
> the empty @rulecatch which doesn't appear to have an effect).  What am
> I missing?  (The reason it's unreachable is because the '.' can't fail
> -- this is just an abbreviated grammar for illustration only).

that's why this one fails...  oh and rulecatch works at global not  
rule level i think.
T
>
>
> // -----------------------------
> grammar Test;
>
> options {
>     language = Java;
>     output = AST;
> }
>
> document
>   : token+
>   ;
>
> token
>  @rulecatch { }
>   : .
>   ;
>
> WS : WSCHAR+ ;
>
> WORD : NONWSCHAR+ ;
>
> fragment
> NONWSCHAR : ~WSCHAR ;
>
> fragment
> WSCHAR    : (' '|'\n'|'\r'|'\t') ;
> // -----------------------------
>
> Unreachable catch block for RecognitionException. This exception is
> never thrown from the try statement body      TestParser.java
>
> Thanks in advance.
>
> P.S. this is my first time posting here and I'm a bit new to ANTLR, so
> I apologize in advance if this is a stupid request.
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: 
> http://www.antlr.org/mailman/options/antlr-interest/your-email-address


List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/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
-~----------~----~----~----~------~----~------~--~---

Reply via email to