mirror of
https://github.com/github/semantic.git
synced 2024-11-29 21:52:59 +03:00
sometimes you write code and forget to check it in
This commit is contained in:
parent
1a9ae6096d
commit
d3a94a478a
28
semantic-ast/app/Main.hs
Normal file
28
semantic-ast/app/Main.hs
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
{-# LANGUAGE DeriveGeneric #-}
|
||||||
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
|
{-# LANGUAGE TypeApplications #-}
|
||||||
|
|
||||||
|
module Main (main) where
|
||||||
|
|
||||||
|
import AST.GenerateSyntax
|
||||||
|
import GHC.Generics (Generic)
|
||||||
|
import Language.Haskell.TH
|
||||||
|
import qualified Options.Generic as Opt
|
||||||
|
import System.Directory
|
||||||
|
import qualified TreeSitter.JSON as JSON (tree_sitter_json)
|
||||||
|
|
||||||
|
data Config = Config
|
||||||
|
{ language :: String,
|
||||||
|
path :: FilePath
|
||||||
|
}
|
||||||
|
deriving (Show, Generic)
|
||||||
|
|
||||||
|
instance Opt.ParseRecord Config
|
||||||
|
|
||||||
|
main :: IO ()
|
||||||
|
main = do
|
||||||
|
args <- Opt.getRecord "generate-ast"
|
||||||
|
print @Config args
|
||||||
|
absolute <- makeAbsolute (path args)
|
||||||
|
decls <- runQ (astDeclarationsRelative JSON.tree_sitter_json absolute)
|
||||||
|
putStrLn (pprint decls)
|
Loading…
Reference in New Issue
Block a user