implement "--repl"

This commit is contained in:
Nikita Vilunov 2020-06-08 01:31:16 +03:00
parent 018c17b69a
commit 2db3a61160
2 changed files with 11 additions and 7 deletions

View File

@ -131,7 +131,6 @@ stMain opts
defs <- initDefs defs <- initDefs
c <- newRef Ctxt defs c <- newRef Ctxt defs
s <- newRef Syn initSyntax s <- newRef Syn initSyntax
m <- newRef MD initMetadata
addPrimitives addPrimitives
setWorkingDir "." setWorkingDir "."
@ -157,6 +156,7 @@ stMain opts
when (checkVerbose opts) $ -- override Quiet if implicitly set when (checkVerbose opts) $ -- override Quiet if implicitly set
setOutput (REPL False) setOutput (REPL False)
u <- newRef UST initUState u <- newRef UST initUState
m <- newRef MD initMetadata
updateREPLOpts updateREPLOpts
session <- getSession session <- getSession
when (not $ nobanner session) $ when (not $ nobanner session) $

View File

@ -444,15 +444,16 @@ getParseErrorLoc fname _ = replFC
-- Just load the 'Main' module, if it exists, which will involve building -- Just load the 'Main' module, if it exists, which will involve building
-- it if necessary -- it if necessary
runRepl : {auto c : Ref Ctxt Defs} -> runRepl : {auto c : Ref Ctxt Defs} ->
{auto s : Ref Syn SyntaxInfo} ->
{auto o : Ref ROpts REPLOpts} -> {auto o : Ref ROpts REPLOpts} ->
PkgDesc -> PkgDesc ->
List CLOpt -> List CLOpt ->
Core () Core ()
runRepl pkg opts runRepl pkg opts = do
= do addDeps pkg u <- newRef UST initUState
processOptions (options pkg) m <- newRef MD initMetadata
preOptions opts repl {u} {s}
throw (InternalError "Not implemented")
processPackage : {auto c : Ref Ctxt Defs} -> processPackage : {auto c : Ref Ctxt Defs} ->
{auto s : Ref Syn SyntaxInfo} -> {auto s : Ref Syn SyntaxInfo} ->
@ -480,7 +481,10 @@ processPackage cmd file opts
| errs => coreLift (exitWith (ExitFailure 1)) | errs => coreLift (exitWith (ExitFailure 1))
install pkg opts install pkg opts
Clean => clean pkg opts Clean => clean pkg opts
REPL => runRepl pkg opts REPL => do
[] <- build pkg opts
| errs => coreLift (exitWith (ExitFailure 1))
runRepl pkg opts
record POptsFilterResult where record POptsFilterResult where
constructor MkPFR constructor MkPFR