lambdoc
lambdoc copied to clipboard
Error reporting improvements
I like the error messages from Lambtex more than the LaTeX ones already, and the highlighting is definetely useful, but here are a few things to make them even better:
- lambcmd's stderr is completely silent, and I was surprised at first that I got the error messages in the output document. It would be useful to show some minimal output on stderr, for example:
Failed to process '%s': %d errors encountered, see '%s' for details
- The error messages show just line numbers, however in some situations line1:column1 -- line2:column2 highlighted ranges would be more useful (got used to these kinds of messages from the OCaml compiler)
- When the wrapper block doesn't find the nested block it expects, or finds the wrong nested block it just prints
syntax error
. Please provide some hints in this case on what is wrong, for example:
\begin{bib}
\what{x}
\where{y}
\end{bib}
the bib block at line X requires \who, \what, and \where, but you didn't provide the \what command.
\begin{bib}
\picture{x}{y}
\who{z}
\what{x}
\where{y}
\end{bib}
the command \picture is not valid inside a bib block, valid commands are: \who, \what, \where
\subtitle{
\begin{foo}
\end{foo}
}
you cannot start a block command in an inline context, inline context started by \subtitle at line X.
* runaway/missing end block detection could be improved for `source` blocks, for example instead of just reporting a syntax error at EOF here:
\begin{printout} \begin{source} abc \end{listing} \end{printout}
some more stuff EOF
a better error message would be:
`block 'source' is open at line X, but never closed.`
* similar improvements should be made to detect missing `}` for inline commands, for example `\tt{`.
I'm aware of that syntax errors are obtuse, though fixing them may not be easy with the current Menhir-based parser. For this and other reasons, I'm seriously considering rewriting the Lambtex parser using a different technology...