1
1
mirror of https://github.com/github/semantic.git synced 2024-11-24 08:54:07 +03:00

lord forgive me for this nested case statement

This commit is contained in:
Ayman Nadeem 2019-10-11 12:49:57 -04:00
parent 5d4b34b39b
commit cf609451ae

View File

@ -44,9 +44,12 @@ generateAST (SemanticAST filePath sourceString _) = do
Just filePath -> do
bytestring <- Data.ByteString.readFile filePath
print =<< parseByteString @TreeSitter.Python.AST.Module @(Range, Span) tree_sitter_python bytestring
StdInput -> do
bytestring <- Data.ByteString.Char8.pack . Prelude.head <$> getArgs
print =<< parseByteString @TreeSitter.Python.AST.Module @(Range, Span) tree_sitter_python bytestring
Nothing -> do
case sourceString of
Just sourceString -> do
bytestring <- Data.ByteString.Char8.pack . Prelude.head <$> getArgs
print =<< parseByteString @TreeSitter.Python.AST.Module @(Range, Span) tree_sitter_python bytestring
Nothing -> print "please provide a file path or source string to parse"
opts :: ParserInfo SemanticAST
opts = info (parseAST <**> helper)