def _updateStringIndex(self, text): """Regenerate index of found strings. This algorythm is suitable for either multiline strings and multiline comments. There are no any difference for highlighter """ block = self.currentBlock() if block.previous().isValid(): prevState = block.previous().userState() else: prevState = 0 start = 0 state = prevState foundStrings = [] for match in re.finditer('"', text): if state: # string end foundStrings.append( _FoundString(start, match.start() + 1 - start)) state = 0 else: # string start state = 1 start = match.start() if state: foundStrings.append(_FoundString(start, len(text) - start)) block.setUserState(state) data = self.currentBlockUserData() if data is None: data = QTextBlockUserData() data.foundStrings = foundStrings self.setCurrentBlockUserData(data)
def _updateStringIndex(self, text): """Regenerate index of found strings. This algorythm is suitable for either multiline strings and multiline comments. There are no any difference for highlighter """ block = self.currentBlock() if block.previous().isValid(): prevState = block.previous().userState() else: prevState = 0 start = 0 state = prevState foundStrings = [] for match in re.finditer('"', text): if state: # string end foundStrings.append(_FoundString(start, match.start() + 1 - start)) state = 0 else: # string start state = 1 start = match.start() if state: foundStrings.append(_FoundString(start, len(text) - start)) block.setUserState(state) data = self.currentBlockUserData() if data is None: data = QTextBlockUserData() data.foundStrings = foundStrings self.setCurrentBlockUserData(data)
def _updateBraceIndex(self, text): """Regenerate index of found braces for a block """ foundBraces = [] for match in self._bracePattern.finditer(text): if not self._insideString(match.start()): foundBraces.append(_FoundBrace(self.currentBlock(), match.start(), match.group(0))) data = self.currentBlockUserData() if data is None: data = QTextBlockUserData() data.foundBraces = foundBraces self.setCurrentBlockUserData(data)
def _updateBraceIndex(self, text): """Regenerate index of found braces for a block """ foundBraces = [] for match in self._bracePattern.finditer(text): if not self._insideString(match.start()): foundBraces.append( _FoundBrace(self.currentBlock(), match.start(), match.group(0))) data = self.currentBlockUserData() if data is None: data = QTextBlockUserData() data.foundBraces = foundBraces self.setCurrentBlockUserData(data)
def data(block): """Get the block's QTextBlockUserData, creating it if necessary.""" data = block.userData() if not data: data = QTextBlockUserData() block.setUserData(data) return data
def __init__(self): QTextBlockUserData.__init__(self) self.data = {}
def __init__(self, log_lvl): QTextBlockUserData.__init__(self) self.log_lvl = log_lvl
def __init__(self): QTextBlockUserData.__init__(self)
def __init__(self, configuration_line): QTextBlockUserData.__init__(self) self.configuration_line = configuration_line
def __init__(self, data): QTextBlockUserData.__init__(self) self.data = data