summaryrefslogtreecommitdiff
path: root/src/texec
diff options
context:
space:
mode:
authorKyle Gunger <kgunger12@gmail.com>2022-12-23 03:35:43 -0500
committerKyle Gunger <kgunger12@gmail.com>2022-12-23 03:35:43 -0500
commit3192b9ace7a5c653d81a42e4d5cd437e6d81fbe1 (patch)
tree4091bb94413f88d3b4ea7c6a36e20f8ee7a631c3 /src/texec
parent0f1faa877167324c52f2626cebe335a85cae40d9 (diff)
Remove charp in favor of uint8master
Diffstat (limited to 'src/texec')
-rw-r--r--src/texec/eval.go9
-rw-r--r--src/texec/libtnsl.go8
2 files changed, 8 insertions, 9 deletions
diff --git a/src/texec/eval.go b/src/texec/eval.go
index 47a379e..88d0190 100644
--- a/src/texec/eval.go
+++ b/src/texec/eval.go
@@ -419,6 +419,8 @@ func getLiteralComposite(v tparse.Node) []interface{} {
out = append(out, getLiteralComposite(v.Sub[i]))
} else if v.Sub[i].Data.Data[0] == '0' {
out = append(out, getIntLiteral(v.Sub[i]))
+ } else if v.Sub[i].Data.Data == "true" || v.Sub[i].Data.Data == "false" {
+ out = append(out, getBoolLiteral(v.Sub[i]))
} else {
out = append(out, getFloatLiteral(v.Sub[i]))
}
@@ -434,7 +436,7 @@ func getBoolLiteral(v tparse.Node) bool {
func getLiteral(v tparse.Node, t TType) interface{} {
if equateType(t, tFloat) {
return getFloatLiteral(v)
- } else if equateType(t, tCharp) {
+ } else if equateType(t, tByte) {
return getCharLiteral(v)
} else if equateType(t, tString) {
return getStringLiteral(v)
@@ -451,7 +453,7 @@ func getLiteralType(v tparse.Node) TType {
if v.Data.Data[0] == '"' {
return tString
} else if v.Data.Data[0] == '\'' {
- return tCharp
+ return tByte
} else if v.Data.Data == "comp" {
return tStruct
} else if v.Data.Data == "true" || v.Data.Data == "false" {
@@ -592,7 +594,7 @@ func convertValPS(to TType, sk int, dat interface{}) interface{} {
return uint(numcv)
} else if equateTypePSO(to, tFloat, sk) {
return float64(numcv)
- } else if equateTypePSO(to, tByte, sk) || equateTypePSO(to, tCharp, sk) {
+ } else if equateTypePSO(to, tByte, sk) {
return byte(numcv)
} else if equateTypePSO(to, tBool, sk) {
return numcv != 0
@@ -700,7 +702,6 @@ func isStruct(t TType, skp int) bool {
ch = ch || equateTypePSO(t, tInt, skp)
ch = ch || equateTypePSO(t, tByte, skp)
ch = ch || equateTypePSO(t, tFloat, skp)
- ch = ch || equateTypePSO(t, tCharp, skp)
ch = ch || equateTypePSO(t, tBool, skp)
ch = ch || equateTypePSO(t, tNull, skp)
ch = ch || equateTypePSO(t, tUint, skp)
diff --git a/src/texec/libtnsl.go b/src/texec/libtnsl.go
index 91d65ae..3072cdd 100644
--- a/src/texec/libtnsl.go
+++ b/src/texec/libtnsl.go
@@ -45,13 +45,11 @@ import (
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: ""}
+ tString = TType{Pre: []string{"{}"}, T: TArtifact{Path: []string{}, Name:"uint8"}, 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: ""}
- tCharp = TType{Pre: []string{}, T: TArtifact{Path: []string{}, Name:"charp"}, Post: ""}
tNull = TType{Pre: []string{}, T: TArtifact{Path: []string{}, Name: "null"}, Post: ""}
tBool = TType{Pre: []string{}, T: TArtifact{Path: []string{}, Name: "bool"}, Post: ""}
@@ -188,11 +186,11 @@ func tfile_read(file TVariable) TVariable {
// tnsl.io.File.write
func tfile_write(file, in TVariable) {
if equateType(file.Type, tFile) {
- if equateType(in.Type, tCharp) || equateType(in.Type, tByte) {
+ if equateType(in.Type, tByte) {
b := []byte{0}
b[0] = (in.Data).(byte)
(file.Data).(*os.File).Write(b)
- } else if equateType(in.Type, tByteArray) || equateType(in.Type, tString) {
+ } else if equateType(in.Type, tString) {
dat := (in.Data).([]interface{})
wrt := []byte{}
for i := 0; i < len(dat); i++ {