mirror of
https://github.com/github/semantic.git
synced 2024-11-29 02:44:36 +03:00
Pass the language modes to parseTermBuilder.
This commit is contained in:
parent
f68c710a58
commit
10093b1088
@ -69,13 +69,13 @@ data TermOutputFormat
|
||||
deriving (Eq, Show)
|
||||
|
||||
parseTermBuilder :: (Traversable t, Member Distribute sig, ParseEffects sig m, MonadIO m)
|
||||
=> TermOutputFormat-> t Blob -> m Builder
|
||||
parseTermBuilder TermJSONTree = distributeFoldMap jsonTerm >=> serialize Format.JSON -- NB: Serialize happens at the top level for these two JSON formats to collect results of multiple blobs.
|
||||
parseTermBuilder TermJSONGraph = termGraph >=> serialize Format.JSON
|
||||
parseTermBuilder TermSExpression = distributeFoldMap sexpTerm
|
||||
parseTermBuilder TermDotGraph = distributeFoldMap dotGraphTerm
|
||||
parseTermBuilder TermShow = distributeFoldMap showTerm
|
||||
parseTermBuilder TermQuiet = distributeFoldMap quietTerm
|
||||
=> TermOutputFormat -> PerLanguageModes -> t Blob -> m Builder
|
||||
parseTermBuilder TermJSONTree _ = distributeFoldMap jsonTerm >=> serialize Format.JSON -- NB: Serialize happens at the top level for these two JSON formats to collect results of multiple blobs.
|
||||
parseTermBuilder TermJSONGraph _ = termGraph >=> serialize Format.JSON
|
||||
parseTermBuilder TermSExpression _ = distributeFoldMap sexpTerm
|
||||
parseTermBuilder TermDotGraph _ = distributeFoldMap dotGraphTerm
|
||||
parseTermBuilder TermShow _ = distributeFoldMap showTerm
|
||||
parseTermBuilder TermQuiet _ = distributeFoldMap quietTerm
|
||||
|
||||
jsonTerm :: (ParseEffects sig m) => Blob -> m (Rendering.JSON.JSON "trees" SomeJSON)
|
||||
jsonTerm blob = (doParse blob >>= withSomeTerm (pure . renderJSONTerm blob)) `catchError` jsonError blob
|
||||
|
@ -109,14 +109,14 @@ parseCommand = command "parse" (info parseArgumentsParser (progDesc "Generate pa
|
||||
<> value Language.ALaCarte
|
||||
<> showDefault)
|
||||
renderer
|
||||
<- flag (const (parseTermBuilder TermSExpression))
|
||||
(const (parseTermBuilder TermSExpression))
|
||||
<- flag (parseTermBuilder TermSExpression)
|
||||
(parseTermBuilder TermSExpression)
|
||||
( long "sexpression"
|
||||
<> help "Output s-expression parse trees (default)")
|
||||
<|> flag' (const (parseTermBuilder TermJSONTree))
|
||||
<|> flag' (parseTermBuilder TermJSONTree)
|
||||
( long "json"
|
||||
<> help "Output JSON parse trees")
|
||||
<|> flag' (const (parseTermBuilder TermJSONGraph))
|
||||
<|> flag' (parseTermBuilder TermJSONGraph)
|
||||
( long "json-graph"
|
||||
<> help "Output JSON adjacency list")
|
||||
<|> flag' (parseSymbolsBuilder JSON)
|
||||
@ -126,13 +126,13 @@ parseCommand = command "parse" (info parseArgumentsParser (progDesc "Generate pa
|
||||
<|> flag' (parseSymbolsBuilder Proto)
|
||||
( long "proto-symbols"
|
||||
<> help "Output protobufs symbol list")
|
||||
<|> flag' (const (parseTermBuilder TermDotGraph))
|
||||
<|> flag' (parseTermBuilder TermDotGraph)
|
||||
( long "dot"
|
||||
<> help "Output DOT graph parse trees")
|
||||
<|> flag' (const (parseTermBuilder TermShow))
|
||||
<|> flag' (parseTermBuilder TermShow)
|
||||
( long "show"
|
||||
<> help "Output using the Show instance (debug only, format subject to change without notice)")
|
||||
<|> flag' (const (parseTermBuilder TermQuiet))
|
||||
<|> flag' (parseTermBuilder TermQuiet)
|
||||
( long "quiet"
|
||||
<> help "Don't produce output, but show timing stats")
|
||||
filesOrStdin <- FilesFromGitRepo
|
||||
|
Loading…
Reference in New Issue
Block a user