[antlr-interest] How to the generated code in the "catch" section ?

Olivier Lefevre lefevrol at yahoo.com
Wed Feb 27 17:24:47 PST 2008


Sorry, I was looking for "@rulecatch". Searching for "rulecatch" and 
reading the whole section shows that @rulecatch is used globally but
there is another option: "catch [RecognitionException re]" for doing
it at the rule level.

What confused me is that if you write, e.g.,

    @rulecatch { foo }

    rule
    @rulecatch { bar }
    : ... ;

ANTLR will accept it but ignore the second @rulecatch block. Shouldn't
it be an error?

-- O.L.



More information about the antlr-interest mailing list