public final ANTLRv3TreeFilter.rewrite_template_ref_return rewrite_template_ref() throws RecognitionException {
        ANTLRv3TreeFilter.rewrite_template_ref_return retval = new ANTLRv3TreeFilter.rewrite_template_ref_return();
        retval.start = input.LT(1);

        try {
            // back-end/koopa/trees/antlr/filter/generator/ANTLRv3TreeFilter.g:472:2: ( ^( TEMPLATE ID rewrite_template_args ) )
            // back-end/koopa/trees/antlr/filter/generator/ANTLRv3TreeFilter.g:472:4: ^( TEMPLATE ID rewrite_template_args )
            {
            match(input,TEMPLATE,FOLLOW_TEMPLATE_in_rewrite_template_ref2404); 

            match(input, Token.DOWN, null); 
            match(input,ID,FOLLOW_ID_in_rewrite_template_ref2406); 
            pushFollow(FOLLOW_rewrite_template_args_in_rewrite_template_ref2408);
            rewrite_template_args();

            state._fsp--;


            match(input, Token.UP, null); 

            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return retval;
    }