When a user supplies the same character more than once when constructing a
tokenizer, nothing is functionally incorrect but this is strong indicator of a
bug or misunderstanding by the caller. For example, a bug like this is
documented in #2259.
assert(strcmp(separators, "") != 0 &&
"at least one separator must be provided");
+#ifndef NDEBUG
+ for (const char *s1 = separators; *s1 != '\0'; ++s1) {
+ for (const char *s2 = s1 + 1; *s2 != '\0'; ++s2) {
+ assert(*s1 != *s2 && "duplicate separator characters");
+ }
+ }
+#endif
+
tok_t t = {.start = input, .separators = separators};
// find the end of the first token