[antlr-interest] Breaking a loop
John Green
greenj at ix.netcom.com
Fri Nov 4 13:13:54 PST 2005
The semantic predicate would be awful complex, since it would have to check for:
(io_opt)* state_end
In other words, I'd have to hand-code a syntactic predicate into the semantic predicate.
Terence Parr wrote:
> 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