1
1
mirror of https://github.com/kanaka/mal.git synced 2024-09-20 01:57:09 +03:00

fsharp: added some top level exception catching so that the repl wouldn't quit to CLI on errors.

This commit is contained in:
Peter Stephens 2016-12-26 17:05:32 -06:00
parent 3c823be2f8
commit df8c925a24
9 changed files with 81 additions and 23 deletions

View File

@ -31,9 +31,15 @@ module REPL
try
Some(eval env ast)
with
| Error.EvalError(msg)
| Error.ReaderError(msg) ->
printfn "%s" msg
| Error.EvalError(str)
| Error.ReaderError(str) ->
printfn "%s" str
None
| Error.MalError(node) ->
printfn "%s" (Printer.pr_str [node])
None
| ex ->
printfn "%s" (ex.Message)
None
let PRINT v =

View File

@ -67,9 +67,15 @@ module REPL
try
Some(eval env ast)
with
| Error.EvalError(msg)
| Error.ReaderError(msg) ->
printfn "%s" msg
| Error.EvalError(str)
| Error.ReaderError(str) ->
printfn "%s" str
None
| Error.MalError(node) ->
printfn "%s" (Printer.pr_str [node])
None
| ex ->
printfn "%s" (ex.Message)
None
let PRINT v =

View File

@ -103,9 +103,15 @@ module REPL
try
Some(eval env ast)
with
| Error.EvalError(msg)
| Error.ReaderError(msg) ->
printfn "%s" msg
| Error.EvalError(str)
| Error.ReaderError(str) ->
printfn "%s" str
None
| Error.MalError(node) ->
printfn "%s" (Printer.pr_str [node])
None
| ex ->
printfn "%s" (ex.Message)
None
let PRINT v =

View File

@ -105,9 +105,15 @@ module REPL
try
Some(eval env ast)
with
| Error.EvalError(msg)
| Error.ReaderError(msg) ->
printfn "%s" msg
| Error.EvalError(str)
| Error.ReaderError(str) ->
printfn "%s" str
None
| Error.MalError(node) ->
printfn "%s" (Printer.pr_str [node])
None
| ex ->
printfn "%s" (ex.Message)
None
let PRINT v =

View File

@ -105,9 +105,15 @@ module REPL
try
Some(eval env ast)
with
| Error.EvalError(msg)
| Error.ReaderError(msg) ->
printfn "%s" msg
| Error.EvalError(str)
| Error.ReaderError(str) ->
printfn "%s" str
None
| Error.MalError(node) ->
printfn "%s" (Printer.pr_str [node])
None
| ex ->
printfn "%s" (ex.Message)
None
let PRINT v =

View File

@ -125,8 +125,15 @@ module REPL
try
Some(eval env ast)
with
| Error.EvalError(msg) ->
printfn "%s" msg
| Error.EvalError(str)
| Error.ReaderError(str) ->
printfn "%s" str
None
| Error.MalError(node) ->
printfn "%s" (Printer.pr_str [node])
None
| ex ->
printfn "%s" (ex.Message)
None
let PRINT v =

View File

@ -153,8 +153,15 @@ module REPL
try
Some(eval env ast)
with
| Error.EvalError(msg) ->
printfn "%s" msg
| Error.EvalError(str)
| Error.ReaderError(str) ->
printfn "%s" str
None
| Error.MalError(node) ->
printfn "%s" (Printer.pr_str [node])
None
| ex ->
printfn "%s" (ex.Message)
None
let PRINT v =

View File

@ -170,8 +170,15 @@ module REPL
try
Some(eval env ast)
with
| Error.EvalError(msg) ->
printfn "%s" msg
| Error.EvalError(str)
| Error.ReaderError(str) ->
printfn "%s" str
None
| Error.MalError(node) ->
printfn "%s" (Printer.pr_str [node])
None
| ex ->
printfn "%s" (ex.Message)
None
let PRINT v =

View File

@ -171,8 +171,15 @@ module REPL
try
Some(eval env ast)
with
| Error.EvalError(msg) ->
printfn "%s" msg
| Error.EvalError(str)
| Error.ReaderError(str) ->
printfn "%s" str
None
| Error.MalError(node) ->
printfn "%s" (Printer.pr_str [node])
None
| ex ->
printfn "%s" (ex.Message)
None
let PRINT v =