[antlr-interest] Breaking a loop
Terence Parr
parrt at cs.usfca.edu
Fri Nov 4 12:30:23 PST 2005
Add a semantic predicate in front of alt(s) that says when to break :)
Ter
On Nov 4, 2005, at 10:43 AM, John Green wrote:
> 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