diff --git a/src/Text/Diff/Parse/Internal.hs b/src/Text/Diff/Parse/Internal.hs index 99302b8..715686c 100644 --- a/src/Text/Diff/Parse/Internal.hs +++ b/src/Text/Diff/Parse/Internal.hs @@ -50,12 +50,12 @@ fileDelta = do fileDeltaHeader :: Parser (FileStatus, Text, Text) fileDeltaHeader = do _ <- string "diff --git " - source <- path <* space - dest <- path <* endOfLine + _ <- path <* space + _ <- path <* endOfLine status <- fileStatus _ <- option "" (string "index" >> takeLine) - _ <- option "" (string "--- " >> takeLine) - _ <- option "" (string "+++ " >> takeLine) + source <- string "--- " >> path <* endOfLine + dest <- string "+++ " >> path <* endOfLine return $ (status, source, dest) takeLine :: Parser Text @@ -97,3 +97,4 @@ annotation :: Parser Annotation annotation = (char '+' >> return Added) <|> (char '-' >> return Removed) <|> (char ' ' >> return Context) + <|> (char '#' >> return Comment) diff --git a/src/Text/Diff/Parse/Types.hs b/src/Text/Diff/Parse/Types.hs index a658ae4..3901575 100644 --- a/src/Text/Diff/Parse/Types.hs +++ b/src/Text/Diff/Parse/Types.hs @@ -2,7 +2,7 @@ module Text.Diff.Parse.Types where import Data.Text (Text) -data Annotation = Added | Removed | Context deriving (Show, Eq) +data Annotation = Added | Removed | Context | Comment deriving (Show, Eq) data Line = Line { lineAnnotation :: Annotation