import strutils iterator tokenize(text, sep): tuple[token: string, isSep: bool] = var i, lastMatch = 0 while i < text.len: for j, s in sep: if text[i..text.high].startsWith s: if i > lastMatch: yield (text[lastMatch .. lastMatch: yield (text[lastMatch ..