2019-10-01 18:25:14 +03:00
|
|
|
{-# LANGUAGE ApplicativeDo #-}
|
2019-10-02 00:01:50 +03:00
|
|
|
{-# LANGUAGE TypeApplications #-}
|
2019-10-02 00:02:08 +03:00
|
|
|
module CLI (main) where
|
2019-10-01 18:25:14 +03:00
|
|
|
|
2019-10-02 00:03:02 +03:00
|
|
|
import System.Environment
|
2019-10-02 00:03:37 +03:00
|
|
|
import TreeSitter.Unmarshal
|
|
|
|
import TreeSitter.Python.AST
|
|
|
|
import TreeSitter.Python
|
2019-10-02 00:03:18 +03:00
|
|
|
import Source.Range
|
|
|
|
import Source.Span
|
2019-10-02 01:35:50 +03:00
|
|
|
import Data.ByteString (readFile, ByteString)
|
2019-10-02 01:36:00 +03:00
|
|
|
import System.IO (FilePath)
|
2019-10-01 18:25:14 +03:00
|
|
|
|
2019-10-02 01:36:35 +03:00
|
|
|
main :: IO ()
|
2019-10-01 18:25:14 +03:00
|
|
|
main = do
|
2019-10-02 01:37:23 +03:00
|
|
|
args <- head <$> getArgs
|
2019-10-02 01:38:22 +03:00
|
|
|
bytestring <- Data.ByteString.readFile args
|
2019-10-02 01:38:36 +03:00
|
|
|
print =<< parseByteString @TreeSitter.Python.AST.Module @(Range, Span) tree_sitter_python bytestring
|