

def highlightBlock(self, string):
    ' Highlight a block of text.\n        '
    prev_data = self.currentBlock().previous().userData()
    if (prev_data is not None):
        self._lexer._saved_state_stack = prev_data.syntax_stack
    elif hasattr(self._lexer, '_saved_state_stack'):
        del self._lexer._saved_state_stack
    index = 0
    for (token, text) in self._lexer.get_tokens(string):
        length = len(text)
        self.setFormat(index, length, self._get_format(token))
        index += length
    if hasattr(self._lexer, '_saved_state_stack'):
        data = PygmentsBlockUserData(syntax_stack=self._lexer._saved_state_stack)
        self.currentBlock().setUserData(prev_data)
        del self._lexer._saved_state_stack

dataset/ETHPy150Open ipython/ipython-py3k/IPython/frontend/qt/console/pygments_highlighter.py PygmentsHighlighter.highlightBlock/VarMisuse@154/222 `data`->`prev_data`