[project @ 2001-09-20 16:01:53 by rje]
authorrje <unknown>
Thu, 20 Sep 2001 16:01:53 +0000 (16:01 +0000)
committerrje <unknown>
Thu, 20 Sep 2001 16:01:53 +0000 (16:01 +0000)
Now has better handling of comments.

Not a big deal, but means we don't get as many false definitions caused
by parsing comments.

ghc/utils/hasktags/HaskTags.hs

index de2dd4e..0ae678f 100644 (file)
@@ -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 [] = []