Revert "Simplify code for generating separators array"

This reverts commit e3d93b7f8ab8452efd8edd8e5903b2ae774865de.

The new code did not properly handle empty separator.

Signed-off-by: Michal Čihař <michal@cihar.com>