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

@ -39,162 +39,12 @@ func GenFuncTable() ast.FuncTable {
Args: -1,
},
"+": &ast.Function{
Function: add,
Name: "add",
TimesCalled: 0,
Args: -1,
},
"-": &ast.Function{
Function: sub,
Name: "sub",
TimesCalled: 0,
Args: -1,
},
"*": &ast.Function{
Function: mult,
Name: "mult",
TimesCalled: 0,
Args: -1,
},
"/": &ast.Function{
Function: div,
Name: "div",
TimesCalled: 0,
Args: -1,
},
"l": &ast.Function{
Function: call,
Name: "call",
TimesCalled: 0,
Args: -1,
},
"bg": &ast.Function{
Function: bgcall,
Name: "background call",
TimesCalled: 0,
Args: -1,
},
"fg": &ast.Function{
Function: fg,
Name: "foreground",
TimesCalled: 0,
Args: 0,
},
"cd": &ast.Function{
Function: cd,
Name: "changedir",
TimesCalled: 0,
Args: 1,
},
"$": &ast.Function{
Function: read_cmd,
Name: "read cmd",
TimesCalled: 0,
Args: -1,
},
"concat": &ast.Function{
Function: concat,
Name:"concatenate",
TimesCalled: 0,
Args: -1,
},
"print": &ast.Function{
Function:print_str,
Name: "print",
TimesCalled: 0,
Args: 1,
},
"exit": &ast.Function{
Function: exit_shell,
Name: "exit",
TimesCalled: 0,
Args: 0,
},
"?": &ast.Function{
Function: get_exit,
Name:"get exit code",
TimesCalled: 0,
Args: 0,
},
/*
USE NATIVE KILL COMMAND.
"kill": &ast.Function{
Function: kill,
Name: "kill job",
TimesCalled: 0,
Args: 1,
},
*/
"eq": &ast.Function{
Function: eq,
Name: "==",
TimesCalled: 0,
Args: 2,
},
"ne": &ast.Function{
Function: ne,
Name: "!=",
TimesCalled: 0,
Args: 2,
},
"<": &ast.Function{
Function: lt,
Name: "<",
TimesCalled: 0,
Args: 2,
},
">": &ast.Function{
Function: gt,
Name: ">",
TimesCalled: 0,
Args: 2,
},
"<=": &ast.Function{
Function: lte,
Name: "<=",
TimesCalled: 0,
Args: 2,
},
">=": &ast.Function{
Function: gte,
Name: ">=",
TimesCalled: 0,
Args: 2,
},
"!": &ast.Function{
Function: not,
Name: "!",
TimesCalled: 0,
Args: 1,
},
"jobs": &ast.Function{
Function: jobs,
Name: "list jobs",
TimesCalled: 0,
Args: 0,
},
}
return stdlib