Ticket #210 (new bug report)

Opened 4 years ago

Last modified 4 years ago

Parse errors when TransformListComp extension is enabled

Reported by: iago Owned by: nibro
Priority: major Milestone:
Component: parser Version: 1.10.0
Keywords: Cc:

Description

I'm experiencing many strange parse errors when parsing with all extensions enabled:

Parse error: l-i
Parse error: m-n
Parse error in expression: off_b +
Parse error: group
...

I know the code is fine because it actually compiles, the only thing I do before parse these files with haskell-src-exts is to run cpphs --noline over them, the output of cpphs is what I'm parsing.

I was able to isolate one of these faults (I could take a look on others if that helps):

The following module

Prelude Language.Haskell.Exts> f
"module Bar where\n\nimport Data.List ( group )\n\n"

is not correctly parsed when all known extensions are activated

Prelude Language.Haskell.Exts> parseModuleWithMode (defaultParseMode{extensions=knownExtensions}) f
ParseFailed (SrcLoc {srcFilename = "<unknown>.hs", srcLine = 3, srcColumn = 20}) "Parse error: group"

but parsing without any extension enabled works

Prelude Language.Haskell.Exts> parseModule f
ParseOk (Module (SrcLoc {srcFilename = "<unknown>.hs", srcLine = 1, srcColumn = 1}) (ModuleName "Bar") [] Nothing Nothing [ImportDecl {importLoc = SrcLoc {srcFilename = "<unknown>.hs", srcLine = 3, srcColumn = 1}, importModule = ModuleName "Data.List", importQualified = False, importSrc = False, importPkg = Nothing, importAs = Nothing, importSpecs = Just (False,[IVar (Ident "group")])}] [])

Note: The exact version is the 1.10.1.

Change History

follow-up: ↓ 2   Changed 4 years ago by iago

If I remove some extensions (I was just playing because I know I don't need them) then it works like a dream

knownExtensions \\ [NoImplicitPrelude,TransformListComp,XmlSyntax] 

The problem may be the TransformListComp extension, since in addition to group I also see some errors mentioning by ... which become new keywords (in the context of list comprehensions) when that extension is enabled.

in reply to: ↑ 1   Changed 4 years ago by iago

  • summary changed from Parse errors when all extensions enabled to Parse errors when TransformListComp extension is enabled

Replying to iago:

If I remove some extensions (I was just playing because I know I don't need them) then it works like a dream {{{ knownExtensions \\ [NoImplicitPrelude?,TransformListComp?,XmlSyntax?] }}} The problem may be the TransformListComp extension, since in addition to group I also see some errors mentioning by ... which become new keywords (in the context of list comprehensions) when that extension is enabled.

Sorry, it does not work like a dream, it just works "better" (no more parse errors related with group or by). I think I will try to isolate the cause of the other parse errors and open a bug report for each one.

Note: See TracTickets for help on using tickets.