diff options
author | Kyle Gunger <kgunger12@gmail.com> | 2022-10-06 16:06:52 -0400 |
---|---|---|
committer | Kyle Gunger <kgunger12@gmail.com> | 2022-10-06 16:06:52 -0400 |
commit | 34bfedcd1e5e67b630fb7648cf7709d4a400abc5 (patch) | |
tree | 39e67665f900200e85c7ff8f50353525e23b95de | |
parent | 5379b962bc177f26f550a23fb9685ca49a048076 (diff) |
Minor fixes
-rw-r--r-- | libtnsl/box/error.tnsl (renamed from libtnsl/box/_vect.tnsl) | 18 | ||||
-rw-r--r-- | libtnsl/box/string.tnsl | 6 | ||||
-rw-r--r-- | libtnsl/box/vector.tnsl | 2 | ||||
-rw-r--r-- | tnslc/compile/compile.tnsl | 5 |
4 files changed, 24 insertions, 7 deletions
diff --git a/libtnsl/box/_vect.tnsl b/libtnsl/box/error.tnsl index 52e6444..d536012 100644 --- a/libtnsl/box/_vect.tnsl +++ b/libtnsl/box/error.tnsl @@ -18,3 +18,21 @@ WARRANTY, GUARANTEE, OR CLAIM OF FITNESS FOR ANY PURPOSE EXPRESS OR IMPLIED #/ + +;enum ERROR_CODE [uint] { + OUT_OF_RANGE +} + +;struct Error { + String msg, + uint code, + ~void data +} + +/; method Error + /; Error (String msg, uint code) + ;self.msg = msg + ;self.code = code + ;self.data = null + ;/ +;/
\ No newline at end of file diff --git a/libtnsl/box/string.tnsl b/libtnsl/box/string.tnsl index 70b2c2a..d661676 100644 --- a/libtnsl/box/string.tnsl +++ b/libtnsl/box/string.tnsl @@ -19,14 +19,14 @@ EXPRESS OR IMPLIED #/ -;raw enum TEXT_ENCODING { +;enum TEXT_ENCODING [uint] { UTF_8, UN7_1, ASCII } -;struct String extends Vector (uint8) { - uint +;struct String extends Vector(uint8) { + uint encoding } /; method String diff --git a/libtnsl/box/vector.tnsl b/libtnsl/box/vector.tnsl index 065239e..724393f 100644 --- a/libtnsl/box/vector.tnsl +++ b/libtnsl/box/vector.tnsl @@ -68,7 +68,7 @@ ;/ # Probably not what errors will look like long term, but # serves as a proof of concept for now - ;throw Error{"Bad Index"} + ;throw Error("Bad index", ERROR_CODE.OUT_OF_RANGE) ;/ /; operator len [uint] diff --git a/tnslc/compile/compile.tnsl b/tnslc/compile/compile.tnsl index eb43594..80656e4 100644 --- a/tnslc/compile/compile.tnsl +++ b/tnslc/compile/compile.tnsl @@ -16,15 +16,14 @@ /; module compile # :include "compile/arch/arch.tnsl" - :include "compile/isa_x86.tnsl" # :include "compile/comp.tnsl" ;/ ;{}{}charp COMMON_ASM = { "\tret", - "push %", - "pop %" + "\tpush %", + "\tpop %" } ;struct VType { |