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

Serialize diffs to s-expressions.

This commit is contained in:
Rob Rix 2018-05-11 14:58:06 -04:00
parent 28d4fc30fc
commit 3854ce6d19
2 changed files with 2 additions and 2 deletions

View File

@ -43,7 +43,7 @@ data DiffRenderer output where
-- | Render to JSON with the format documented in docs/json-format.md
JSONDiffRenderer :: DiffRenderer [Value]
-- | Render to a 'ByteString' formatted as nested s-expressions with patches indicated.
SExpressionDiffRenderer :: DiffRenderer ByteString
SExpressionDiffRenderer :: DiffRenderer Builder
-- | Render to a 'ByteString' formatted as a DOT description of the diff.
DOTDiffRenderer :: DiffRenderer Builder

View File

@ -34,7 +34,7 @@ diffBlobPair renderer blobs
= case renderer of
ToCDiffRenderer -> run (WrapTask . (\ blob -> parse parser blob >>= decorate (declarationAlgebra blob))) diffTerms renderToCDiff
JSONDiffRenderer -> run (WrapTask . ( parse parser >=> decorate constructorLabel >=> decorate identifierLabel)) diffTerms renderJSONDiff
SExpressionDiffRenderer -> run (WrapTask . ( parse parser >=> decorate constructorLabel . (Nil <$))) diffTerms (const renderSExpressionDiff)
SExpressionDiffRenderer -> run (WrapTask . ( parse parser >=> decorate constructorLabel . (Nil <$))) diffTerms (const id) >>= serialize SExpression
DOTDiffRenderer -> run (WrapTask . parse parser) diffTerms (const renderTreeGraph) >>= serialize (DOT (diffStyle (pathKeyForBlobPair blobs)))
| otherwise = throwError (SomeException (NoLanguageForBlob effectivePath))
where effectivePath = pathForBlobPair blobs