Handle haddock headers when looking for LANGUAGE/OPTIONS_GHC pragmas
authorIan Lynagh <igloo@earth.li>
Wed, 7 Jul 2010 12:04:23 +0000 (12:04 +0000)
committerIan Lynagh <igloo@earth.li>
Wed, 7 Jul 2010 12:04:23 +0000 (12:04 +0000)
compiler/main/HeaderInfo.hs
compiler/parser/Lexer.x

index 5a75ed3..cf61b8c 100644 (file)
@@ -228,6 +228,9 @@ getOptions' toks
           parseToks (open:xs)
               | ITlanguage_prag <- getToken open
               = parseLanguage xs
+          parseToks (x:xs)
+              | ITdocCommentNext _ <- getToken x
+              = parseToks xs
           parseToks _ = []
           parseLanguage (L loc (ITconid fs):rest)
               = checkExtension (L loc fs) :
index 4ce8304..fdf4bdd 100644 (file)
@@ -285,7 +285,7 @@ $tab+         { warn Opt_WarnTabs (text "Tab character") }
 
 -- Haddock comments
 
-<0> {
+<0,option_prags> {
   "-- " $docsym      / { ifExtension haddockEnabled } { multiline_doc_comment }
   "{-" \ ? $docsym   / { ifExtension haddockEnabled } { nested_doc_comment }
 }