mirror of
https://github.com/github/semantic.git
synced 2024-12-01 17:59:10 +03:00
Define sets of parsers for each diff output format.
This commit is contained in:
parent
589a567e60
commit
cf37d082d1
@ -10,7 +10,9 @@ module Semantic.Api.Diffs
|
||||
|
||||
, SomeTermPair(..)
|
||||
|
||||
, legacySummarizeDiffParsers
|
||||
, LegacySummarizeDiff(..)
|
||||
, summarizeDiffParsers
|
||||
, SummarizeDiff(..)
|
||||
) where
|
||||
|
||||
@ -85,6 +87,9 @@ type DiffEffects sig m = (Member (Error SomeException) sig, Member (Reader Confi
|
||||
type Decorate a b = forall term . DiffActions term => Blob -> term a -> term b
|
||||
|
||||
|
||||
dotGraphDiffParsers :: [(Language, SomeParser DOTGraphDiff Loc)]
|
||||
dotGraphDiffParsers = aLaCarteParsers
|
||||
|
||||
class HasDiffFor term => DOTGraphDiff term where
|
||||
dotGraphDiff :: (Carrier sig m, Member (Reader Config) sig) => DiffFor term Loc Loc -> m Builder
|
||||
|
||||
@ -92,6 +97,9 @@ instance (ConstructorName syntax, Foldable syntax, Functor syntax) => DOTGraphDi
|
||||
dotGraphDiff = serialize (DOT (diffStyle "diffs")) . renderTreeGraph
|
||||
|
||||
|
||||
jsonGraphDiffParsers :: [(Language, SomeParser JSONGraphDiff Loc)]
|
||||
jsonGraphDiffParsers = aLaCarteParsers
|
||||
|
||||
class HasDiffFor term => JSONGraphDiff term where
|
||||
jsonGraphDiff :: BlobPair -> DiffFor term Loc Loc -> DiffTreeFileGraph
|
||||
|
||||
@ -104,6 +112,9 @@ instance (Foldable syntax, Functor syntax, ConstructorName syntax) => JSONGraphD
|
||||
lang = bridging # languageForBlobPair blobPair
|
||||
|
||||
|
||||
jsonTreeDiffParsers :: [(Language, SomeParser JSONTreeDiff Loc)]
|
||||
jsonTreeDiffParsers = aLaCarteParsers
|
||||
|
||||
class HasDiffFor term => JSONTreeDiff term where
|
||||
jsonTreeDiff :: BlobPair -> DiffFor term Loc Loc -> Rendering.JSON.JSON "diffs" SomeJSON
|
||||
|
||||
@ -111,6 +122,9 @@ instance ToJSONFields1 syntax => JSONTreeDiff (Term syntax) where
|
||||
jsonTreeDiff = renderJSONDiff
|
||||
|
||||
|
||||
sexprDiffParsers :: [(Language, SomeParser SExprDiff Loc)]
|
||||
sexprDiffParsers = aLaCarteParsers
|
||||
|
||||
class HasDiffFor term => SExprDiff term where
|
||||
sexprDiff :: (Carrier sig m, Member (Reader Config) sig) => DiffFor term Loc Loc -> m Builder
|
||||
|
||||
@ -118,6 +132,9 @@ instance (ConstructorName syntax, Foldable syntax, Functor syntax) => SExprDiff
|
||||
sexprDiff = serialize (SExpression ByConstructorName)
|
||||
|
||||
|
||||
showDiffParsers :: [(Language, SomeParser ShowDiff Loc)]
|
||||
showDiffParsers = aLaCarteParsers
|
||||
|
||||
class HasDiffFor term => ShowDiff term where
|
||||
showDiff :: (Carrier sig m, Member (Reader Config) sig) => DiffFor term Loc Loc -> m Builder
|
||||
|
||||
@ -125,6 +142,9 @@ instance Show1 syntax => ShowDiff (Term syntax) where
|
||||
showDiff = serialize Show
|
||||
|
||||
|
||||
legacySummarizeDiffParsers :: [(Language, SomeParser LegacySummarizeDiff Loc)]
|
||||
legacySummarizeDiffParsers = aLaCarteParsers
|
||||
|
||||
class HasDiffFor term => LegacySummarizeDiff term where
|
||||
legacyDecorateTerm :: Blob -> term Loc -> term (Maybe Declaration)
|
||||
legacySummarizeDiff :: BlobPair -> DiffFor term (Maybe Declaration) (Maybe Declaration) -> Summaries
|
||||
@ -134,6 +154,9 @@ instance (Foldable syntax, Functor syntax, HasDeclaration syntax) => LegacySumma
|
||||
legacySummarizeDiff = renderToCDiff
|
||||
|
||||
|
||||
summarizeDiffParsers :: [(Language, SomeParser SummarizeDiff Loc)]
|
||||
summarizeDiffParsers = aLaCarteParsers
|
||||
|
||||
class HasDiffFor term => SummarizeDiff term where
|
||||
decorateTerm :: Blob -> term Loc -> term (Maybe Declaration)
|
||||
summarizeDiff :: BlobPair -> DiffFor term (Maybe Declaration) (Maybe Declaration) -> TOCSummaryFile
|
||||
|
Loading…
Reference in New Issue
Block a user