darioteixeira / lambdoc

Lambdoc is a library providing support for semantically complex documents in Ocsigen web applications
GNU General Public License v2.0
17 stars 1 forks source link

Error reporting improvements #18

Open edwintorok opened 9 years ago

edwintorok commented 9 years ago

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:

\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{`.
darioteixeira commented 9 years ago

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...