+static bool
+parse_tuple(char *tuple, char **option, char **expr, char **def)
+{
+ char *p;
+ bool esc;
+
+ for (esc = false, p = *option = tuple, *expr = NULL, *def = NULL; *p; p++)
+ {
+ if (!esc && *p == '\\')
+ {
+ esc = true;
+ continue;
+ }
+
+ if (!esc && *p == ':')
+ {
+ *p++ = 0;
+
+ if (!*expr)
+ *expr = p;
+ else if (!*def)
+ *def = p;
+ else
+ break;
+ }
+
+ esc = false;
+ }
+
+ return (*expr != NULL);
+}
+