[antlr-interest] Breaking a loop

John Green greenj at ix.netcom.com
Fri Nov 4 10:43:14 PST 2005


I've got a pre-existing language with a requirement like this:

    (    ( (io_opt)* state_end )=> (io_opt)* state_end {break;}
    |    .
    )*

Hopefully my question is obvious from the example. I need to break the loop when I hit a certain production. Until that production is reached, arbitrary tokens are consumed by the ".". Assuming {break;} is a bad hack, what's a good way to do this in Antlr?

Cheers,
john at joanju dot com



More information about the antlr-interest mailing list