hwt/hdl/statements.py
def _merge_statement_lists(stmsA: List["HdlStatement"], stmsB: List["HdlStatement"])\
            -> List["HdlStatement"]:
        """
        Merge two lists of statements into one

        :return: list of merged statements
        """
        if stmsA is None and stmsB is None:
            return None

        tmp = []

        a_it = iter(stmsA)
        b_it = iter(stmsB)

        a = None
        b = None
        a_empty = False
        b_empty = False

        while not a_empty and not b_empty:
            while not a_empty:
                a = next(a_it, None)
                if a is None:
                    a_empty = True
                    break
                elif a.rank == 0:
                    # simple statement does not require merging
                    tmp.append(a)
                    a = None
                else:
                    break

            while not b_empty:
                b = next(b_it, None)
                if b is None:
                    b_empty = True
                    break
                elif b.rank == 0:
                    # simple statement does not require merging
                    tmp.append(b)
                    b = None
                else:
                    break

            if a is not None or b is not None:
                a._merge_with_other_stm(b)
                tmp.append(a)
                a = None
                b = None

        return tmp
def _merge_statement_lists(stmsA: List["HdlStatement"], stmsB: List["HdlStatement"])\
            -> List["HdlStatement"]:
        if stmsA is None and stmsB is None:
            return None

        tmp = []

        a_it = iter(stmsA)
        b_it = iter(stmsB)

        a = None
        b = None
        a_empty = False
        b_empty = False

        while not a_empty and not b_empty:
            while not a_empty:
                a = next(a_it, None)
                if a is None:
                    a_empty = True
                    break
                elif a.rank == 0:
                    # simple statement does not require merging
                    tmp.append(a)
                    a = None
                else:
                    break

            while not b_empty:
                b = next(b_it, None)
                if b is None:
                    b_empty = True
                    break
                elif b.rank == 0:
                    # simple statement does not require merging
                    tmp.append(b)
                    b = None
                else:
                    break

            if a is not None or b is not None:
                a._merge_with_other_stm(b)
                tmp.append(a)
                a = None
                b = None

        return tmp
def _merge_statement_lists ( stmsA : List [ "HdlStatement" ] , stmsB : List [ "HdlStatement" ] ) -> List [ "HdlStatement" ] : if stmsA is None and stmsB is None : return None tmp = [ ] a_it = iter ( stmsA ) b_it = iter ( stmsB ) a = None b = None a_empty = False b_empty = False while not a_empty and not b_empty : while not a_empty : a = next ( a_it , None ) if a is None : a_empty = True break elif a . rank == 0 : # simple statement does not require merging tmp . append ( a ) a = None else : break while not b_empty : b = next ( b_it , None ) if b is None : b_empty = True break elif b . rank == 0 : # simple statement does not require merging tmp . append ( b ) b = None else : break if a is not None or b is not None : a . _merge_with_other_stm ( b ) tmp . append ( a ) a = None b = None return tmp
Merge two lists of statements into one

        :return: list of merged statements
Merge two lists of statements into one