aboutsummaryrefslogtreecommitdiffstats
path: root/app/Main.hs
diff options
context:
space:
mode:
authorLibravatar Alexander Foremny <aforemny@posteo.de>2023-10-02 17:43:43 +0200
committerLibravatar Alexander Foremny <aforemny@posteo.de>2023-10-02 17:43:44 +0200
commit57211d26ebbd9567298c6d7b8d1581929641c00f (patch)
tree385a7cb047e96a190ccba942a01a6d89f6075c2f /app/Main.hs
parent7a28d54b4def6e572c158ad2eb29804c0e57793d (diff)
fix match merging
Diffstat (limited to 'app/Main.hs')
-rw-r--r--app/Main.hs12
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