summaryrefslogtreecommitdiff
path: root/src/texec
diff options
context:
space:
mode:
authorKyle Gunger <kgunger12@gmail.com>2022-06-26 01:18:27 -0400
committerKyle Gunger <kgunger12@gmail.com>2022-06-26 01:18:27 -0400
commit289c1fe3dd2f29e2511b6bb376582f8791179a9b (patch)
tree67c7c2e272f7564e873c8092c9333aa3a5e16c2d /src/texec
parent6416973e373a3c61aa2b44591799385c5b1b0092 (diff)
[AST] Parentheticals
+ Add support for parentheticals + Add uint as a valid type for the evaluator
Diffstat (limited to 'src/texec')
-rw-r--r--src/texec/eval.go6
-rw-r--r--src/texec/libtnsl.go4
2 files changed, 9 insertions, 1 deletions
diff --git a/src/texec/eval.go b/src/texec/eval.go
index 37341a5..b0f4a47 100644
--- a/src/texec/eval.go
+++ b/src/texec/eval.go
@@ -563,6 +563,9 @@ func convertValPS(to TType, sk int, dat interface{}) interface{} {
case int:
numcv = float64(v)
goto NCV
+ case uint:
+ numcv = float64(v)
+ goto NCV
case byte:
numcv = float64(v)
goto NCV
@@ -583,6 +586,8 @@ func convertValPS(to TType, sk int, dat interface{}) interface{} {
NCV:
if equateTypePSO(to, tInt, sk) {
return int(numcv)
+ } else if equateTypePSO(to, tUint, sk) {
+ return uint(numcv)
} else if equateTypePSO(to, tFloat, sk) {
return float64(numcv)
} else if equateTypePSO(to, tByte, sk) || equateTypePSO(to, tCharp, sk) {
@@ -696,6 +701,7 @@ func isStruct(t TType, skp int) bool {
ch = ch || equateTypePSO(t, tCharp, skp)
ch = ch || equateTypePSO(t, tBool, skp)
ch = ch || equateTypePSO(t, tNull, skp)
+ ch = ch || equateTypePSO(t, tUint, skp)
return !ch
}
diff --git a/src/texec/libtnsl.go b/src/texec/libtnsl.go
index bb0ce7d..91d65ae 100644
--- a/src/texec/libtnsl.go
+++ b/src/texec/libtnsl.go
@@ -26,7 +26,8 @@ import (
Parts included:
- io.print
- io.println
- - io.openFile
+ - io.readFile
+ - io.writeFile
- io.File API for file objects
Types included:
@@ -46,6 +47,7 @@ var (
tFile = TType{Pre: []string{}, T: TArtifact{Path: []string{"tnsl", "io"}, Name: "File"}, Post: ""}
tString = TType{Pre: []string{"{}"}, T: TArtifact{Path: []string{}, Name:"charp"}, Post: ""}
tInt = TType{Pre: []string{}, T: TArtifact{Path: []string{}, Name:"int"}, Post: ""}
+ tUint = TType{Pre: []string{}, T: TArtifact{Path: []string{}, Name:"uint"}, Post: ""}
tByte = TType{Pre: []string{}, T: TArtifact{Path: []string{}, Name:"uint8"}, Post: ""}
tByteArray = TType{Pre: []string{"{}"}, T: TArtifact{Path: []string{}, Name:"uint8"}, Post: ""}
tFloat = TType{Pre: []string{}, T: TArtifact{Path: []string{}, Name:"float"}, Post: ""}