added type casts

This commit is contained in:
Aidan 2020-07-18 00:22:43 -07:00
parent 77ce00970f
commit 8278430882
No known key found for this signature in database
GPG key ID: 327711E983899316
4 changed files with 72 additions and 1 deletions

View file

@ -43,6 +43,13 @@ func concat(in *ast.Token, vt ast.VarTable, ft ast.FuncTable) *ast.Token {
return t
}
func str_cast(in *ast.Token, vt ast.VarTable, ft ast.FuncTable) *ast.Token {
body := in.Eval(ft, vt, false).String()
res := &ast.Token{ Tag: ast.STRING }
res.Set(body)
return res
}
func print_str(in *ast.Token, vt ast.VarTable, ft ast.FuncTable) *ast.Token {
body := in.Eval(ft, vt, false).String()
if body[0] != body[len(body)-1] && body[0] != '"' {