From b0fb726d4db9a1f9d8d753ded4759fd6ea27c2fb Mon Sep 17 00:00:00 2001 From: Ayman Nadeem Date: Fri, 18 Oct 2019 11:14:56 -0400 Subject: [PATCH] case over format --- semantic-ast/src/Main.hs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/semantic-ast/src/Main.hs b/semantic-ast/src/Main.hs index 53a53c44c..9ea0761c4 100644 --- a/semantic-ast/src/Main.hs +++ b/semantic-ast/src/Main.hs @@ -37,13 +37,16 @@ main :: IO () main = generateAST =<< execParser opts generateAST :: SemanticAST -> IO () -generateAST (SemanticAST _ source) = do +generateAST (SemanticAST format source) = do bytestring <- case source of Left filePath -> do Data.ByteString.readFile filePath Right source -> do pure $ Data.ByteString.Char8.pack source - print =<< parseByteString @TreeSitter.Python.AST.Module @(Range, Span) tree_sitter_python bytestring + ast <- parseByteString @TreeSitter.Python.AST.Module @(Range, Span) tree_sitter_python bytestring + case format of + Show -> print ast + opts :: ParserInfo SemanticAST opts = info (parseAST <**> helper)