X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=compiler%2Fparser%2FHaddockLex.x;h=da6dbd37065f2f8e5c2aff30c9fd8feb1118a711;hp=d9b4c03b19160133a2b483b4691f8a60066ea9c6;hb=8a25c54e2df36b3fb40436e5b887dddc3c64ab54;hpb=2b6e4da63cfb4aba7b0d8ac13f4baee2e6ed38bf diff --git a/compiler/parser/HaddockLex.x b/compiler/parser/HaddockLex.x index d9b4c03..da6dbd3 100644 --- a/compiler/parser/HaddockLex.x +++ b/compiler/parser/HaddockLex.x @@ -7,7 +7,7 @@ -- { -{-# OPTIONS -w #-} +{-# OPTIONS -Wwarn -w #-} -- The above warning supression flag is a temporary kludge. -- While working on this module you are encouraged to remove it and fix -- any warnings in the module. See @@ -26,7 +26,7 @@ import RdrName import SrcLoc import DynFlags -import Char +import Data.Char import Numeric import System.IO.Unsafe } @@ -63,7 +63,7 @@ $ident = [$alphanum \'\_\.\!\#\$\%\&\*\+\/\<\=\>\?\@\\\\\^\|\-\~] () { begin string } } - .* \n? { strtoken TokBirdTrack `andBegin` line } + .* \n? { strtokenNL TokBirdTrack `andBegin` line } { $special { strtoken $ \s -> TokSpecial (head s) } @@ -78,7 +78,7 @@ $ident = [$alphanum \'\_\.\!\#\$\%\&\*\+\/\<\=\>\?\@\\\\\^\|\-\~] -- allow special characters through if they don't fit one of the previous -- patterns. [\/\'\`\<\#\&\\] { strtoken TokString } - [^ $special \/ \< \# \n \'\` \& \\ \]]* \n { strtoken TokString `andBegin` line } + [^ $special \/ \< \# \n \'\` \& \\ \]]* \n { strtokenNL TokString `andBegin` line } [^ $special \/ \< \# \n \'\` \& \\ \]]+ { strtoken TokString } } @@ -141,8 +141,11 @@ andBegin act new_sc = \str _ cont -> act str new_sc cont token :: Token -> Action token t = \_ sc cont -> t : cont sc -strtoken :: (String -> Token) -> Action +strtoken, strtokenNL :: (String -> Token) -> Action strtoken t = \str sc cont -> t str : cont sc +strtokenNL t = \str sc cont -> t (filter (/= '\r') str) : cont sc +-- ^ We only want LF line endings in our internal doc string format, so we +-- filter out all CRs. begin :: StartCode -> Action begin sc = \_ _ cont -> cont sc