1
1
mirror of https://github.com/github/semantic.git synced 2024-11-25 11:04:00 +03:00

Patches are constructed over Source Chars.

This commit is contained in:
Rob Rix 2015-12-24 16:37:14 -05:00
parent 0866ef52bd
commit 5257089ad4

View File

@ -4,9 +4,10 @@ module PatchOutput (
) where
import Diff
import Source hiding ((++))
import Control.Monad.Free
patch :: Diff a Info -> String -> String -> String
patch :: Diff a Info -> Source Char -> Source Char -> String
patch diff sourceA sourceB = mconcat $ show <$> hunks diff sourceA sourceB
data Hunk = Hunk Int Int [Line]
@ -26,7 +27,7 @@ header (Hunk offsetA offsetB lines) = "@@ -" ++ show offsetA ++ "," ++ show coun
data Line = Insert String | Delete String | Context String
deriving (Show, Eq)
hunks :: Diff a Info -> String -> String -> [Hunk]
hunks :: Diff a Info -> Source Char -> Source Char -> [Hunk]
hunks diff sourceA sourceB = case diff of
Pure patch -> []
Free (Annotated (a, b) syntax) -> []