1
1
mirror of https://github.com/github/semantic.git synced 2024-11-23 08:27:56 +03:00
semantic/semantic-ruby/app/Main.hs
2020-02-07 20:01:19 -05:00

20 lines
565 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 Language.Ruby
import qualified Language.Ruby.AST as Rb
import AST.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