1
1
mirror of https://github.com/github/semantic.git synced 2025-01-03 21:16:12 +03:00

Add some context comments about the problem cases.

This commit is contained in:
Rob Rix 2016-03-31 14:45:19 -04:00
parent 2da930ae53
commit 5732aa30c8

View File

@ -165,6 +165,60 @@ group2 ranges child | Just (headRanges, tailRanges) <- unconsThese ranges
atRight (Join (These as (b:bs))) = Join (These as bs)
atRight (Join (That (b:bs))) = Join (That bs)
atRight other = other
{-
find all of the lines which intersect with this child, not all the children intersecting with this line?
[ foo ] [
foo
]
[ Join These "[ foo ]" "[\n"]
[ Join That "foo\n"]
[ Join That "]"]
[ Range 2 5 ] [ Range 2 5 ]
[ Range 0 7 ] [ Range 0 2, Range 2 6, Range 6 7 ]
[ foo ]
bar
[
foo
]
bar
[ foo ] [
foo
]
bar bar
[ Range 0 8, Range 8 12 ] [ Range 0 2, Range 2 6, Range 6 8, Range 8 12 ]
[ foo ] [
bar foo
]
bar
1. we need to consume lines until the childs lines have been exhausted
2. (AND all the children intersecting the line have been consumed)
-[ foo ]
+[
+foo
+]
bar
-}
maybeThese :: (Maybe a, Maybe b) -> Maybe (These a b)
maybeThese (Just a, Just b) = Just (These a b)
maybeThese (Just a, _) = Just (This a)