Opened 3 years ago

Closed 3 years ago

#5204 closed feature request (fixed)

request better error message for malformed quasiquoted declaration

Reported by: nr Owned by:
Priority: normal Milestone: 7.4.1
Component: Compiler (Parser) Version: 7.0.3
Keywords: quasiquotation, pads-haskell Cc: mainland@…
Operating System: Linux Architecture: x86
Type of failure: Other Difficulty:
Test Case: quasiquotation/T5204 Blocked By:
Blocking: Related Tickets:

Description

I closed a quasiquoted declaration form incorrectly (] rather than |]) and the error message I received was not enough to able me to diagnose the problem. The message I received was

Pnm.hs:40:1:
   lexical error in string/character literal at end of input

And I think a more appropriate message would be along the lines of "quasiquoted declaration that begins at line 17 was not terminated."

(I have listed "compiler" as the component but perhaps it should be "template haskell" instead?)

Attachments (3)

Pnm.hs (1.3 KB) - added by nr 3 years ago.
file that triggers error message (may require pads-haskell-0.2, available from kathleen fisher or john launchbury)
0001-Give-a-better-error-message-for-unterminated-quasiqu.patch (1.8 KB) - added by gmainland 3 years ago.
0001-Add-test-case-for-5204.patch (2.7 KB) - added by gmainland 3 years ago.
Add test case for #5204.

Download all attachments as: .zip

Change History (9)

Changed 3 years ago by nr

file that triggers error message (may require pads-haskell-0.2, available from kathleen fisher or john launchbury)

comment:1 Changed 3 years ago by nr

pads-haskell-0.2 can be downloaded from

https://files.me.com/kathleen.fisher/qp9371

comment:2 Changed 3 years ago by igloo

  • Component changed from Compiler to Compiler (Parser)
  • Milestone set to 7.4.1

comment:3 Changed 3 years ago by gmainland

You're right, this is a terrible error message and it's my fault. The attached patch gives this error message instead:

Pnm.hs:17:7: unterminated quasiquotation at end of input

comment:4 Changed 3 years ago by simonpj

Thanks. I'll apply. Can you make a test pls?

S

comment:5 Changed 3 years ago by gmainlan@…

commit 20548c92fb307fc012956c66efa9164843d921c7

Author: Geoffrey Mainland <gmainlan@microsoft.com>
Date:   Thu Sep 29 12:31:49 2011 +0100

    Give a better error message for unterminated quasiquotations (fixes #5204).

 compiler/parser/Lexer.x |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

Changed 3 years ago by gmainland

Add test case for #5204.

comment:6 Changed 3 years ago by simonpj

  • Resolution set to fixed
  • Status changed from new to closed
  • Test Case changed from attached to ticket to quasiquotation/T5204
Note: See TracTickets for help on using tickets.