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

@ -46,8 +46,6 @@ func setLogLvl() {
}
func main() {
ast.CallExecutablesFromUndefFuncCalls = true
debug := os.Getenv("SH_DEBUG_MODE")
hist := os.Getenv("SH_HIST_FILE")
prompt := os.Getenv("SHS_SH_PROMPT")
@ -57,8 +55,10 @@ func main() {
funcs = stdlib.GenFuncTable()
vars = &map[string]*ast.Token{}
ast.InitVarTable(vars)
ast.SyncTablesWithOSEnviron = true
ast.ExecWhenFuncUndef = false
var err error
@ -96,12 +96,8 @@ func main() {
ast.PrintSExprsIndividually(userInput)
}
result, unwrap := userInput.Eval(funcs, vars)
result := userInput.Eval(funcs, vars)
if result != nil {
if result.Tag == ast.LIST && unwrap {
result = result.Inner.(*ast.Token)
}
for i := result; i != nil; i = i.Next {
fmt.Printf(i.String() + " ")
}