AmpersandTarski / Ampersand

Build database applications faster than anyone else, and keep your data pollution free as a bonus.
http://ampersandtarski.github.io/
GNU General Public License v3.0
40 stars 8 forks source link

Superfluous quote does not result in proper error message #923

Closed RieksJ closed 5 years ago

RieksJ commented 5 years ago

Using Ampersand-v3.15.0 [development:a84500c99], I compiled the following script

CONTEXT Issue923

r :: A*A

RULE "R": r = -r 
VIOLATION (TXT "Source atom: ", SRC I, TXT ", Target atom:", TGT I")

ENDCONTEXT

This resulted in the following output:

C:\Ampersand\Git\ssif\Issue.adl:6:67 error:

While this output correctly points to the location of an error in the script, it does not provide any clue whatsoever about what the error might be.

I expect all errors to provide a message/clue that helps the user to correct the cause of the error. In this case, a text such as 'supurfluous quote (") encountered, please remove it' would have been appropriate.

stefjoosten commented 5 years ago

Analysis

Hm, this is funny. I have reproduced this error with Ampersand-v3.16.0 [development:b2677277b]. However, the error message should have been:

Lexer error at line 6:67, file C:\Ampersand\Git\ssif\Issue.adl
  Unterminated string literal
    Correct examples of Strings: "Ampersand (&) is cool" "Helium is cool too!" "abc\ndef" ""
    This error may be caused by a missing quote-character ('"'), or by the inadvertent use of the escape character ('\').

I produced the correct message in http://ampersand.tarski.nl/RAP3, which is a not-too-old version of Ampersand (I think around October 2018). So this bug must be recent.

hanjoosten commented 5 years ago

Yes, this is a recent bug. It is something introduced while building the daemon. The daemon required uniform error messages. The typechecking errors were the only uniform errors. I made lexer errors and parser errors to comply with that same form. Obviously, something went wrong there. The good news is, that the error message is still given. However, this seems to be limited to only the first line of the message. I expect to fix this shortly.