Menu

#460 Wrong error message in FSPEC generator when parsing LaTeXts

new
nobody
None
<not fixed>
Functional specification generator
low
bug
2015-02-09
2015-02-07
Rieks
No

Consider the following script

CONTEXT GRCengine IN ENGLISH LATEX
PURPOSE CONTEXT GRCengine
{+The purpose of this script is [fill in]
\begin{itemize}
\item first item
\item second item
\and{itemize}
-}
ENDCONTEXT

When trying to create an FSPEC, it produces the following text:

ampersand.exe:
Error at "source" (line 6, column 1):
unexpected end of input
expecting white space, "%", new-line, "\\", "{", "-", "``", "\8220", "\"`", "\"", "`", "\
8216", "''", "\8221", "'", "\8217", "~", "$$", "$", "^", "_", "^^", "&" or \end{itemize}

^

Note that line 6 is the line that says

\item second item

There is nothing wrong with this line

The error is in the next line (line 7)

It would be nice to have a better error message, that provides the correct line.
Also, since this code appears to only be parsed in the FSPEC generator (you can create a prototype with this text without any problem), it would be nice to say something about the specifics of this in the error message as well.

Discussion

  • Han Joosten

    Han Joosten - 2015-02-08

    Hmm. Nice catch! This is what currently happens:
    The string inbetween the {- and -} symbols is parsed by another parser. (It comes from the Pandoc library). That parser is unaware of anything 'outside' the {+ and -} symbols. So when it mentions a line number, the numbers are counting from the {+ symbol. So in this case it says 'end of line, line 6, column 1. Acually, line 6, when counting from the {+ symbol, is at the -} symbol. (acual line 8). And for the modeller, there is no end of file there at all! From the Ampersand's modeller point of view, this is very confusing!

    There are several problems with the thrown error message:

    1. The error is thrown in a non-controlled way. (as haskell error, not as an ampersand CtxErr). As a consequence, we (the Ampersand team) cannot change the actual message
    2. The line numbering is relative to the start of the Pandoc string, not relative to the start of the file
    3. There could be anything in the message that has to be read in the context of whatever is inbetween {+ and -}. (eg. 'end of input'). Ampersand would have to interpret these error messages in order to give non-confusing ones to the modeller.

    As the indicated priority is already low, do not expect anything to change soon wrt. pandoc parser error messages.

     
    • Rieks

      Rieks - 2015-02-08

      it would already help if Ampersand mentioned that the error message was generated by Pandoc,so you know you have at least some clue, e.g. in cases where this error occurs somwhere in the middle of a large file.

       

      Last edit: Martijn Schrage 2015-02-20
  • Martijn Schrage

    Martijn Schrage - 2015-02-09

    Dit kan aangepakt worden door de output van pandoc te seq'en en daar een catch omheen te zetten. Dan is in ieder geval duidelijk dat de fout niet van Ampersand is.

    PS bij het beantwoorden van tickets per mail reply is het slim om de gequote vorige mails te verwijderen, aangezien die anders allemaal meerdere keren in het ticket terechtkomen. (zie hierboven)