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

Parse error with LANGUAGE pragma #217

Closed
ndmitchell opened this issue May 1, 2015 · 3 comments
Closed

Parse error with LANGUAGE pragma #217

ndmitchell opened this issue May 1, 2015 · 3 comments

Comments

@ndmitchell
Copy link
Contributor

Given:

{-# LANGUAGE
RecordWildCards
 #-}
main = print "hello"

This works in GHC, but raises a parse error in HSE. Note that #-} line is indented by one space - that's important or it's a parse error in GHC too. Originally from ndmitchell/hlint#125

@mpickering
Copy link
Collaborator

This is the same as #228

The lexer injects a semi colon before RecordWildCards as it is in the same column as the {-# above.

@pjonsson
Copy link
Contributor

pjonsson commented Aug 4, 2015

I don't think it's the same problem. The lexer should insert a semicolon in this case but our parser doesn't expect to find a semicolon in the middle of a language pragma. GHC has something similar in the grammar for deprecations to this:

> conids    :: { ([Name L],[S]) }
>          : conids ',' conid                  { (fst $1 ++ [$3], snd $1 ++ [$2]) }
>          | optsemis conid                    { ([$2],[]) }

pjonsson added a commit that referenced this issue Aug 5, 2015
@pjonsson
Copy link
Contributor

pjonsson commented Aug 5, 2015

Fixed with 52d1967.

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

No branches or pull requests

3 participants