The option parser is currently very bad at error handling in general. Without
having looked at this precise issue in detail, I would recommend against trying
to patch the many holes in the error handling individually, hole by hole.
Instead, I think this is one of the cases where a complete reimplementation of
the text-handling side of things would be good, using a more principled parsing
approach based on tokenization and constructing syntax trees based on a formal
grammar. This is not particularly difficult, and I am happy to advise, but also
I think this is low priority.
|