Popularity
4.1
Stable
Activity
0.0
Stable
7
1
4
Monthly Downloads: 12
Programming language: Haskell
License: GNU Affero General Public License v3.0 only
Tags:
Parsing
Latest version: v0.2.1
diff-parse alternatives and similar packages
Based on the "Parsing" category.
Alternatively, view diff-parse alternatives based on common mentions on social networks and blogs.
-
trifecta
Parser combinators with highlighting, slicing, layout, literate comments, Clang-style diagnostics and the kitchen sink -
incremental-parser
Haskell parsing combinator liibrary that can be fed the input and emit the parsed output incrementally -
record-syntax
A library for parsing and processing the Haskell syntax sprinkled with anonymous records -
antlrc
Haskell binding to the ANTLR parser generator C runtime library http://www.antlr.org/wiki/display/ANTLR3/ANTLR3+Code+Generation+-+C
SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives
Promo
www.saashub.com
Do you think we are missing an alternative of diff-parse or a related project?
README
diff-parse
Simple Haskell library used to parse diff files. Tested with diff files produced by git diff
.
Usage
let testText = unlines ["diff --git a/bar.txt b/bar.txt",
"deleted file mode 100644",
"index 363a6c1..0000000",
"--- a/bar.txt",
"+++ /dev/null",
"@@ -1 +0,0 @@",
"-bar 1",
"diff --git a/baz.txt b/baz.txt",
"deleted file mode 100644",
"index 80ef287..0000000",
"--- a/baz.txt",
"+++ /dev/null",
"@@ -1,2 +0,0 @@",
"-baz 1",
"-baz 2",
"diff --git a/foo.txt b/foo.txt",
"index 9c2a709..9254400 100644",
"--- a/foo.txt",
"+++ b/foo.txt",
"@@ -1,4 +1,5 @@",
"+line 0",
" line 1",
"-line 2",
" line 3",
"+line 3.5",
" line 4",
"\\ No newline at end of file",
"diff --git a/empty.txt b/empty.txt",
"new file mode 100644",
"index 0000000..c698226",
"diff --git a/renamed.txt b/renamed.txt",
"new file mode 100644",
"index 0000000..c698226",
"--- /dev/null",
"+++ b/renamed.txt",
"@@ -0,0 +1,3 @@",
"+baz 1",
"\\ No newline at end of file",
"+baz 10",
"+baz 12"]
let barDiff = FileDelta Deleted "bar.txt" "bar.txt" (Hunks [Hunk (Range 1 1) (Range 0 0) [Line Removed "bar 1"]])
bazDiff = FileDelta Deleted "baz.txt" "baz.txt" (Hunks [Hunk (Range 1 2) (Range 0 0) [ Line Removed "baz 1"
, Line Removed "baz 2"
]])
fooDiff = FileDelta Modified "foo.txt" "foo.txt" (Hunks [Hunk (Range 1 4) (Range 1 5) [ Line Added "line 0"
, Line Context "line 1"
, Line Removed "line 2"
, Line Context "line 3"
, Line Added "line 3.5"
, Line Context "line 4"
]])
renamedDiff = FileDelta Created "renamed.txt" "renamed.txt" (Hunks [Hunk (Range 0 0) (Range 1 3) [ Line Added "baz 1"
, Line Added "baz 10"
, Line Added "baz 12"
]])
emptyDiff = FileDelta Created "empty.txt" "empty.txt" $ Hunks []
(parseDiff $ pack testText) `shouldBe` Right [barDiff, bazDiff, fooDiff, emptyDiff, renamedDiff]
How to run tests
cabal configure --enable-tests && cabal build && cabal test