Changes between Version 1 and Version 6 of Ticket #10

Show
Ignore:
Timestamp:
10/16/12 09:55:31 (23 months ago)
Author:
SimonHengel
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #10

    • Property status changed from new to assigned
    • Property summary changed from Starting the module with -- | doc followed by declaration doesn't parse to Modules without an explicit module declaration can not be parsed
    • Property priority changed from minor to major
    • Property milestone changed from to _|_
    • Property owner set to SimonHengel
  • Ticket #10 – description

    v1 v6  
    1 Parser bug: starting the module with '-- | doc' followed by a declaration doesn't parse, because the '-- | doc' is interpreted as the module documentation (the GHC grammar has an S/R conflict because of this). 
     1If a module does not contain an explicit module declaration 
     2'''and''' starts with 
     3{{{ 
     4-- | some comment 
     5}}} 
     6then parsing fails. 
    27 
    3 This could be fixed if we parse Haddock comments separately from the Haskell code, and match up Haddock comments with AST nodes in a later step. 
     8This is a bug in GHC's parser.  It is only triggered if 
     9[http://www.haskell.org/ghc/docs/latest/html/libraries/ghc/DynFlags.html#v:Opt_Haddock Opt_Haddock] is used. 
     10 
     11=== Details === 
     12GHC's parser has a rule for Haddock comments on the module headers. 
     13When the parser sees the Haddock comment at the 
     14beginning it then wants the next declaration to be a module header 
     15(the GHC grammar has an S/R conflict because of this). 
     16 
     17One possible solution could be to parse Haddock comments separately from the Haskell code, and match up Haddock comments with AST nodes in a later step. 
     18 
     19=== Steps to reproduce === 
     20{{{ 
     21-- | Hi there 
     22main = print "Hello World!" 
     23}}} 
     24 
     25Running 
     26{{{ 
     27$ haddock Main.hs 
     28}}} 
     29fails with: 
     30{{{ 
     31Main.hs:2:1: parse error on input `main' 
     32}}} 
     33 
     34In contrast both of the following example work just fine: 
     35 
     36{{{ 
     37{- 
     38Hi there 
     39-} 
     40main = print "Hello World!" 
     41}}} 
     42{{{ 
     43foo = 23 
     44-- | Hi there 
     45main = print "Hello World!" 
     46}}}