1
1
mirror of https://github.com/github/semantic.git synced 2024-12-22 14:21:31 +03:00

Try to implement reverse d-path endpoint finding.

This commit is contained in:
Rob Rix 2017-03-10 13:52:40 -05:00
parent e2b4b65423
commit 28b5a99333

View File

@ -130,7 +130,15 @@ decompose myers = let ?callStack = popCallStack callStack in case myers of
FindDPath _ Reverse (EditDistance d) (Diagonal k) -> do FindDPath _ Reverse (EditDistance d) (Diagonal k) -> do
v <- gets backward v <- gets backward
eq <- getEq eq <- getEq
return (Endpoint 0 0) let prev = v `at` pred k
let next = v `at` succ k
let xy = if k == negate d || k /= d && x prev < x next
then next
else let x' = succ (x prev) in Endpoint x' (x' - k)
let Endpoint x' y' = slide (negate 1) eq xy
setBackward (v Vector.// [(maxD + k, x')])
return (Endpoint x' y')
where at v k = let x = v ! maxD + delta + k in Endpoint x (x - k)
where (!) = (Vector.!) where (!) = (Vector.!)
EditGraph as bs = editGraph myers EditGraph as bs = editGraph myers