mirror of
https://github.com/github/semantic.git
synced 2024-12-01 00:33:59 +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))
|
||||
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
|
||||
where
|
||||
contextRows = uncurry rowFromMaybeRows <$> zipMaybe leftElements rightElements
|
||||
leftElements = Text <$> lines (substring (Range previousLeft $ end left) before)
|
||||
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
|
||||
(childRows, (leftChildRange, rightChildRange)) = diffToRows child before after
|
||||
contextRows = uncurry rowFromMaybeRows <$> zipMaybe leftElements rightElements
|
||||
|
Loading…
Reference in New Issue
Block a user