Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#371, fix multiline LANGUAGE pragmas #408

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

bravit
Copy link

@bravit bravit commented May 6, 2018

The following code (multiline LANGUAGE pragma with lines started with non-whitespace characters) :

{-# LANGUAGE
BangPatterns,
MagicHash
,OverloadedStrings
,  LambdaCase
  #-}

makes lexer to insert ; in the beginning of every line. This can be fixed by workaround in the parser. The first attempt was made in #217, here I follow the same approach.

bravit added 2 commits May 6, 2018 16:00
Previously pragma lines started with non-whitespace characters at the
first column produced ParseError.
@mpickering
Copy link
Collaborator

I don't think this is right as you can't write

{-# LANGUAGE  RecordWildCard;, TemplateHaskell #-}

test.hs:1:30: error:
    Cannot parse LANGUAGE pragma
    Expecting comma-separated list of language options,
    each starting with a capital letter
      E.g. {-# LANGUAGE TemplateHaskell, GADTs #-}
  |
1 | {-# LANGUAGE  RecordWildCards;, TemplateHaskell #-}
  |                              ^
Failed, no modules loaded.
Prelude> Leaving GHCi.

This is a bug in the lexer which I have not being able to fix, similar to all the other issues tagged with "layout" https://github.com/haskell-suite/haskell-src-exts/issues?q=is%3Aissue+is%3Aopen+label%3Alayout

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants