all repos — min @ 8282886a09bc0e4fea61e9e7eb73ba8fc764024c

A small but practical concatenative programming language.

Refactoring
h3rald h3rald@h3rald.com
Sun, 18 Sep 2016 15:08:59 +0200
commit

8282886a09bc0e4fea61e9e7eb73ba8fc764024c

parent

11f8be2bb223ec7b610d0b491ed20c463d38d0d3

4 files changed, 19 insertions(+), 30 deletions(-)

jump to
M core/interpreter.nimcore/interpreter.nim

@@ -10,14 +10,8 @@ type

MinRuntimeError* = ref object of SystemError qVal*: seq[MinValue] -proc raiseUndefined(msg: string) = - raise MinUndefinedError(msg: msg) - -proc raiseEmptyStack() = - raise MinEmptyStackError(msg:"Insufficient items on the stack") - -proc raiseInvalid(msg: string) = - raise MinInvalidError(msg: msg) +proc raiseRuntime*(msg: string, qVal: var seq[MinValue]) = + raise MinRuntimeError(msg: msg, qVal: qVal) proc fullname*(scope: ref MinScope): string = result = scope.name
M core/parser.nimcore/parser.nim

@@ -101,6 +101,21 @@ MinParsingError* = ref object of ValueError

MinUndefinedError* = ref object of ValueError MinEmptyStackError* = ref object of ValueError MinInvalidError* = ref object of ValueError + MinOutOfBoundsError* = ref object of ValueError + +# Error Helpers + +proc raiseInvalid*(msg: string) = + raise MinInvalidError(msg: msg) + +proc raiseUndefined*(msg: string) = + raise MinUndefinedError(msg: msg) + +proc raiseOutOfBounds*(msg: string) = + raise MinOutOfBoundsError(msg: msg) + +proc raiseEmptyStack*() = + raise MinEmptyStackError(msg: "Insufficient items on the stack") const
M core/utils.nimcore/utils.nim

@@ -10,9 +10,7 @@ import

parser, interpreter -type - MinOutOfBoundsError* = ref object of ValueError - +# Predicates proc isSymbol*(s: MinValue): bool = return s.kind == minSymbol

@@ -74,22 +72,7 @@

proc newQuotation*(): MinValue = return MinValue(kind: minQuotation, qVal: newSeq[MinValue](0)) -# Error Helpers - -proc raiseInvalid*(msg: string) = - raise MinInvalidError(msg: msg) - -proc raiseUndefined*(msg: string) = - raise MinUndefinedError(msg: msg) - -proc raiseOutOfBounds*(msg: string) = - raise MinOutOfBoundsError(msg: msg) - -proc raiseRuntime*(msg: string, qVal: var seq[MinValue]) = - raise MinRuntimeError(msg: msg, qVal: qVal) - -proc raiseEmptyStack*() = - raise MinEmptyStackError(msg: "Insufficient items on the stack") +# Filetype and permissions proc filetype*(p: PathComponent): string = case p
M lib/min_sys.nimlib/min_sys.nim

@@ -8,9 +8,6 @@ ../core/parser,

../core/interpreter, ../core/utils - # OS - - proc sys_module*(i: In)= i.define("sys")