From: rje Date: Thu, 20 Sep 2001 16:01:53 +0000 (+0000) Subject: [project @ 2001-09-20 16:01:53 by rje] X-Git-Tag: Approximately_9120_patches~945 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=3ff555368ff055bd07eef9131c9ef96ea2346106;p=ghc-hetmet.git [project @ 2001-09-20 16:01:53 by rje] Now has better handling of comments. Not a big deal, but means we don't get as many false definitions caused by parsing comments. --- diff --git a/ghc/utils/hasktags/HaskTags.hs b/ghc/utils/hasktags/HaskTags.hs index de2dd4e..0ae678f 100644 --- a/ghc/utils/hasktags/HaskTags.hs +++ b/ghc/utils/hasktags/HaskTags.hs @@ -48,6 +48,7 @@ data FoundThing = FoundThing ThingName Pos -- Data we have obtained from a file data FileData = FileData FileName [FoundThing] + deriving Show data Token = Token String Pos deriving Show @@ -121,13 +122,15 @@ withline filename words fullline i = -- comments stripping stripslcomments :: [String] -> [String] -stripslcomments ("--":xs) = [] -stripslcomments (x:xs) = x : stripslcomments xs +stripslcomments (x:xs) | isPrefixOf "--" x = [] + | otherwise = x : stripslcomments xs stripslcomments [] = [] stripblockcomments :: [Token] -> [Token] -stripblockcomments ((Token "\\end{code}" _):xs) = afterlitend xs -stripblockcomments ((Token "{-" _):xs) = afterblockcomend xs +stripblockcomments ((Token "\\end{code}" _):xs) = + stripblockcomments $ afterlitend xs +stripblockcomments ((Token "{-" _):xs) = + stripblockcomments $ afterblockcomend xs stripblockcomments (x:xs) = x:stripblockcomments xs stripblockcomments [] = []