((LEFT_BRACKET atom RIGHT_BRACKET)=>

Don't add a label in to the predicate.


Jim

> -----Original Message-----
> From: antlr-interest-boun...@antlr.org [mailto:antlr-interest-
> boun...@antlr.org] On Behalf Of Louis Burroughs
> Sent: Friday, October 14, 2011 7:10 AM
> To: antlr-interest@antlr.org
> Subject: [antlr-interest] Java synpred fragment generating errors
>
> antlr 3.4
> java 1.6
> os: windows xp
>
> Hello,
>
> When I try to use syntactic predicates in my grammar I am getting an
> error in the generated grammar parser file.  My variables are not
> initialized correctly.  I am new to antlr and syntactic predicates so I
> am not sure if the problem is in my grammar or in the template.  This
> also happens when I turn the backtracking option to true and remove the
> predicates from my grammar.
>
>
>
> // $ANTLR start synpred50_EsqlGrammar
>     public final void synpred50_EsqlGrammar_fragment() throws
> RecognitionException {
>   -->   *void  =null;*
>
>
>         //
> C:\\EsqlParser\\src\\com\\abc\\iaf\\plugin\\EsqlGrammar.g:393:23:
> ( LEFT_BRACKET var_atom1= atom RIGHT_BRACKET )
>         //
> C:\\EsqlParser\\src\\com\\abc\\iaf\\plugin\\EsqlGrammar.g:393:24:
> LEFT_BRACKET var_atom1= atom RIGHT_BRACKET
>         {
>
> match(input,LEFT_BRACKET,FOLLOW_LEFT_BRACKET_in_synpred50_EsqlGrammar20
> 08);
> if (state.failed) return ;
>
>         pushFollow(FOLLOW_atom_in_synpred50_EsqlGrammar2012);
>         var_atom1=atom();
>
>         state._fsp--;
>         if (state.failed) return ;
>
>
> match(input,RIGHT_BRACKET,FOLLOW_RIGHT_BRACKET_in_synpred50_EsqlGrammar
> 2014);
> if (state.failed) return ;
>
>         }
>
>     }
>
> Grammar Syntax:
>
> variable
>   :
>   var_id1=IDENTIFIER ((LEFT_BRACKET var_atom1=atom
> RIGHT_BRACKET)=>LEFT_BRACKET var_atom1=atom RIGHT_BRACKET)?
> (pe+=path_element)*
>     ->
>       ^(VARIABLE ^(BRACKET $var_atom1)$var_id1  $pe* )
>   ;
>
>
> This also happens with tokens:
>
> Token =null;
>
> Thanks in advance,
> Louis Burroughs
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-
> email-address

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

-- 
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to il-antlr-inter...@googlegroups.com.
To unsubscribe from this group, send email to 
il-antlr-interest+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.

Reply via email to