These bits can be easily moved to a separate splitting method.
if rest[0] == '"' and rest[-1] == '"':
...
And this can be moved to a rest-extracting method:
if not rest or ord(rest[0]) > 32:
E_CONF_BAD_LINE(where, startswith=text[0:16])
return
for idx, ch in enumerate(rest):
if ord(ch) > 32:
break
else:
# Nothing after the #include/#tryinclude/#exec.
E_CONF_BAD_LINE(where, startswith=text[0:16])
return
if (not all(i == ' ' for i in rest[0:idx]) and
not all(i == '\t' for i in rest[0:idx])):
W_WSH_CTRL(where)
rest = rest[idx:]
These bits can be easily moved to a separate splitting method.
And this can be moved to a rest-extracting method: