<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def highlightBlock(self, text, prevContextStack):
 """Parse block and return ParseBlockFullResult return (lineData, highlightedSegments) where lineData is (contextStack, textTypeMap) where textTypeMap is a string of textType characters """

        if prevContextStack is not None:
            contextStack = prevContextStack
        else:
            contextStack = self._defaultContextStack

        highlightedSegments = []
        lineContinue = False
        currentColumnIndex = 0
        textTypeMap = []

        if len(text) > 0:
            while currentColumnIndex < len(text):
                _logger.debug('In context %s', contextStack.currentContext().name)

                length, newContextStack, segments, textTypeMapPart, lineContinue = \
                    contextStack.currentContext().parseBlock(contextStack, currentColumnIndex, text)

                highlightedSegments += segments
                contextStack = newContextStack
                textTypeMap += textTypeMapPart
                currentColumnIndex += length

            if not lineContinue:
                while contextStack.currentContext().lineEndContext is not None:
                    oldStack = contextStack
                    contextStack = contextStack.currentContext().lineEndContext.getNextContextStack(contextStack)
                    if oldStack == contextStack:  # avoid infinite while loop if nothing to switch
                        break

                # this code is not tested, because lineBeginContext is not defined by any xml file
                if contextStack.currentContext().lineBeginContext is not None:
                    contextStack = contextStack.currentContext().lineBeginContext.getNextContextStack(contextStack)
        elif contextStack.currentContext().lineEmptyContext is not None:
            contextStack = contextStack.currentContext().lineEmptyContext.getNextContextStack(contextStack)

        lineData = (contextStack, textTypeMap)
        return lineData, highlightedSegments