new eval.go

This commit is contained in:
Aidan 2020-06-29 00:06:53 -07:00
parent 89d6a1013b
commit 2a2e5b4527
No known key found for this signature in database
GPG key ID: 327711E983899316
15 changed files with 382 additions and 1215 deletions

View file

@ -33,7 +33,7 @@ func expand(input *ast.Token, vars ast.VarTable, funcs ast.FuncTable) *ast.Token
return input
}
return input.Inner.(*ast.Token)
return input.Expand()
}
/* L_APPEND (append from repl)
@ -45,15 +45,16 @@ func l_append(input *ast.Token, vars ast.VarTable, funcs ast.FuncTable) *ast.Tok
src := input
if input.Tag != ast.LIST {
// TODO: position??
return input
r := &ast.Token{Tag: ast.LIST}
r.Direct(input)
return r
}
// deref inner first
i := src.Inner.(*ast.Token)
i := src.Expand()
iter := &i
if *iter == nil {
src.Inner = input.Next
src.Direct(input.Next)
src.Next = nil
} else {