@Override
    public Method parseMethod() throws IOException {
        Method m = new Method();
        m.setReturnType(parseType());

        if (curToken.type == Lexer.Type.NAME) {
            m.setName(curToken.c);
            curToken = lexer.getToken();
        } else {
            throw new IOException("missing method name");
        }

        if (curToken.type == Lexer.Type.LEFT_PARENTHESIS) {
            curToken = lexer.getToken();
            m.setArguments(parseArglist());
        } else {
            throw new IOException("missing ( after method name");
        }

        if (curToken.type == Lexer.Type.RIGHT_PARENTHESIS) {
            curToken = lexer.getToken();
        } else {
            throw new IOException("missing )");
        }

        if (curToken.type == Lexer.Type.LEFT_BRACES) {
            curToken = lexer.getToken();
            m.setBody(parseBody());
        } else {
            throw new IOException("missing {");
        }

        if (curToken.type == Lexer.Type.RIGHT_BRACES) {
            curToken = lexer.getToken();
        } else {
            throw new IOException("missing }");
        }
        return m;
    }