mirror of
https://github.com/github/semantic.git
synced 2024-12-24 23:42:31 +03:00
correctly refactor
This commit is contained in:
parent
9b1345d0b9
commit
a45b8683ec
@ -39,14 +39,12 @@ main = generateAST =<< execParser opts
|
||||
|
||||
generateAST :: SemanticAST -> IO ()
|
||||
generateAST (SemanticAST _ source) = do
|
||||
case source of
|
||||
bytestring <- case source of
|
||||
Left filePath -> do
|
||||
bytestring <- Data.ByteString.readFile filePath
|
||||
printByteString bytestring
|
||||
Data.ByteString.readFile filePath
|
||||
Right source -> do
|
||||
let bytestring = Data.ByteString.Char8.pack source
|
||||
printByteString bytestring
|
||||
where printByteString bytestring = print =<< parseByteString @TreeSitter.Python.AST.Module @(Range, Span) tree_sitter_python bytestring
|
||||
pure $ Data.ByteString.Char8.pack source
|
||||
print =<< parseByteString @TreeSitter.Python.AST.Module @(Range, Span) tree_sitter_python bytestring
|
||||
|
||||
opts :: ParserInfo SemanticAST
|
||||
opts = info (parseAST <**> helper)
|
||||
|
Loading…
Reference in New Issue
Block a user