2015-05-02 09:50:09 +03:00
|
|
|
module Error
|
|
|
|
|
|
|
|
exception ReaderError of string
|
|
|
|
exception EvalError of string
|
2015-07-03 20:07:57 +03:00
|
|
|
exception MalError of Types.Node
|
2015-05-02 09:50:09 +03:00
|
|
|
|
|
|
|
let expectedXButEOF x = ReaderError(sprintf "Expected %s, got EOF" x)
|
|
|
|
let expectedX x = ReaderError(sprintf "Expected %s" x)
|
|
|
|
let unexpectedChar () = ReaderError("Unexpected char")
|
|
|
|
let invalidToken () = ReaderError("Invalid token")
|
|
|
|
|
|
|
|
let expectedEvenNodeCount () = EvalError("Expected even node count")
|
|
|
|
let wrongArity () = EvalError("Arity: wrong number of arguments")
|
|
|
|
let argMismatch () = EvalError("Argument mismatch")
|
|
|
|
let symbolNotFound s = EvalError(sprintf "'%s' not found" s)
|
|
|
|
let noEnvironment () = EvalError("No environment")
|
|
|
|
let tooManyValues () = EvalError("Too many values")
|
|
|
|
let notEnoughValues () = EvalError("Not enough values")
|
|
|
|
let onlyOneSymbolAfterAmp () = EvalError("only one symbol after &")
|
|
|
|
let errExpectedX x = EvalError(sprintf "expected %s" x)
|
2015-07-03 17:57:15 +03:00
|
|
|
let indexOutOfBounds () = EvalError("Index out of bounds")
|