[antlr-interest] Help! Predicate failed messages
Jim Idle
jimi at temporal-wave.com
Wed Dec 3 07:31:37 PST 2008
On Wed, 2008-12-03 at 17:41 +0800, chain one wrote:
> procedure_id
> : { isFirst }? id=IDENT { addId($id.getText(),PROCEDURE_IDENT); }
> | nid=PROCEDURE_IDENT { $nid.setType(IDENT);} ->
> ^(PROCEDURE_ID[] PROCEDURE_IDENT)
> ;
> In the first pass, isFirst is true, and in the second pass, isFirst
> is set to be false.
> When running the generated Java code, it seems every time
> the predicate fails, there will be an error message coming out like
> this:
>
>
> line 43:41 rule named_types failed predicate: { isFirst }?
>
>
>
> Could it be ignored? or there is something wrong with my grammar file?
>
You need to use a gated semantic predicate not a semantic predicate.
{ isFirst }?=>
You should also read through the getting started with ANTLR 3 links on
antlr.org as they will save you a lot of time.
Jim
>
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20081203/a5201b7f/attachment.html
More information about the antlr-interest
mailing list