mirror of
https://github.com/github/semantic.git
synced 2024-12-01 09:15:01 +03:00
Use starts/ends.
This commit is contained in:
parent
f76335f38a
commit
563973e210
@ -46,13 +46,13 @@ annotatedToRows (Annotated (Info left _ leftCategories, Info right _ rightCatego
|
|||||||
|
|
||||||
annotatedToRows (Annotated (Info left _ leftCategories, Info right _ rightCategories) (Indexed i)) before after = (bimap (Ul $ classify leftCategories) (Ul $ classify rightCategories) <$> rows, (left, right))
|
annotatedToRows (Annotated (Info left _ leftCategories, Info right _ rightCategories) (Indexed i)) before after = (bimap (Ul $ classify leftCategories) (Ul $ classify rightCategories) <$> rows, (left, right))
|
||||||
where
|
where
|
||||||
rows = appendRemainder $ foldl sumRows ([], (start left, start right)) i
|
rows = appendRemainder $ foldl sumRows ([], starts left right) i
|
||||||
appendRemainder (rows, (previousLeft, previousRight)) = adjoinRows rows contextRows
|
appendRemainder (rows, (previousLeft, previousRight)) = adjoinRows rows contextRows
|
||||||
where
|
where
|
||||||
contextRows = uncurry rowFromMaybeRows <$> zipMaybe leftElements rightElements
|
contextRows = uncurry rowFromMaybeRows <$> zipMaybe leftElements rightElements
|
||||||
leftElements = Text <$> lines (substring (Range previousLeft $ end left) before)
|
leftElements = Text <$> lines (substring (Range previousLeft $ end left) before)
|
||||||
rightElements = Text <$> lines (substring (Range previousRight $ end right) after)
|
rightElements = Text <$> lines (substring (Range previousRight $ end right) after)
|
||||||
sumRows (rows, (previousLeft, previousRight)) child = (rows `adjoinRows` contextRows `adjoinRows` childRows, (end leftChildRange, end rightChildRange))
|
sumRows (rows, (previousLeft, previousRight)) child = (rows `adjoinRows` contextRows `adjoinRows` childRows, ends leftChildRange rightChildRange)
|
||||||
where
|
where
|
||||||
(childRows, (leftChildRange, rightChildRange)) = diffToRows child before after
|
(childRows, (leftChildRange, rightChildRange)) = diffToRows child before after
|
||||||
contextRows = uncurry rowFromMaybeRows <$> zipMaybe leftElements rightElements
|
contextRows = uncurry rowFromMaybeRows <$> zipMaybe leftElements rightElements
|
||||||
|
Loading…
Reference in New Issue
Block a user