mirror of
https://github.com/edwinb/Idris2-boot.git
synced 2024-12-23 04:42:05 +03:00
Add command line option to invoke yaffle
This commit is contained in:
parent
c6a7050d39
commit
9d2067e9a8
@ -45,6 +45,8 @@ data CLOpt
|
||||
IdeMode |
|
||||
||| Whether or not to run IdeMode (using a socket instead of stdin/stdout)
|
||||
IdeModeSocket |
|
||||
||| Run as a checker for the core language TTImp
|
||||
Yaffle String |
|
||||
BlodwenPaths
|
||||
|
||||
|
||||
@ -91,7 +93,9 @@ options = [MkOpt ["--check", "-c"] [] [CheckOnly]
|
||||
MkOpt ["--version", "-v"] [] [Version]
|
||||
(Just "Display version string"),
|
||||
MkOpt ["--help", "-h", "-?"] [] [Help]
|
||||
(Just "Display help text")
|
||||
(Just "Display help text"),
|
||||
MkOpt ["--yaffle", "--ttimp"] ["ttimp file"] (\f => [Yaffle f])
|
||||
Nothing
|
||||
]
|
||||
|
||||
optUsage : OptDesc -> String
|
||||
@ -111,16 +115,16 @@ optUsage d
|
||||
|
||||
export
|
||||
version : String
|
||||
version = "0.1"
|
||||
version = "0.0"
|
||||
|
||||
export
|
||||
versionMsg : String
|
||||
versionMsg = "Blodwen, a prototype successor to Idris, version " ++ version
|
||||
versionMsg = "Idris 2, version " ++ version
|
||||
|
||||
export
|
||||
usage : String
|
||||
usage = versionMsg ++ "\n" ++
|
||||
"Usage: blodwen [options] [input file]\n\n" ++
|
||||
"Usage: idris2 [options] [input file]\n\n" ++
|
||||
"Available options:\n" ++
|
||||
concatMap (\u => " " ++ optUsage u) options
|
||||
|
||||
|
@ -221,16 +221,16 @@ perror ForceNeeded = pure "Internal error when resolving implicit laziness"
|
||||
perror (InternalError str) = pure $ "INTERNAL ERROR: " ++ str
|
||||
|
||||
perror (InType fc n err)
|
||||
= pure $ "While processing type of " ++ show (sugarName n) ++
|
||||
= pure $ "While processing type of " ++ show (sugarName !(getFullName n)) ++
|
||||
" at " ++ show fc ++ ":\n" ++ !(perror err)
|
||||
perror (InCon fc n err)
|
||||
= pure $ "While processing constructor " ++ show (sugarName n) ++
|
||||
= pure $ "While processing constructor " ++ show (sugarName !(getFullName n)) ++
|
||||
" at " ++ show fc ++ ":\n" ++ !(perror err)
|
||||
perror (InLHS fc n err)
|
||||
= pure $ "While processing left hand side of " ++ show (sugarName n) ++
|
||||
= pure $ "While processing left hand side of " ++ show (sugarName !(getFullName n)) ++
|
||||
" at " ++ show fc ++ ":\n" ++ !(perror err)
|
||||
perror (InRHS fc n err)
|
||||
= pure $ "While processing right hand side of " ++ show (sugarName n) ++
|
||||
= pure $ "While processing right hand side of " ++ show (sugarName !(getFullName n)) ++
|
||||
" at " ++ show fc ++ ":\n" ++ !(perror err)
|
||||
|
||||
export
|
||||
|
@ -26,6 +26,7 @@ import Idris.Socket.Data
|
||||
import Data.Vect
|
||||
import System
|
||||
|
||||
import Yaffle.Main
|
||||
import YafflePaths
|
||||
|
||||
%default covering
|
||||
@ -81,9 +82,17 @@ showInfo (BlodwenPaths :: _)
|
||||
pure True
|
||||
showInfo (_::rest) = showInfo rest
|
||||
|
||||
tryYaffle : List CLOpt -> Core Bool
|
||||
tryYaffle [] = pure False
|
||||
tryYaffle (Yaffle f :: _) = do yaffleMain f []
|
||||
pure True
|
||||
tryYaffle (c :: cs) = tryYaffle cs
|
||||
|
||||
stMain : List CLOpt -> Core ()
|
||||
stMain opts
|
||||
= do defs <- initDefs
|
||||
= do False <- tryYaffle opts
|
||||
| True => pure ()
|
||||
defs <- initDefs
|
||||
c <- newRef Ctxt defs
|
||||
s <- newRef Syn initSyntax
|
||||
m <- newRef MD initMetadata
|
||||
@ -133,7 +142,8 @@ stMain opts
|
||||
setOutput (IDEMode 0 file file)
|
||||
replIDE {c} {u} {m}
|
||||
else do
|
||||
iputStrLn "Welcome to Blodwen. Good luck."
|
||||
iputStrLn $ "Welcome to Idris2 version " ++ version
|
||||
++ ". What could possibly go wrong?"
|
||||
repl {c} {u} {m}
|
||||
else
|
||||
-- exit with an error code if there was an error, otherwise
|
||||
|
@ -55,6 +55,7 @@ yaffleMain fname args
|
||||
coreLift $ putStrLn "Written TTC"
|
||||
repl {c} {u}
|
||||
|
||||
{-
|
||||
main : IO ()
|
||||
main
|
||||
= do (_ :: fname :: rest) <- getArgs
|
||||
@ -63,3 +64,4 @@ main
|
||||
coreRun (yaffleMain fname rest)
|
||||
(\err : Error => putStrLn ("Uncaught error: " ++ show err))
|
||||
(\res => pure ())
|
||||
-}
|
||||
|
Loading…
Reference in New Issue
Block a user