[antlr-interest] v3 java error in antlr output

Martin d'Anjou martin.danjou at neterion.com
Wed Feb 21 12:24:47 PST 2007


Hello,

I am getting a java error in antlr output. Here is the snippet of java 
code generated by antlr:

// $ANTLR start list_of_params
// ./antlr/DUMMY_Parser.g:125:1: list_of_params : PARAMETER parameter_assignment ( COMMA parameter_assignment )* ;
public void list_of_params() throws RecognitionException {
     try {
         // ./antlr/DUMMY_Parser.g:126:12: ( PARAMETER parameter_assignment ( COMMA parameter_assignment )* )
         // ./antlr/DUMMY_Parser.g:126:12: PARAMETER parameter_assignment ( COMMA parameter_assignment )*
         {
         match(input,PARAMETER,FOLLOW_PARAMETER_in_list_of_params1152);
          System.out.print("parameter ");
         pushFollow(FOLLOW_parameter_assignment_in_list_of_params1180);
         parameter_assignment();
         _fsp--;

         // ./antlr/DUMMY_Parser.g:128:12: ( COMMA parameter_assignment )*
         loop14:
         do {
             int alt14=2;
             int LA14_0 = input.LA(1);
             if ( (LA14_0==COMMA) ) {
                 switch ( input.LA(2) ) {
                 case IDENTIFIER:
                     int LA14_3 = input.LA(3);
                     if ( (LA14_3==ASSIGN) ) {
                         int LA14_6 = input.LA(4);
                         if ( (LA14_6==IDENTIFIER) ) {
                             alt14=1;
                         }


                     }


                     break;
                 case BITRANGE:
                     int LA14_4 = input.LA(3);
                     if ( (LA14_4==IDENTIFIER) ) {
                         int LA14_3 = input.LA(4);
                         if ( (LA14_3==ASSIGN) ) {
                             int LA14_6 = input.LA(5);
                             if ( (LA14_6==IDENTIFIER) ) {
                                 alt14=1;
                             }


...


The error given by the java compiler is:
LA14_3 is already defined in list_of_params()

Is this a bug or is my grammar throwing antlr off rails?

Thanks,
Martin


More information about the antlr-interest mailing list