mirror of
https://github.com/github/semantic.git
synced 2024-11-28 01:47:01 +03:00
20 lines
576 B
Haskell
20 lines
576 B
Haskell
{-# LANGUAGE TypeApplications #-}
|
|
module Main
|
|
( main
|
|
) where
|
|
|
|
import Control.Monad
|
|
import qualified Data.ByteString as B
|
|
import Data.Foldable (traverse_)
|
|
import System.Exit (die)
|
|
import System.Environment (getArgs)
|
|
import TreeSitter.Ruby
|
|
import qualified TreeSitter.Ruby.AST as Rb
|
|
import TreeSitter.Unmarshal
|
|
|
|
main :: IO ()
|
|
main = getArgs >>= traverse_ (print <=< parseFile)
|
|
|
|
parseFile :: FilePath -> IO (Rb.Program ())
|
|
parseFile = either die pure <=< parseByteString @Rb.Program @() tree_sitter_ruby <=< B.readFile
|