private Declarations parseDeclarations() {
		//System.out.println("parseDeclarations");
		Declarations decls = new Declarations();
		if(nextIs("const")) {
			acceptIt();
			ConstDeclarations cst = new ConstDeclarations();
			while (nextIs("ident")) {
				ConstDecl cd = new ConstDecl();
				cd.setIdent(new Identifier(expect("ident")));
				expect("eq");
				cd.setExpr(parseExpression());
				expect("semicolon");
				cst.getList().add(cd);
			}
			decls.setConsts(cst);
		}
		
		if(nextIs("type")) {
			acceptIt();
			//System.out.println("type detected");
			TypeDeclarations tpe = new TypeDeclarations();
			while(nextIs("ident")){
				TypeDecl td = new TypeDecl();
				td.setIdent(new Identifier(acceptIt()));
				expect("eq");
				td.setType(parseType());
				expect("semicolon");
				tpe.getList().add(td);
			}
			decls.setTypes(tpe);
		}
		
		if(nextIs("var")) {
			acceptIt();
			//System.out.println("var detected");
			VarDeclarations vars = new VarDeclarations();
			while(nextIs("ident")){
				VarDecl vd = new VarDecl();
				vd.setIdentList(parseIdentList());
				expect("colon");
				vd.setType(parseType());
				expect("semicolon");
				vars.getList().add(vd);
			}
			decls.setVars(vars);
		}
		
		if(nextIs("procedure")) {
			ProcedureDeclarations procs = new ProcedureDeclarations();
			while(nextIs("procedure")){
				procs.getList().add(parseProcedureDeclaration());
				expect("semicolon");
			}
			decls.setProcs(procs);
		}
		return decls;
	}