Ticket #33 (closed bug report: fixed)

Opened 8 years ago

Last modified 8 years ago

Parse failure on closing #-} at start of line

Reported by: anonymous Owned by: nibro
Priority: minor Milestone: Full code support
Component: parser Version:
Keywords: pragma, literate Cc:


A parse failure is reported on line two of this literate Haskell test file:

> {-# LANGUAGE MultiParamTypeClasses
> #-}
> f :: Int
> f = 4

ghc accepts this file without error. However, after removing the bird tracks ghc gives a parse error as well. So it is not necessarily clear if this is a bug in hs-src-exts or just ghc being slightly liberal.

Change History

Changed 8 years ago by nibro

  • status changed from new to closed
  • resolution set to fixed

I've done two things to fix this.

First, I've made parseFile and friends slightly less clever, by only masking out #-lines on the first line. This means a lot of CPP files will break - but those should break, HSE doesn't and shouldn't handle CPP files anyway.

Second, I've allowed optsemis before the close bracket for top-level pragmas, which means it's fine layout-wise for the close bracket to begin the line.

This already works for RULES/WARNING/DEPRECATED pragmas since they include semis as it is. It doesn't work, and I haven't fixed it, for INLINE/SPECIALISE, I'll do that if it ever comes up.

Case closed, for now at least.

Note: See TracTickets for help on using tickets.