mirror of
https://github.com/github/semantic.git
synced 2024-12-22 14:21:31 +03:00
Split the body of spanAndSplitFirstLines onto a newline and dedent.
This commit is contained in:
parent
b8bc77bb7f
commit
0ea6286197
@ -155,12 +155,13 @@ group2 ranges children | Just (headRanges, tailRanges) <- unconsThese ranges
|
||||
|
||||
spanAndSplitFirstLines :: (Join These a -> Join These Bool) -> [[Join These a]] -> ([(Join These a, [Join These a])], [[Join These a]])
|
||||
spanAndSplitFirstLines pred = foldr go ([], [])
|
||||
where go (first : rest) (intersecting, nonintersecting) =
|
||||
let ~(l, r) = split first in case fromThese False False . runJoin $ pred first of
|
||||
(True, True) -> ((first, rest) : intersecting, nonintersecting)
|
||||
(True, False) -> ((head l, r ++ rest) : intersecting, nonintersecting)
|
||||
(False, True) -> ((head r, l ++ rest) : intersecting, nonintersecting)
|
||||
_ -> (intersecting, (first : rest) : nonintersecting)
|
||||
where go child (intersecting, nonintersecting)
|
||||
| (first : rest) <- child = let ~(l, r) = split first in
|
||||
case fromThese False False . runJoin $ pred first of
|
||||
(True, True) -> ((first, rest) : intersecting, nonintersecting)
|
||||
(True, False) -> ((head l, r ++ rest) : intersecting, nonintersecting)
|
||||
(False, True) -> ((head r, l ++ rest) : intersecting, nonintersecting)
|
||||
_ -> (intersecting, (first : rest) : nonintersecting)
|
||||
|
||||
-- | Partitions and splits a list of children into a tuple consisting of:
|
||||
-- | - elements which matched; if an element matches only partially this field will contain only the matching side
|
||||
|
Loading…
Reference in New Issue
Block a user