diff options
author | Alexander Foremny <aforemny@posteo.de> | 2023-10-02 17:43:43 +0200 |
---|---|---|
committer | Alexander Foremny <aforemny@posteo.de> | 2023-10-02 17:43:44 +0200 |
commit | 57211d26ebbd9567298c6d7b8d1581929641c00f (patch) | |
tree | 385a7cb047e96a190ccba942a01a6d89f6075c2f | |
parent | 7a28d54b4def6e572c158ad2eb29804c0e57793d (diff) |
fix match merging
-rw-r--r-- | app/Main.hs | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/app/Main.hs b/app/Main.hs index 74739b8..abc8d4c 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -25,7 +25,7 @@ -- -- Only the first TODO/FIXME inside a comment block should be considered -- as the start of an issue. --- + -- TODO Add support for other keywords -- -- Additionally to TODO, also FIXME should start an issue. There might @@ -222,9 +222,15 @@ fixTreeGrepper treeGrepperResult = mergeMatches matches = Maybe.catMaybes [ subs ms - | ms <- L.groupBy eq matches + | ms <- groupBy eq matches ] - eq m n = m.end.row + 1 <= n.start.row + groupBy p xs = reverse (map reverse (groupBy' [] p xs)) + groupBy' as p [] = as + groupBy' [] p (x : xs) = groupBy' [[x]] p xs + groupBy' (ass@((a : as) : rs)) p (x : xs) + | p a x = groupBy' ((x : a : as) : rs) p xs + | otherwise = groupBy' ([x] : ass) p xs + eq m n = m.end.row + 1 == n.start.row subs [] = Nothing subs (mss@(m : _)) = Just |