Popularity
4.1
Declining
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.
-
Earley
Parsing all context-free grammars using Earley's algorithm in Haskell. -
trifecta
Parser combinators with highlighting, slicing, layout, literate comments, Clang-style diagnostics and the kitchen sink -
parser-combinators
Lightweight package providing commonly useful parser combinators -
replace-megaparsec
Stream editing with Haskell Megaparsec parsers -
descriptive
Self-describing consumers/parsers; forms, cmd-line args, JSON, etc. -
scanner
Fast non-backtracking incremental combinator parsing for bytestrings -
parsec-free
Parsec API encoded as a deeply-embedded DSL, for debugging and analysis -
incremental-parser
Haskell parsing combinator liibrary that can be fed the input and emit the parsed output incrementally -
data-stm32
ARM SVD and CubeMX XML parser and pretty printer for STM32 family -
hsemail
Haskell Parsec parsers for the syntax defined in RFC2821 and 2822 -
replace-attoparsec
Stream editing with Haskell Attoparsec parsers -
parsec-parsers
Orphan instances so you can use `parsers` with `parsec`. -
record-syntax
A library for parsing and processing the Haskell syntax sprinkled with anonymous records -
attoparsec-parsec
An Attoparsec compatibility layer for Parsec -
matrix-market-attoparsec
Attoparsec parsers for the NIST Matrix Market format -
attoparsec-expr
Port of parsec's expression parser to attoparsec. -
fuzzy-dates
Automatically detect and parse dates in many different formats -
streaming-binary
Incremental serialization and deserialization of Haskell values. -
antlrc
Haskell binding to the ANTLR parser generator C runtime library http://www.antlr.org/wiki/display/ANTLR3/ANTLR3+Code+Generation+-+C
WorkOS - The modern identity platform for B2B SaaS
The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.
Promo
workos.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