1
1
mirror of https://github.com/github/semantic.git synced 2024-12-26 00:12:29 +03:00

correctly refactor

This commit is contained in:
Ayman Nadeem 2019-10-16 15:15:03 -04:00
parent 9b1345d0b9
commit a45b8683ec

View File

@ -39,14 +39,12 @@ main = generateAST =<< execParser opts
generateAST :: SemanticAST -> IO () generateAST :: SemanticAST -> IO ()
generateAST (SemanticAST _ source) = do generateAST (SemanticAST _ source) = do
case source of bytestring <- case source of
Left filePath -> do Left filePath -> do
bytestring <- Data.ByteString.readFile filePath Data.ByteString.readFile filePath
printByteString bytestring
Right source -> do Right source -> do
let bytestring = Data.ByteString.Char8.pack source pure $ Data.ByteString.Char8.pack source
printByteString bytestring print =<< parseByteString @TreeSitter.Python.AST.Module @(Range, Span) tree_sitter_python bytestring
where printByteString bytestring = print =<< parseByteString @TreeSitter.Python.AST.Module @(Range, Span) tree_sitter_python bytestring
opts :: ParserInfo SemanticAST opts :: ParserInfo SemanticAST
opts = info (parseAST <**> helper) opts = info (parseAST <**> helper)