code: def get_sync_start_position(self, document, lineno):
          " Scan backwards, and find a possible position to start. "
          pattern = self._compiled_pattern
          lines = document.lines
  
          # Scan upwards, until we find a point where we can start the syntax
          # synchronisation.
          for i in range(lineno, max(-1, lineno - self.MAX_BACKWARDS), -1):
              match = pattern.match(lines[i])
              if match:
                  return i, match.start()
  
          # No synchronisation point found. If we aren't that far from the
          # beginning, start at the very beginning, otherwise, just try to start
          # at the current line.
          if lineno < self.FROM_START_IF_NO_SYNC_POS_FOUND:
              return 0, 0
          else:
              return lineno, f get_sync_start_position(self, document, lineno):
          " Scan backwards, and find a possible position to start. "
          pattern = self._compiled_pattern
          lines = document.lines
  
          # Scan upwards, until we find a point where we can start the syntax
          # synchronisation.
          for i in range(lineno, max(-1, lineno - self.MAX_BACKWARDS), -1):
              match = pattern.match(lines[i])
              if match:
                  return i, match.start()
  
          # No synchronisation point found. If we aren't that far from the
          # beginning, start at the very beginning, otherwise, just try to start
          # at the current line.
          if lineno < self.FROM_START_IF_NO_SYNC_POS_FOUND:
              return 0, 0
          else:
              return lineno, 0
docs: Scan backwards, and find a possible position to start.