Main part of the protocol handling. Whan comes in as the parameter is
        a array of expresions, for example:

          [ "1", "'some string'", "variable",
            "some_call(param1, some_other_call())" ]

        Each element of the is evaluated in synchronous way. In case of method
        calls, the call is performed by iterating the method.

        The result of the function is list with elements subsituted by the
        values they stand for (for variables: values, for method calls: the
        result of deferred returned).

        The async parametr (default False) tells whether to yield the Deferred
        returned. If False, the Deferreds are substitued with None.

def process_array(self, array, async=False):
        """
        Main part of the protocol handling. Whan comes in as the parameter is
        a array of expresions, for example:

          [ "1", "'some string'", "variable",
            "some_call(param1, some_other_call())" ]

        Each element of the is evaluated in synchronous way. In case of method
        calls, the call is performed by iterating the method.

        The result of the function is list with elements subsituted by the
        values they stand for (for variables: values, for method calls: the
        result of deferred returned).

        The async parametr (default False) tells whether to yield the Deferred
        returned. If False, the Deferreds are substitued with None.
        """

        result = list()
        kwargs = dict()
        keyword = None

        def append_result(value):
            if keyword:
                kwargs[keyword] = value
            else:
                result.append(value)

        for element in array:
            self.log('matching: %s', element)

            # First check for expresion with the form keyword=expresion
            keyword = None
            assignment = self.re['assignment'].search(element)
            if assignment:
                keyword = assignment.group(1)
                element = assignment.group(2)

            m = self.re['number'].search(element)
            if m:
                append_result(eval(m.group(0)))
                continue

            m = self.re['string'].search(element)
            if m:
                append_result(m.group(1))
                continue

            m = self.re['none'].search(element)
            if m:
                append_result(None)
                continue

            m = self.re['true'].search(element)
            if m:
                append_result(True)
                continue

            m = self.re['false'].search(element)
            if m:
                append_result(False)
                continue

            m = self.re['variable'].search(element)
            if m:
                append_result(self.get_local(m.group(1)))
                continue

            m = self.re['call'].search(element)
            n = self.re['method_call'].search(element)
            if m or n:
                if m:
                    command = m.group(1)
                    method = self.commands.lookup_cmd(command)
                    rest = m.group(2)
                else:
                    obj = n.group(1)
                    local = self.get_local(obj)
                    if not isinstance(local, (Manhole, PBRemote, )):
                        raise IllegalCall('Variable %r should be a Manhole '
                                          'instance to make this work! '
                                          'Got %r instead.' %\
                                          (obj, type(local)))
                    command = n.group(2)
                    method = local.lookup_cmd(command)
                    rest = n.group(3)
                arguments, keywords =\
                           yield self.process_array(self.split(rest))
                output = method(*arguments, **keywords)
                if isinstance(output, defer.Deferred):
                    if not async:
                        output = yield output
                    else:
                        output = WrappedDeferred(output)

                if isinstance(output, pb.RemoteReference):
                    output = PBRemote(output)
                    yield output.initiate()

                self.debug("Finished processing command: %s.", element)
                append_result(output)
                continue

            raise BadSyntax('Syntax error processing line: %s. '
                            'Could not detect type of element: %s' %\
                            (self._last_line, element, ))

        defer.returnValue((result, kwargs, ))