public final ProtoParser.enum_block_return enum_block(Proto proto, Message message) throws RecognitionException {
        ProtoParser.enum_block_return retval = new ProtoParser.enum_block_return();
        retval.start = input.LT(1);

        Object root_0 = null;

        Token ENUM118=null;
        Token ID119=null;
        Token LEFTCURLY120=null;
        Token RIGHTCURLY122=null;
        Token SEMICOLON123=null;
        ProtoParser.enum_body_return enum_body121 = null;


        Object ENUM118_tree=null;
        Object ID119_tree=null;
        Object LEFTCURLY120_tree=null;
        Object RIGHTCURLY122_tree=null;
        Object SEMICOLON123_tree=null;


            EnumGroup enumGroup = null;

        try {
            // com/dyuproject/protostuff/parser/ProtoParser.g:527:5: ( ENUM ID LEFTCURLY ( enum_body[proto, message, enumGroup] )* RIGHTCURLY ( ( SEMICOLON )? ) )
            // com/dyuproject/protostuff/parser/ProtoParser.g:527:9: ENUM ID LEFTCURLY ( enum_body[proto, message, enumGroup] )* RIGHTCURLY ( ( SEMICOLON )? )
            {
            root_0 = (Object)adaptor.nil();

            ENUM118=(Token)match(input,ENUM,FOLLOW_ENUM_in_enum_block2076); if (state.failed) return retval;
            if ( state.backtracking==0 ) {
            ENUM118_tree = (Object)adaptor.create(ENUM118);
            adaptor.addChild(root_0, ENUM118_tree);
            }
            ID119=(Token)match(input,ID,FOLLOW_ID_in_enum_block2078); if (state.failed) return retval;
            if ( state.backtracking==0 ) {
            ID119_tree = (Object)adaptor.create(ID119);
            adaptor.addChild(root_0, ID119_tree);
            }
            if ( state.backtracking==0 ) {
               
                          enumGroup = new EnumGroup((ID119!=null?ID119.getText():null), message, proto);
                          proto.addAnnotationsTo(enumGroup);
                      
            }
            LEFTCURLY120=(Token)match(input,LEFTCURLY,FOLLOW_LEFTCURLY_in_enum_block2091); if (state.failed) return retval;
            if ( state.backtracking==0 ) {
            LEFTCURLY120_tree = (Object)adaptor.create(LEFTCURLY120);
            adaptor.addChild(root_0, LEFTCURLY120_tree);
            }
            // com/dyuproject/protostuff/parser/ProtoParser.g:531:19: ( enum_body[proto, message, enumGroup] )*
            loop22:
            do {
                int alt22=2;
                switch ( input.LA(1) ) {
                case AT:
                case OPTION:
                case ID:
                    {
                    alt22=1;
                    }
                    break;

                }

                switch (alt22) {
            	case 1 :
            	    // com/dyuproject/protostuff/parser/ProtoParser.g:531:20: enum_body[proto, message, enumGroup]
            	    {
            	    pushFollow(FOLLOW_enum_body_in_enum_block2094);
            	    enum_body121=enum_body(proto, message, enumGroup);

            	    state._fsp--;
            	    if (state.failed) return retval;
            	    if ( state.backtracking==0 ) adaptor.addChild(root_0, enum_body121.getTree());

            	    }
            	    break;

            	default :
            	    break loop22;
                }
            } while (true);

            RIGHTCURLY122=(Token)match(input,RIGHTCURLY,FOLLOW_RIGHTCURLY_in_enum_block2099); if (state.failed) return retval;
            if ( state.backtracking==0 ) {
            RIGHTCURLY122_tree = (Object)adaptor.create(RIGHTCURLY122);
            adaptor.addChild(root_0, RIGHTCURLY122_tree);
            }
            if ( state.backtracking==0 ) {

                          if(!proto.annotations.isEmpty())
                              throw new IllegalStateException("Misplaced annotations: " + proto.annotations);
                      
            }
            // com/dyuproject/protostuff/parser/ProtoParser.g:534:11: ( ( SEMICOLON )? )
            // com/dyuproject/protostuff/parser/ProtoParser.g:534:12: ( SEMICOLON )?
            {
            // com/dyuproject/protostuff/parser/ProtoParser.g:534:12: ( SEMICOLON )?
            int alt23=2;
            switch ( input.LA(1) ) {
                case SEMICOLON:
                    {
                    alt23=1;
                    }
                    break;
            }

            switch (alt23) {
                case 1 :
                    // com/dyuproject/protostuff/parser/ProtoParser.g:534:12: SEMICOLON
                    {
                    SEMICOLON123=(Token)match(input,SEMICOLON,FOLLOW_SEMICOLON_in_enum_block2104); if (state.failed) return retval;
                    if ( state.backtracking==0 ) {
                    SEMICOLON123_tree = (Object)adaptor.create(SEMICOLON123);
                    adaptor.addChild(root_0, SEMICOLON123_tree);
                    }

                    }
                    break;

            }


            }


            }

            retval.stop = input.LT(-1);

            if ( state.backtracking==0 ) {

            retval.tree = (Object)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (Object)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }
        finally {
        }
        return retval;
    }
public final ProtoParser . enum_block_return enum_block ( Proto proto , Message message ) throws RecognitionException { ProtoParser . enum_block_return retval = new ProtoParser . enum_block_return ( ) ; retval . start = input . LT ( 1 ) ; Object root_0 = null ; Token ENUM118 = null ; Token ID119 = null ; Token LEFTCURLY120 = null ; Token RIGHTCURLY122 = null ; Token SEMICOLON123 = null ; ProtoParser . enum_body_return enum_body121 = null ; Object ENUM118_tree = null ; Object ID119_tree = null ; Object LEFTCURLY120_tree = null ; Object RIGHTCURLY122_tree = null ; Object SEMICOLON123_tree = null ; EnumGroup enumGroup = null ; try { { root_0 = ( Object ) adaptor . nil ( ) ; ENUM118 = ( Token ) match ( input , ENUM , FOLLOW_ENUM_in_enum_block2076 ) ; if ( state . failed ) return retval ; if ( state . backtracking == 0 ) { ENUM118_tree = ( Object ) adaptor . create ( ENUM118 ) ; adaptor . addChild ( root_0 , ENUM118_tree ) ; } ID119 = ( Token ) match ( input , ID , FOLLOW_ID_in_enum_block2078 ) ; if ( state . failed ) return retval ; if ( state . backtracking == 0 ) { ID119_tree = ( Object ) adaptor . create ( ID119 ) ; adaptor . addChild ( root_0 , ID119_tree ) ; } if ( state . backtracking == 0 ) { enumGroup = new EnumGroup ( ( ID119 != null ? ID119 . getText ( ) : null ) , message , proto ) ; proto . addAnnotationsTo ( enumGroup ) ; } LEFTCURLY120 = ( Token ) match ( input , LEFTCURLY , FOLLOW_LEFTCURLY_in_enum_block2091 ) ; if ( state . failed ) return retval ; if ( state . backtracking == 0 ) { LEFTCURLY120_tree = ( Object ) adaptor . create ( LEFTCURLY120 ) ; adaptor . addChild ( root_0 , LEFTCURLY120_tree ) ; } loop22 : do { int alt22 = 2 ; switch ( input . LA ( 1 ) ) { case AT : case OPTION : case ID : { alt22 = 1 ; } break ; } switch ( alt22 ) { case 1 : { pushFollow ( FOLLOW_enum_body_in_enum_block2094 ) ; enum_body121 = enum_body ( proto , message , enumGroup ) ; state . _fsp -- ; if ( state . failed ) return retval ; if ( state . backtracking == 0 ) adaptor . addChild ( root_0 , enum_body121 . getTree ( ) ) ; } break ; default : break loop22 ; } } while ( true ) ; RIGHTCURLY122 = ( Token ) match ( input , RIGHTCURLY , FOLLOW_RIGHTCURLY_in_enum_block2099 ) ; if ( state . failed ) return retval ; if ( state . backtracking == 0 ) { RIGHTCURLY122_tree = ( Object ) adaptor . create ( RIGHTCURLY122 ) ; adaptor . addChild ( root_0 , RIGHTCURLY122_tree ) ; } if ( state . backtracking == 0 ) { if ( ! proto . annotations . isEmpty ( ) ) throw new IllegalStateException ( "Misplaced annotations: " + proto . annotations ) ; } { int alt23 = 2 ; switch ( input . LA ( 1 ) ) { case SEMICOLON : { alt23 = 1 ; } break ; } switch ( alt23 ) { case 1 : { SEMICOLON123 = ( Token ) match ( input , SEMICOLON , FOLLOW_SEMICOLON_in_enum_block2104 ) ; if ( state . failed ) return retval ; if ( state . backtracking == 0 ) { SEMICOLON123_tree = ( Object ) adaptor . create ( SEMICOLON123 ) ; adaptor . addChild ( root_0 , SEMICOLON123_tree ) ; } } break ; } } } retval . stop = input . LT ( - 1 ) ; if ( state . backtracking == 0 ) { retval . tree = ( Object ) adaptor . rulePostProcessing ( root_0 ) ; adaptor . setTokenBoundaries ( retval . tree , retval . start , retval . stop ) ; } } catch ( RecognitionException re ) { reportError ( re ) ; recover ( input , re ) ; retval . tree = ( Object ) adaptor . errorNode ( input , retval . start , input . LT ( - 1 ) , re ) ; } finally { } return retval ; }
com/dyuproject/protostuff/parser/ProtoParser.g:523:1: enum_block[Proto proto, Message message] : ENUM ID LEFTCURLY ( enum_body[proto, message, enumGroup] )* RIGHTCURLY ( ( SEMICOLON )? ) ;