
#8226: Remove the old style -- # Haddock comments. -------------------------------------+------------------------------------ Reporter: Fuuzetsu | Owner: adinapoli Type: task | Status: new Priority: normal | Milestone: 7.10.1 Component: Compiler | Version: 7.7 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------ Comment (by adinapoli): Replying to [comment:8 Fuuzetsu]:
Hm, I'm unsure why this is proving difficult to implement.
Oh, it's easy, that's because it's my first foray into GHC and its Lexer hacking ever :)
* Remove {{{#}}} from any sections lexing Haddock comment so sections
like {{{[$docSym \#]}}} become just {{{[$docSym]}}} or whatever the appropriate syntax is there.
* in {{{
}}} remove the lexing of {{{-- #}}} all together. * Remove {{{ITdocOptionsOld}}}.
* inside {{{isNormalComment}}}, I'm unsure exactly how to proceed. You
say removing {{{#}}} from {{{notFollowedByDocOrPragma}}} stops {{{RULES}}} from working. In that case I say keep it there as it is now, in the end it does not matter because we'll stop treating it as a Haddock thing anyway. It will now simply check whether a {{{#}}} comment is special for {{{RULES}}} instead of for both {{{RULES}}} and Haddock. This is an assumption however so this might be where I'm going wrong.
* {{{withLexedDocType}}} remove the case for {{{'#'}}}: if we removed
the case for {{{-- #}}} in {{{
* Remove the case in for {{{ITdocOptionsOld}}} in {{{getOptions'}}} in
{{{HeaderInfo.hs}}}.
Apart from the docSym section I already tried was you said, with no luck. This is a gist to a patch which follows your guidelines; unless I have tweaked the wrong things, it should roughly do what you listed: https://gist.github.com/adinapoli/a08683a32412c8fddb43 This validates fine but it doesn't fix the problem! If I try the "Fail.hs" example attached in the ticket, the Lexer still chokes on that comment which "looks like a pragma". But originally my fix on "isNormalComment" fixed that, but amusingly if I tweak that function, as part of this patch, it triggers the problem I've reported, aka the RULES gets interpreted as comments and validate fails due to warnings for unutilized functions. Where's the flaw in my reasoning? :)
PS: It'd be great if you could create a wiki page (either on GHC wiki or NixOS wiki) on your workflow on GHC hacking with nix.
More than happy to do so, didn't think was something people would have been interested in :) Alfredo -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8226#comment:11 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler