diff options
Diffstat (limited to 'libtnsl')
-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 |
3 files changed, 22 insertions, 4 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] |