public final NiklausParser.declaration_return declaration() throws RecognitionException {
        NiklausParser.declaration_return retval = new NiklausParser.declaration_return();
        retval.start = input.LT(1);


        CommonTree root_0 = null;

        NiklausParser.constantdeclaration_return constantdeclaration14 =null;

        NiklausParser.variabledeclaration_return variabledeclaration15 =null;

        NiklausParser.functiondeclaration_return functiondeclaration16 =null;

        NiklausParser.proceduredeclaration_return proceduredeclaration17 =null;



        try {
            // C:\\Users\\Edward\\workspace\\ANTLRTest\\src\\Niklaus.g:58:12: ( constantdeclaration | variabledeclaration | functiondeclaration | proceduredeclaration )
            int alt5=4;
            switch ( input.LA(1) ) {
            case CONST:
                {
                alt5=1;
                }
                break;
            case VAR:
                {
                alt5=2;
                }
                break;
            case FUNCTION:
                {
                alt5=3;
                }
                break;
            case PROCEDURE:
                {
                alt5=4;
                }
                break;
            default:
                NoViableAltException nvae =
                    new NoViableAltException("", 5, 0, input);

                throw nvae;

            }

            switch (alt5) {
                case 1 :
                    // C:\\Users\\Edward\\workspace\\ANTLRTest\\src\\Niklaus.g:59:3: constantdeclaration
                    {
                    root_0 = (CommonTree)adaptor.nil();


                    pushFollow(FOLLOW_constantdeclaration_in_declaration163);
                    constantdeclaration14=constantdeclaration();

                    state._fsp--;

                    adaptor.addChild(root_0, constantdeclaration14.getTree());

                    }
                    break;
                case 2 :
                    // C:\\Users\\Edward\\workspace\\ANTLRTest\\src\\Niklaus.g:60:5: variabledeclaration
                    {
                    root_0 = (CommonTree)adaptor.nil();


                    pushFollow(FOLLOW_variabledeclaration_in_declaration169);
                    variabledeclaration15=variabledeclaration();

                    state._fsp--;

                    adaptor.addChild(root_0, variabledeclaration15.getTree());

                    }
                    break;
                case 3 :
                    // C:\\Users\\Edward\\workspace\\ANTLRTest\\src\\Niklaus.g:61:5: functiondeclaration
                    {
                    root_0 = (CommonTree)adaptor.nil();


                    pushFollow(FOLLOW_functiondeclaration_in_declaration176);
                    functiondeclaration16=functiondeclaration();

                    state._fsp--;

                    adaptor.addChild(root_0, functiondeclaration16.getTree());

                    }
                    break;
                case 4 :
                    // C:\\Users\\Edward\\workspace\\ANTLRTest\\src\\Niklaus.g:62:5: proceduredeclaration
                    {
                    root_0 = (CommonTree)adaptor.nil();


                    pushFollow(FOLLOW_proceduredeclaration_in_declaration183);
                    proceduredeclaration17=proceduredeclaration();

                    state._fsp--;

                    adaptor.addChild(root_0, proceduredeclaration17.getTree());

                    }
                    break;

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


            retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
            adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
    	retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);

        }

        finally {
        	// do for sure before leaving
        }
        return retval;
    }