From 3ff555368ff055bd07eef9131c9ef96ea2346106 Mon Sep 17 00:00:00 2001 From: rje Date: Thu, 20 Sep 2001 16:01:53 +0000 Subject: [PATCH] [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. --- ghc/utils/hasktags/HaskTags.hs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) 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 [] = [] -- 1.7.10.4